Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4011)

Unified Diff: experimental/svg/model/SkSVGTypes.h

Issue 2327233003: [SVGDom] Initial linear gradient support (Closed)
Patch Set: review Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « experimental/svg/model/SkSVGStop.cpp ('k') | experimental/svg/model/SkSVGValue.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/svg/model/SkSVGTypes.h
diff --git a/experimental/svg/model/SkSVGTypes.h b/experimental/svg/model/SkSVGTypes.h
index 18ec3ce3cf753ace5a1aa39317dd26a0e93c5ec9..b2343a15e4ea996b49879c89b0775f329efddb27 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 {
« no previous file with comments | « experimental/svg/model/SkSVGStop.cpp ('k') | experimental/svg/model/SkSVGValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698