blob: 7394bc67b495f80aaa4c6a58d634c6484d923f7e [file] [log] [blame]
fmalitabffc2562016-08-03 10:21:11 -07001/*
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
11SkSVGShape::SkSVGShape(SkSVGTag t) : INHERITED(t) {}
12
fmalita397a5172016-08-08 11:38:55 -070013void SkSVGShape::onRender(const SkSVGRenderContext& ctx) const {
Florin Malita57a0edf2017-10-10 11:22:08 -040014 const auto fillType = ctx.presentationContext().fInherited.fFillRule.get()->asFillType();
Florin Malitae932d4b2016-12-01 13:35:11 -050015
fmalita286a8652016-08-10 17:11:29 -070016 // TODO: this approach forces duplicate geometry resolution in onDraw(); refactor to avoid.
fmalita2d961e02016-08-11 09:16:29 -070017 if (const SkPaint* fillPaint = ctx.fillPaint()) {
Florin Malitae932d4b2016-12-01 13:35:11 -050018 this->onDraw(ctx.canvas(), ctx.lengthContext(), *fillPaint, fillType);
fmalitabffc2562016-08-03 10:21:11 -070019 }
20
fmalita2d961e02016-08-11 09:16:29 -070021 if (const SkPaint* strokePaint = ctx.strokePaint()) {
Florin Malitae932d4b2016-12-01 13:35:11 -050022 this->onDraw(ctx.canvas(), ctx.lengthContext(), *strokePaint, fillType);
fmalitabffc2562016-08-03 10:21:11 -070023 }
24}
25
26void SkSVGShape::appendChild(sk_sp<SkSVGNode>) {
27 SkDebugf("cannot append child nodes to an SVG shape.\n");
28}