aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/svg/model/SkSVGTypes.h
diff options
context:
space:
mode:
authorGravatar fmalita <fmalita@chromium.org>2016-09-12 17:06:47 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-09-12 17:06:47 -0700
commit28d5b72d86fdfae20dc47ba548748f119c7273e3 (patch)
tree579d10ae07a10a882ca68d00c2da6fa407c0c658 /experimental/svg/model/SkSVGTypes.h
parent8c24f4fae3389b9937eb73128e76226cffebdd72 (diff)
[SVGDom] Initial linear gradient support
Kind of a big change, to connect several new bits into something useful: * ID tracking & lookup * new asPaint() node virtual to support shader (and in the future filter) based paint servers * <defs>, <linearGradient> and <stop> element support * 'href', 'offset', 'stop-color', 'stop-opacity' attribute support * IRI/FuncIRI and rgb(...) parsing BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2327233003 Review-Url: https://codereview.chromium.org/2327233003
Diffstat (limited to 'experimental/svg/model/SkSVGTypes.h')
-rw-r--r--experimental/svg/model/SkSVGTypes.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/experimental/svg/model/SkSVGTypes.h b/experimental/svg/model/SkSVGTypes.h
index 18ec3ce3cf..b2343a15e4 100644
--- a/experimental/svg/model/SkSVGTypes.h
+++ b/experimental/svg/model/SkSVGTypes.h
@@ -13,6 +13,7 @@
#include "SkPoint.h"
#include "SkRect.h"
#include "SkScalar.h"
+#include "SkString.h"
#include "SkTDArray.h"
#include "SkTypes.h"
@@ -42,6 +43,7 @@ private:
using SkSVGColorType = SkSVGPrimitiveTypeWrapper<SkColor >;
using SkSVGNumberType = SkSVGPrimitiveTypeWrapper<SkScalar>;
+using SkSVGStringType = SkSVGPrimitiveTypeWrapper<SkString>;
using SkSVGViewBoxType = SkSVGPrimitiveTypeWrapper<SkRect >;
using SkSVGTransformType = SkSVGPrimitiveTypeWrapper<SkMatrix>;
using SkSVGPointsType = SkSVGPrimitiveTypeWrapper<SkTDArray<SkPoint>>;
@@ -88,27 +90,33 @@ public:
kCurrentColor,
kColor,
kInherit,
+ kIRI,
};
- constexpr SkSVGPaint() : fType(Type::kInherit), fColor(SK_ColorBLACK) {}
- explicit constexpr SkSVGPaint(Type t) : fType(t), fColor(SK_ColorBLACK) {}
- explicit constexpr SkSVGPaint(const SkSVGColorType& c) : fType(Type::kColor), fColor(c) {}
+ SkSVGPaint() : fType(Type::kInherit), fColor(SK_ColorBLACK) {}
+ explicit SkSVGPaint(Type t) : fType(t), fColor(SK_ColorBLACK) {}
+ explicit SkSVGPaint(const SkSVGColorType& c) : fType(Type::kColor), fColor(c) {}
+ explicit SkSVGPaint(const SkString& iri)
+ : fType(Type::kIRI), fColor(SK_ColorBLACK), fIRI(iri) {}
SkSVGPaint(const SkSVGPaint&) = default;
SkSVGPaint& operator=(const SkSVGPaint&) = default;
bool operator==(const SkSVGPaint& other) const {
- return fType == other.fType && fColor == other.fColor;
+ return fType == other.fType && fColor == other.fColor && fIRI == other.fIRI;
}
bool operator!=(const SkSVGPaint& other) const { return !(*this == other); }
Type type() const { return fType; }
const SkSVGColorType& color() const { SkASSERT(fType == Type::kColor); return fColor; }
+ const SkString& iri() const { SkASSERT(fType == Type::kIRI); return fIRI; }
private:
Type fType;
+ // Logical union.
SkSVGColorType fColor;
+ SkString fIRI;
};
class SkSVGLineCap {