• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef SkSVGAttribute_DEFINED
9 #define SkSVGAttribute_DEFINED
10 
11 #include "SkSVGTypes.h"
12 #include "SkTLazy.h"
13 
14 class SkSVGRenderContext;
15 
16 enum class SkSVGAttribute {
17     kClipPath,
18     kClipRule,
19     kCx, // <circle>, <ellipse>, <radialGradient>: center x position
20     kCy, // <circle>, <ellipse>, <radialGradient>: center y position
21     kD,
22     kFill,
23     kFillOpacity,
24     kFillRule,
25     kFx, // <radialGradient>: focal point x position
26     kFy, // <radialGradient>: focal point y position
27     kGradientTransform,
28     kHeight,
29     kHref,
30     kOffset,
31     kOpacity,
32     kPatternTransform,
33     kPoints,
34     kR,  // <circle>, <radialGradient>: radius
35     kRx, // <ellipse>,<rect>: horizontal (corner) radius
36     kRy, // <ellipse>,<rect>: vertical (corner) radius
37     kSpreadMethod,
38     kStopColor,
39     kStopOpacity,
40     kStroke,
41     kStrokeDashArray,
42     kStrokeDashOffset,
43     kStrokeOpacity,
44     kStrokeLineCap,
45     kStrokeLineJoin,
46     kStrokeMiterLimit,
47     kStrokeWidth,
48     kTransform,
49     kViewBox,
50     kVisibility,
51     kWidth,
52     kX,
53     kX1, // <line>: first endpoint x
54     kX2, // <line>: second endpoint x
55     kY,
56     kY1, // <line>: first endpoint y
57     kY2, // <line>: second endpoint y
58 
59     kUnknown,
60 };
61 
62 struct SkSVGPresentationAttributes {
63     static SkSVGPresentationAttributes MakeInitial();
64 
65     // TODO: SkTLazy adds an extra ptr per attribute; refactor to reduce overhead.
66 
67     SkTLazy<SkSVGPaint>      fFill;
68     SkTLazy<SkSVGNumberType> fFillOpacity;
69     SkTLazy<SkSVGFillRule>   fFillRule;
70     SkTLazy<SkSVGFillRule>   fClipRule;
71 
72     SkTLazy<SkSVGPaint>      fStroke;
73     SkTLazy<SkSVGDashArray>  fStrokeDashArray;
74     SkTLazy<SkSVGLength>     fStrokeDashOffset;
75     SkTLazy<SkSVGLineCap>    fStrokeLineCap;
76     SkTLazy<SkSVGLineJoin>   fStrokeLineJoin;
77     SkTLazy<SkSVGNumberType> fStrokeMiterLimit;
78     SkTLazy<SkSVGNumberType> fStrokeOpacity;
79     SkTLazy<SkSVGLength>     fStrokeWidth;
80 
81     SkTLazy<SkSVGVisibility> fVisibility;
82 
83     // uninherited
84     SkTLazy<SkSVGNumberType> fOpacity;
85     SkTLazy<SkSVGClip>       fClipPath;
86 };
87 
88 #endif // SkSVGAttribute_DEFINED
89