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

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: Source code adjustements + [WIP] layout test problems Created 6 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/platform/graphics/RecordingImageBufferSurface.h
diff --git a/Source/platform/graphics/RecordingImageBufferSurface.h b/Source/platform/graphics/RecordingImageBufferSurface.h
index c8af6a045081ddfc38190d3bd03f27eb84842e20..d48f7e4fbb39b7539690bb71c0563b52d307fbf6 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,9 @@ namespace blink {
class ImageBuffer;
+// The same with the default state stack size in SkCanvas
+#define INITIAL_STATE_STACK_SIZE 1
zino 2014/09/03 10:50:17 Should we use WTF::Deque? I think it is better to
Sergey 2014/09/04 10:26:50 Junov, what do you think? I would probably agree w
+
class PLATFORM_EXPORT RecordingImageBufferSurface : public ImageBufferSurface {
WTF_MAKE_NONCOPYABLE(RecordingImageBufferSurface); WTF_MAKE_FAST_ALLOCATED;
public:
@@ -34,11 +39,22 @@ public:
virtual void setImageBuffer(ImageBuffer*) OVERRIDE;
private:
+ struct StateRec {
+ public:
zino 2014/09/03 10:50:17 Is this Blink coding rule? If not so, I think this
Sergey 2014/09/11 12:58:53 Probably not required here at all.
+ SkMatrix m_ctm;
+ SkRect m_clip;
zino 2014/09/03 10:50:18 If you use getDeviceClipBounds(), you should proba
Sergey 2014/09/11 12:58:52 Probably not required here at all.
+ };
+ typedef Deque<StateRec, INITIAL_STATE_STACK_SIZE> StateStack;
friend class ::RecordingImageBufferSurfaceTest; // for unit testing
void fallBackToRasterCanvas();
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