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

Unified Diff: Source/platform/graphics/RecordingImageBufferSurface.h

Issue 501353002: Transfer canvas state to the next frame with noticable restrictions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: [WIP] adjusting to comments Created 6 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
Index: Source/platform/graphics/RecordingImageBufferSurface.h
diff --git a/Source/platform/graphics/RecordingImageBufferSurface.h b/Source/platform/graphics/RecordingImageBufferSurface.h
index c8af6a045081ddfc38190d3bd03f27eb84842e20..a3d887e274115296f3a039ede26522ac64f0db7e 100644
--- a/Source/platform/graphics/RecordingImageBufferSurface.h
+++ b/Source/platform/graphics/RecordingImageBufferSurface.h
@@ -7,6 +7,8 @@
#include "platform/graphics/ImageBufferSurface.h"
#include "public/platform/WebThread.h"
+#include "third_party/skia/include/core/SkCanvas.h"
+#include "wtf/Deque.h"
#include "wtf/OwnPtr.h"
#include "wtf/RefPtr.h"
@@ -18,6 +20,17 @@ namespace blink {
class ImageBuffer;
Sergey 2014/08/28 09:55:34 I am not sure, that this declarations belong here.
+// The same with the default state stack size in SkCanvas
+#define INITIAL_STATE_STACK_SIZE 1
+
+struct StateRec {
Justin Novosad 2014/08/28 14:53:00 This struct and the typedef below should be moved
Sergey 2014/09/03 01:50:51 Done.
+public:
+ SkMatrix m_ctm;
+ SkRect m_clip;
+};
+
+typedef Deque<StateRec, INITIAL_STATE_STACK_SIZE> StateStack;
+
class PLATFORM_EXPORT RecordingImageBufferSurface : public ImageBufferSurface {
WTF_MAKE_NONCOPYABLE(RecordingImageBufferSurface); WTF_MAKE_FAST_ALLOCATED;
public:
@@ -39,6 +52,11 @@ private:
void initializeCurrentFrame();
bool finalizeFrameInternal();
+ // saves current clip and transform matrix of canvas
+ bool saveState(SkCanvas*, StateStack*);
+ // we should make sure that we can transfer state in saveState
+ void setCurrentState(SkCanvas*, StateStack*);
+
OwnPtr<SkPictureRecorder> m_currentFrame;
RefPtr<SkPicture> m_previousFrame;
OwnPtr<SkCanvas> m_rasterCanvas;

Powered by Google App Engine
This is Rietveld 408576698