aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/ChromeUtils/SkBorder.cpp
blob: fad27210fc24aacee3ba126fdd2af29e7bb45b71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
 * Copyright 2013 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "SkBorder.h"

SkBorder::SkBorder(SkPaint& p, SkScalar width, BorderStyle style)
    : fFlags(kOnePaint_Flag) {
    fPaints[0] = p;

    for (int i = 0; i < 4; ++i) {
        fWidths[i] = width;
        fStyles[i] = style;
    }
}

SkBorder::SkBorder(const SkPaint paints[4],
                   const SkScalar widths[4],
                   const BorderStyle styles[4])
    : fFlags(0) {
    for (int i = 0; i < 4; ++i) {
        fPaints[i] = paints[i];
    }

    memcpy(fWidths, widths, sizeof(fWidths));
    memcpy(fStyles, styles, sizeof(fStyles));
}