Index: experimental/svg/model/SkSVGValue.h |
diff --git a/experimental/svg/model/SkSVGValue.h b/experimental/svg/model/SkSVGValue.h |
index a83c4fe07fa926b988774a393889ca1684eed5de..77619c224108918f5aab9fee1c866f23aad8108b 100644 |
--- a/experimental/svg/model/SkSVGValue.h |
+++ b/experimental/svg/model/SkSVGValue.h |
@@ -21,6 +21,7 @@ public: |
kLength, |
kPath, |
kTransform, |
+ kViewBox, |
}; |
Type type() const { return fType; } |
@@ -39,26 +40,31 @@ private: |
typedef SkNoncopyable INHERITED; |
}; |
-template <typename SkiaType, SkSVGValue::Type ValueType> |
+template <typename T, SkSVGValue::Type ValueType> |
class SkSVGWrapperValue final : public SkSVGValue { |
public: |
static constexpr Type TYPE = ValueType; |
- explicit SkSVGWrapperValue(const SkiaType& v) |
+ explicit SkSVGWrapperValue(const T& v) |
: INHERITED(ValueType) |
, fWrappedValue(v) { } |
- operator const SkiaType&() const { return fWrappedValue; } |
+ operator const T&() const { return fWrappedValue; } |
private: |
- SkiaType fWrappedValue; |
+ // Stack-only |
+ void* operator new(size_t) = delete; |
+ void* operator new(size_t, void*) = delete; |
+ |
+ const T& fWrappedValue; |
typedef SkSVGValue INHERITED; |
}; |
-using SkSVGColorValue = SkSVGWrapperValue<SkSVGColor , SkSVGValue::Type::kColor >; |
-using SkSVGLengthValue = SkSVGWrapperValue<SkSVGLength, SkSVGValue::Type::kLength >; |
-using SkSVGPathValue = SkSVGWrapperValue<SkPath , SkSVGValue::Type::kPath >; |
-using SkSVGTransformValue = SkSVGWrapperValue<SkMatrix , SkSVGValue::Type::kTransform>; |
+using SkSVGColorValue = SkSVGWrapperValue<SkSVGColorType , SkSVGValue::Type::kColor >; |
+using SkSVGLengthValue = SkSVGWrapperValue<SkSVGLength , SkSVGValue::Type::kLength >; |
+using SkSVGPathValue = SkSVGWrapperValue<SkPath , SkSVGValue::Type::kPath >; |
+using SkSVGTransformValue = SkSVGWrapperValue<SkMatrix , SkSVGValue::Type::kTransform>; |
+using SkSVGViewBoxValue = SkSVGWrapperValue<SkSVGViewBoxType, SkSVGValue::Type::kViewBox >; |
#endif // SkSVGValue_DEFINED |