Index: Source/platform/graphics/GraphicsContextStateSaver.h |
diff --git a/Source/platform/graphics/GraphicsContextStateSaver.h b/Source/platform/graphics/GraphicsContextStateSaver.h |
index 7134a98d938e44a9e0041b120a4cebc24238a54d..53e1105d01d5491af1d7ebb1845690581acae01f 100644 |
--- a/Source/platform/graphics/GraphicsContextStateSaver.h |
+++ b/Source/platform/graphics/GraphicsContextStateSaver.h |
@@ -80,6 +80,26 @@ private: |
bool m_saveAndRestore; |
}; |
+class GraphicsContextCTMSaver { |
+public: |
+ GraphicsContextCTMSaver(GraphicsContext& context) |
+ : m_canvas(context.contextDisabled() ? nullptr : context.canvas()) |
+ { |
+ if (m_canvas) |
+ m_savedMatrix = m_canvas->getTotalMatrix(); |
+ } |
+ |
+ ~GraphicsContextCTMSaver() |
+ { |
+ if (m_canvas) |
+ m_canvas->setMatrix(m_savedMatrix); |
+ } |
+ |
+private: |
+ SkMatrix m_savedMatrix; |
+ SkCanvas* m_canvas; |
+}; |
+ |
} // namespace blink |
#endif // GraphicsContextStateSaver_h |