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

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

Issue 2202053002: [SVGDom/experimental] Initial SVGLength support (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/SkSVGRect.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 8ebaf12f0c019ce63adfe7acdb99a8b3e94250d0..50a6d59e5e84ee109cbadc1e42d7fe294582f86f 100644
--- a/experimental/svg/model/SkSVGRenderContext.h
+++ b/experimental/svg/model/SkSVGRenderContext.h
@@ -8,17 +8,39 @@
#ifndef SkSVGRenderContext_DEFINED
#define SkSVGRenderContext_DEFINED
+#include "SkSize.h"
#include "SkPaint.h"
#include "SkTLazy.h"
class SkPaint;
+class SkSVGLength;
+
+class SkSVGLengthContext {
+public:
+ SkSVGLengthContext(const SkSize& viewport) : fViewport(viewport) {}
+
+ enum class LengthType {
+ kHorizontal,
+ kVertical,
+ kOther,
+ };
+
+ void setViewPort(const SkSize& viewport) { fViewport = viewport; }
+
+ SkScalar resolve(const SkSVGLength&, LengthType) const;
+
+private:
+ SkSize fViewport;
+};
class SkSVGRenderContext {
public:
- SkSVGRenderContext();
+ explicit SkSVGRenderContext(const SkSize& initialViewport);
SkSVGRenderContext(const SkSVGRenderContext&) = default;
SkSVGRenderContext& operator=(const SkSVGRenderContext&);
+ const SkSVGLengthContext& lengthContext() const { return fLengthContext; }
+
const SkPaint* fillPaint() const { return fFill.getMaybeNull(); }
const SkPaint* strokePaint() const { return fStroke.getMaybeNull(); }
@@ -29,8 +51,9 @@ private:
SkPaint& ensureFill();
SkPaint& ensureStroke();
- SkTLazy<SkPaint> fFill;
- SkTLazy<SkPaint> fStroke;
+ SkSVGLengthContext fLengthContext;
+ SkTLazy<SkPaint> fFill;
+ SkTLazy<SkPaint> fStroke;
};
#endif // SkSVGRenderContext_DEFINED
« no previous file with comments | « experimental/svg/model/SkSVGRect.cpp ('k') | experimental/svg/model/SkSVGRenderContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698