Coverage Report

Created: 2021-08-22 09:07

/src/skia/modules/svg/src/SkSVGShape.cpp
Line
Count
Source
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 "modules/svg/include/SkSVGRenderContext.h"
9
#include "modules/svg/include/SkSVGShape.h"
10
11
114k
SkSVGShape::SkSVGShape(SkSVGTag t) : INHERITED(t) {}
12
13
56.5k
void SkSVGShape::onRender(const SkSVGRenderContext& ctx) const {
14
56.5k
    const auto fillType = ctx.presentationContext().fInherited.fFillRule->asFillType();
15
16
56.5k
    const auto fillPaint = ctx.fillPaint(),
17
56.5k
             strokePaint = ctx.strokePaint();
18
19
    // TODO: this approach forces duplicate geometry resolution in onDraw(); refactor to avoid.
20
56.5k
    if (fillPaint.isValid()) {
21
48.0k
        this->onDraw(ctx.canvas(), ctx.lengthContext(), *fillPaint, fillType);
22
48.0k
    }
23
24
56.5k
    if (strokePaint.isValid()) {
25
37.6k
        this->onDraw(ctx.canvas(), ctx.lengthContext(), *strokePaint, fillType);
26
37.6k
    }
27
56.5k
}
28
29
93
void SkSVGShape::appendChild(sk_sp<SkSVGNode>) {
30
93
    SkDebugf("cannot append child nodes to an SVG shape.\n");
31
93
}