1 /*
2  * Copyright 2013 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #include "SkBorder.h"
9 
SkBorder(SkPaint & p,SkScalar width,BorderStyle style)10 SkBorder::SkBorder(SkPaint& p, SkScalar width, BorderStyle style)
11     : fFlags(kOnePaint_Flag) {
12     fPaints[0] = p;
13 
14     for (int i = 0; i < 4; ++i) {
15         fWidths[i] = width;
16         fStyles[i] = style;
17     }
18 }
19 
SkBorder(const SkPaint paints[4],const SkScalar widths[4],const BorderStyle styles[4])20 SkBorder::SkBorder(const SkPaint paints[4],
21                    const SkScalar widths[4],
22                    const BorderStyle styles[4])
23     : fFlags(0) {
24     for (int i = 0; i < 4; ++i) {
25         fPaints[i] = paints[i];
26     }
27 
28     memcpy(fWidths, widths, sizeof(fWidths));
29     memcpy(fStyles, styles, sizeof(fStyles));
30 }
31