1 /* 2 * Copyright 2016 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 "SkSVGRenderContext.h" 9 #include "SkSVGShape.h" 10 SkSVGShape(SkSVGTag t)11SkSVGShape::SkSVGShape(SkSVGTag t) : INHERITED(t) {} 12 onRender(const SkSVGRenderContext & ctx) const13void SkSVGShape::onRender(const SkSVGRenderContext& ctx) const { 14 const auto fillType = ctx.presentationContext().fInherited.fFillRule.get()->asFillType(); 15 16 // TODO: this approach forces duplicate geometry resolution in onDraw(); refactor to avoid. 17 if (const SkPaint* fillPaint = ctx.fillPaint()) { 18 this->onDraw(ctx.canvas(), ctx.lengthContext(), *fillPaint, fillType); 19 } 20 21 if (const SkPaint* strokePaint = ctx.strokePaint()) { 22 this->onDraw(ctx.canvas(), ctx.lengthContext(), *strokePaint, fillType); 23 } 24 } 25 appendChild(sk_sp<SkSVGNode>)26void SkSVGShape::appendChild(sk_sp<SkSVGNode>) { 27 SkDebugf("cannot append child nodes to an SVG shape.\n"); 28 } 29