aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/svg/model/SkSVGAttribute.cpp
blob: 2f1cace7738c602bad45f1c60cc431b038524f85 (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
31
32
33
34
/*
 * Copyright 2016 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "SkSVGAttribute.h"
#include "SkSVGRenderContext.h"

SkSVGPresentationAttributes::SkSVGPresentationAttributes()
    : fFillIsSet(false)
    , fStrokeIsSet(false) { }

void SkSVGPresentationAttributes::setFill(const SkSVGColorType& c) {
    fFill = c;
    fFillIsSet = true;
}

void SkSVGPresentationAttributes::setStroke(const SkSVGColorType& c) {
    fStroke = c;
    fStrokeIsSet = true;
}


void SkSVGPresentationAttributes::applyTo(SkSVGRenderContext* ctx) const {
    if (fFillIsSet) {
        ctx->writablePresentationContext()->setFillColor(fFill);
    }

    if (fStrokeIsSet) {
        ctx->writablePresentationContext()->setStrokeColor(fStroke);
    }
}