Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
modules
svg
src
SkSVGPath.cpp
Go to the documentation of this file.
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 "
include/core/SkCanvas.h
"
9
#include "
include/core/SkPaint.h
"
10
#include "
include/utils/SkParsePath.h
"
11
#include "
modules/svg/include/SkSVGPath.h
"
12
#include "
modules/svg/include/SkSVGRenderContext.h
"
13
#include "
modules/svg/include/SkSVGValue.h
"
14
15
SkSVGPath::SkSVGPath() :
INHERITED
(
SkSVGTag
::
kPath
) { }
16
17
bool
SkSVGPath::parseAndSetAttribute
(
const
char
* n,
const
char
* v) {
18
return
INHERITED::parseAndSetAttribute
(n, v) ||
19
this->setPath(SkSVGAttributeParser::parse<SkPath>(
"d"
, n, v));
20
}
21
22
template
<>
23
bool
SkSVGAttributeParser::parse<SkPath>(
SkPath
* path) {
24
return
SkParsePath::FromSVGString
(fCurPos, path);
25
}
26
27
void
SkSVGPath::onDraw
(
SkCanvas
* canvas,
const
SkSVGLengthContext
&,
const
SkPaint
&
paint
,
28
SkPathFillType
fillType)
const
{
29
// the passed fillType follows inheritance rules and needs to be applied at draw time.
30
SkPath
path =
fPath
;
// Note: point and verb data are CoW
31
path.setFillType(fillType);
32
canvas->
drawPath
(path,
paint
);
33
}
34
35
SkPath
SkSVGPath::onAsPath
(
const
SkSVGRenderContext
& ctx)
const
{
36
SkPath
path =
fPath
;
37
// clip-rule can be inherited and needs to be applied at clip time.
38
path.setFillType(ctx.
presentationContext
().
fInherited
.
fClipRule
->
asFillType
());
39
this->
mapToParent
(&path);
40
return
path;
41
}
42
43
SkRect
SkSVGPath::onObjectBoundingBox
(
const
SkSVGRenderContext
& ctx)
const
{
44
return
fPath
.
computeTightBounds
();
45
}
fPath
SkPath fPath
Definition
AAConvexPathRenderer.cpp:886
SkCanvas.h
kPath
@ kPath
Definition
SkCustomTypeface.cpp:366
SkPaint.h
SkParsePath.h
SkPathFillType
SkPathFillType
Definition
SkPathTypes.h:11
INHERITED
#define INHERITED(method,...)
Definition
SkRecorder.cpp:128
SkSVGTag
SkSVGTag
Definition
SkSVGNode.h:23
SkSVGPath.h
SkSVGRenderContext.h
SkSVGValue.h
SkCanvas
Definition
SkCanvas.h:106
SkCanvas::drawPath
void drawPath(const SkPath &path, const SkPaint &paint)
Definition
SkCanvas.cpp:2071
SkPaint
Definition
SkPaint.h:44
SkParsePath::FromSVGString
static bool FromSVGString(const char str[], SkPath *)
Definition
SkParsePath.cpp:103
SkPath
Definition
SkPath.h:59
SkPath::computeTightBounds
SkRect computeTightBounds() const
Definition
SkPath.cpp:3378
SkSVGFillRule::asFillType
SkPathFillType asFillType() const
Definition
SkSVGTypes.h:361
SkSVGLengthContext
Definition
SkSVGRenderContext.h:29
SkSVGNode::parseAndSetAttribute
virtual bool parseAndSetAttribute(const char *name, const char *value)
Definition
SkSVGNode.cpp:90
SkSVGPath::onDraw
void onDraw(SkCanvas *, const SkSVGLengthContext &, const SkPaint &, SkPathFillType) const override
Definition
SkSVGPath.cpp:27
SkSVGPath::onAsPath
SkPath onAsPath(const SkSVGRenderContext &) const override
Definition
SkSVGPath.cpp:35
SkSVGPath::onObjectBoundingBox
SkRect onObjectBoundingBox(const SkSVGRenderContext &) const override
Definition
SkSVGPath.cpp:43
SkSVGPath::parseAndSetAttribute
bool parseAndSetAttribute(const char *, const char *) override
Definition
SkSVGPath.cpp:17
SkSVGRenderContext
Definition
SkSVGRenderContext.h:63
SkSVGRenderContext::presentationContext
const SkSVGPresentationContext & presentationContext() const
Definition
SkSVGRenderContext.h:88
SkSVGTransformableNode::mapToParent
void mapToParent(SkPath *) const
Definition
SkSVGTransformableNode.cpp:40
paint
const Paint & paint
Definition
color_source.cc:38
SkRect
Definition
extension.cpp:13
SkSVGPresentationAttributes::fClipRule
SkSVGProperty< SkSVGFillRule, true > fClipRule
Definition
SkSVGAttribute.h:77
SkSVGPresentationContext::fInherited
SkSVGPresentationAttributes fInherited
Definition
SkSVGRenderContext.h:60
Generated on Fri Apr 26 2024 06:16:29 for Flutter Engine by
1.9.8