2016-08-03 17:21:11 +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 "SkSVGRenderContext.h"
|
|
|
|
#include "SkSVGShape.h"
|
|
|
|
|
|
|
|
SkSVGShape::SkSVGShape(SkSVGTag t) : INHERITED(t) {}
|
|
|
|
|
2016-08-08 18:38:55 +00:00
|
|
|
void SkSVGShape::onRender(const SkSVGRenderContext& ctx) const {
|
2017-10-10 15:22:08 +00:00
|
|
|
const auto fillType = ctx.presentationContext().fInherited.fFillRule.get()->asFillType();
|
2016-12-01 18:35:11 +00:00
|
|
|
|
2016-08-11 00:11:29 +00:00
|
|
|
// TODO: this approach forces duplicate geometry resolution in onDraw(); refactor to avoid.
|
2016-08-11 16:16:29 +00:00
|
|
|
if (const SkPaint* fillPaint = ctx.fillPaint()) {
|
2016-12-01 18:35:11 +00:00
|
|
|
this->onDraw(ctx.canvas(), ctx.lengthContext(), *fillPaint, fillType);
|
2016-08-03 17:21:11 +00:00
|
|
|
}
|
|
|
|
|
2016-08-11 16:16:29 +00:00
|
|
|
if (const SkPaint* strokePaint = ctx.strokePaint()) {
|
2016-12-01 18:35:11 +00:00
|
|
|
this->onDraw(ctx.canvas(), ctx.lengthContext(), *strokePaint, fillType);
|
2016-08-03 17:21:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SkSVGShape::appendChild(sk_sp<SkSVGNode>) {
|
|
|
|
SkDebugf("cannot append child nodes to an SVG shape.\n");
|
|
|
|
}
|