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

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

Issue 2234153002: [SVGDom] Add more presentation attributes. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: review Created 4 years, 4 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/SkSVGNode.cpp ('k') | experimental/svg/model/SkSVGRenderContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « experimental/svg/model/SkSVGNode.cpp ('k') | experimental/svg/model/SkSVGRenderContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698