2016-07-27 01:46:34 +00:00
|
|
|
/*
|
|
|
|
* 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) { }
|
|
|
|
|
2016-08-08 18:38:55 +00:00
|
|
|
void SkSVGPresentationAttributes::setFill(const SkSVGColorType& c) {
|
2016-07-27 01:46:34 +00:00
|
|
|
fFill = c;
|
|
|
|
fFillIsSet = true;
|
|
|
|
}
|
|
|
|
|
2016-08-08 18:38:55 +00:00
|
|
|
void SkSVGPresentationAttributes::setStroke(const SkSVGColorType& c) {
|
2016-07-27 01:46:34 +00:00
|
|
|
fStroke = c;
|
|
|
|
fStrokeIsSet = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-08-08 18:38:55 +00:00
|
|
|
void SkSVGPresentationAttributes::applyTo(SkSVGRenderContext* ctx) const {
|
2016-07-27 01:46:34 +00:00
|
|
|
if (fFillIsSet) {
|
2016-08-08 18:38:55 +00:00
|
|
|
ctx->writablePresentationContext()->setFillColor(fFill);
|
2016-07-27 01:46:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (fStrokeIsSet) {
|
2016-08-08 18:38:55 +00:00
|
|
|
ctx->writablePresentationContext()->setStrokeColor(fStroke);
|
2016-07-27 01:46:34 +00:00
|
|
|
}
|
|
|
|
}
|