8#ifndef SkSVGNode_DEFINED
9#define SkSVGNode_DEFINED
71#define SVG_PRES_ATTR(attr_name, attr_type, attr_inherited) \
73 bool set##attr_name(SkSVGAttributeParser::ParseResult< \
74 SkSVGProperty<attr_type, attr_inherited>>&& pr) {\
75 if (pr.isValid()) { this->set##attr_name(std::move(*pr)); } \
76 return pr.isValid(); \
80 const SkSVGProperty<attr_type, attr_inherited>& get##attr_name() const { \
81 return fPresentationAttributes.f##attr_name; \
83 void set##attr_name(const SkSVGProperty<attr_type, attr_inherited>& v) { \
84 auto* dest = &fPresentationAttributes.f##attr_name; \
85 if (!dest->isInheritable() || v.isValue()) { \
89 dest->set(SkSVGPropertyState::kInherit); \
92 void set##attr_name(SkSVGProperty<attr_type, attr_inherited>&& v) { \
93 auto* dest = &fPresentationAttributes.f##attr_name; \
94 if (!dest->isInheritable() || v.isValue()) { \
96 *dest = std::move(v); \
98 dest->set(SkSVGPropertyState::kInherit); \
116 bool setAttribute(
const char* attributeName,
const char* attributeValue);
119 virtual bool parseAndSetAttribute(
const char*
name,
const char*
value);
194#define _SVG_ATTR_SETTERS(attr_name, attr_type, attr_default, set_cp, set_mv) \
196 bool set##attr_name( \
197 const SkSVGAttributeParser::ParseResult<attr_type>& pr) { \
198 if (pr.isValid()) { this->set##attr_name(*pr); } \
199 return pr.isValid(); \
201 bool set##attr_name( \
202 SkSVGAttributeParser::ParseResult<attr_type>&& pr) { \
203 if (pr.isValid()) { this->set##attr_name(std::move(*pr)); } \
204 return pr.isValid(); \
207 void set##attr_name(const attr_type& a) { set_cp(a); } \
208 void set##attr_name(attr_type&& a) { set_mv(std::move(a)); }
210#define SVG_ATTR(attr_name, attr_type, attr_default) \
212 attr_type f##attr_name = attr_default; \
214 const attr_type& get##attr_name() const { return f##attr_name; } \
216 attr_name, attr_type, attr_default, \
217 [this](const attr_type& a) { this->f##attr_name = a; }, \
218 [this](attr_type&& a) { this->f##attr_name = std::move(a); })
220#define SVG_OPTIONAL_ATTR(attr_name, attr_type) \
222 SkTLazy<attr_type> f##attr_name; \
224 const SkTLazy<attr_type>& get##attr_name() const { return f##attr_name; } \
226 attr_name, attr_type, attr_default, \
227 [this](const attr_type& a) { this->f##attr_name.set(a); }, \
228 [this](attr_type&& a) { this->f##attr_name.set(std::move(a)); })
@ kLine
SkPath::RawIter returns 2 points.
#define INHERITED(method,...)
#define SVG_PRES_ATTR(attr_name, attr_type, attr_inherited)
virtual SkRect onObjectBoundingBox(const SkSVGRenderContext &) const
virtual void appendChild(sk_sp< SkSVGNode >)=0
virtual void onSetAttribute(SkSVGAttribute, const SkSVGValue &)
virtual bool hasChildren() const
virtual SkPath onAsPath(const SkSVGRenderContext &) const =0
SK_API sk_sp< SkShader > Color(SkColor)
DEF_SWITCHES_START aot vmservice shared library name
def render(idl_node, indent_str=' ')
static constexpr SkRect MakeEmpty()