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

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

Issue 24233004: Support currentTransform in 2D Canvas. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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.cpp
diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.cpp b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
index 3225ecd6344fed465e421df94628b5dea72dc844..d1c3e5990757b1842567f1185aae59a994f2093e 100644
--- a/Source/core/html/canvas/CanvasRenderingContext2D.cpp
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
@@ -64,6 +64,7 @@
#include "core/platform/graphics/transforms/AffineTransform.h"
#include "core/rendering/RenderLayer.h"
#include "core/rendering/RenderTheme.h"
+#include "core/svg/SVGMatrix.h"
Justin Novosad 2013/09/19 19:23:48 Are you sure this include is necessary?
#include "weborigin/SecurityOrigin.h"
#include "wtf/CheckedArithmetic.h"
#include "wtf/MathExtras.h"
@@ -596,6 +597,16 @@ void CanvasRenderingContext2D::setGlobalCompositeOperation(const String& operati
c->setCompositeOperation(op, blendMode);
}
+SVGMatrix CanvasRenderingContext2D::currentTransform() const
+{
+ return SVGMatrix(state().m_transform);
+}
+
+void CanvasRenderingContext2D::setCurrentTransform(const SVGMatrix& currentTransform)
+{
+ setTransform(currentTransform.a(), currentTransform.b(), currentTransform.c(), currentTransform.d(), currentTransform.e(), currentTransform.f());
+}
+
void CanvasRenderingContext2D::scale(float sx, float sy)
{
GraphicsContext* c = drawingContext();
@@ -698,12 +709,12 @@ void CanvasRenderingContext2D::transform(float m11, float m12, float m21, float
realizeSaves();
+ modifiableState().m_transform = newTransform;
if (!newTransform.isInvertible()) {
modifiableState().m_invertibleCTM = false;
return;
}
- modifiableState().m_transform = newTransform;
c->concatCTM(transform);
m_path.transform(transform.inverse());
}

Powered by Google App Engine
This is Rietveld 408576698