Home | History | Annotate | Download | only in model
      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     kCx, // <circle>,<ellipse>: center x position
     19     kCy, // <circle>,<ellipse>: center y position
     20     kD,
     21     kFill,
     22     kFillOpacity,
     23     kFillRule,
     24     kGradientTransform,
     25     kHeight,
     26     kHref,
     27     kOffset,
     28     kOpacity,
     29     kPoints,
     30     kR,  // <circle>: radius
     31     kRx, // <ellipse>,<rect>: horizontal (corner) radius
     32     kRy, // <ellipse>,<rect>: vertical (corner) radius
     33     kSpreadMethod,
     34     kStopColor,
     35     kStopOpacity,
     36     kStroke,
     37     kStrokeOpacity,
     38     kStrokeLineCap,
     39     kStrokeLineJoin,
     40     kStrokeWidth,
     41     kTransform,
     42     kViewBox,
     43     kWidth,
     44     kX,
     45     kX1, // <line>: first endpoint x
     46     kX2, // <line>: second endpoint x
     47     kY,
     48     kY1, // <line>: first endpoint y
     49     kY2, // <line>: second endpoint y
     50 
     51     kUnknown,
     52 };
     53 
     54 struct SkSVGPresentationAttributes {
     55     static SkSVGPresentationAttributes MakeInitial();
     56 
     57     // TODO: SkTLazy adds an extra ptr per attribute; refactor to reduce overhead.
     58 
     59     SkTLazy<SkSVGPaint>      fFill;
     60     SkTLazy<SkSVGNumberType> fFillOpacity;
     61     SkTLazy<SkSVGFillRule>   fFillRule;
     62 
     63     SkTLazy<SkSVGPaint>      fStroke;
     64     SkTLazy<SkSVGLineCap>    fStrokeLineCap;
     65     SkTLazy<SkSVGLineJoin>   fStrokeLineJoin;
     66     SkTLazy<SkSVGNumberType> fStrokeOpacity;
     67     SkTLazy<SkSVGLength>     fStrokeWidth;
     68 
     69     // uninherited
     70     SkTLazy<SkSVGNumberType> fOpacity;
     71     SkTLazy<SkSVGClip>       fClipPath;
     72 };
     73 
     74 #endif // SkSVGAttribute_DEFINED
     75