Index: experimental/svg/model/SkSVGRenderContext.h |
diff --git a/experimental/svg/model/SkSVGRenderContext.h b/experimental/svg/model/SkSVGRenderContext.h |
index 47886d7cb0c35f75e284d1432a1138a112891ac4..e6df725a5c37bd517c7af08a53735d2f649669fe 100644 |
--- a/experimental/svg/model/SkSVGRenderContext.h |
+++ b/experimental/svg/model/SkSVGRenderContext.h |
@@ -11,6 +11,7 @@ |
#include "SkPaint.h" |
#include "SkRect.h" |
#include "SkSize.h" |
+#include "SkSVGAttribute.h" |
#include "SkTLazy.h" |
#include "SkTypes.h" |
@@ -38,27 +39,17 @@ private: |
SkSize fViewport; |
}; |
-class SkSVGPresentationContext { |
-public: |
+struct SkSVGPresentationContext { |
SkSVGPresentationContext(); |
- SkSVGPresentationContext(const SkSVGPresentationContext&); |
- SkSVGPresentationContext& operator=(const SkSVGPresentationContext&); |
- |
- const SkPaint* fillPaint() const { return fFill.getMaybeNull(); } |
- const SkPaint* strokePaint() const { return fStroke.getMaybeNull(); } |
- |
- void setFillColor(SkColor); |
- void setStrokeColor(SkColor); |
- |
-private: |
- void initFrom(const SkSVGPresentationContext&); |
+ SkSVGPresentationContext(const SkSVGPresentationContext&) = default; |
+ SkSVGPresentationContext& operator=(const SkSVGPresentationContext&) = default; |
- SkPaint& ensureFill(); |
- SkPaint& ensureStroke(); |
+ // Inherited presentation attributes, computed for the current node. |
+ SkSVGPresentationAttributes fInherited; |
- // TODO: convert to regular SkPaints and track explicit attribute values instead. |
- SkTLazy<SkPaint> fFill; |
- SkTLazy<SkPaint> fStroke; |
+ // Cached paints, reflecting the current presentation attributes. |
+ SkPaint fFillPaint; |
+ SkPaint fStrokePaint; |
}; |
class SkSVGRenderContext { |
@@ -70,13 +61,13 @@ public: |
const SkSVGLengthContext& lengthContext() const { return *fLengthContext; } |
SkSVGLengthContext* writableLengthContext() { return fLengthContext.writable(); } |
- const SkSVGPresentationContext& presentationContext() const { return *fPresentationContext; } |
- SkSVGPresentationContext* writablePresentationContext() { |
- return fPresentationContext.writable(); |
- } |
- |
SkCanvas* canvas() const { return fCanvas; } |
+ void applyPresentationAttributes(const SkSVGPresentationAttributes&); |
+ |
+ const SkPaint* fillPaint() const; |
+ const SkPaint* strokePaint() const; |
+ |
private: |
// Stack-only |
void* operator new(size_t) = delete; |