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

Unified Diff: Source/core/html/canvas/CanvasRenderingContext2D.h

Issue 24233004: Support currentTransform in 2D Canvas. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove custom binding based on ch.dumez's work Created 7 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
Index: Source/core/html/canvas/CanvasRenderingContext2D.h
diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.h b/Source/core/html/canvas/CanvasRenderingContext2D.h
index a3f8eb1cfa2181615fba78ba660f01fa79ebf0d4..72e2459c2d25f6acbc32a257c55076b62ed0b331 100644
--- a/Source/core/html/canvas/CanvasRenderingContext2D.h
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.h
@@ -36,6 +36,8 @@
#include "core/platform/graphics/ImageBuffer.h"
#include "core/platform/graphics/Path.h"
#include "core/platform/graphics/transforms/AffineTransform.h"
+#include "core/svg/SVGMatrix.h"
+#include "core/svg/properties/SVGPropertyTearOff.h"
#include "wtf/HashMap.h"
#include "wtf/Vector.h"
#include "wtf/text/WTFString.h"
@@ -117,6 +119,20 @@ public:
void save() { ++m_unrealizedSaveCount; }
void restore();
+ // TODO(dshwang): Need to clean up currentTransform binding methods via improving binding generator script.
+ // The binding code generated by 'attribute SVGMatix foo' in idl requires foo() and updateFoo(),
+ // because SVGTransform.idl needs to return the reference of SVGMatrix.
+ // When JS changes the return value, SVGTransform is applied immediately.
+ // However, CanvanRenderingContext2D doesn't need the implicit update.
+ // So updateCurrentTransform() does nothing.
+ SVGMatrix& currentTransform()
+ {
+ m_dummyCurrentTransform = SVGMatrix(state().m_transform);
+ return m_dummyCurrentTransform;
+ }
+ void updateCurrentTransform() { }
+ void setCurrentTransform(SVGPropertyTearOff<SVGMatrix>*, ExceptionState&);
+
void scale(float sx, float sy);
void rotate(float angleInRadians);
void translate(float tx, float ty);
@@ -330,6 +346,7 @@ private:
bool m_usesCSSCompatibilityParseMode;
bool m_hasAlpha;
MutableStylePropertyMap m_fetchedFonts;
+ SVGMatrix m_dummyCurrentTransform;
};
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698