Index: Source/platform/graphics/RecordingImageBufferSurface.h |
diff --git a/Source/platform/graphics/RecordingImageBufferSurface.h b/Source/platform/graphics/RecordingImageBufferSurface.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9c2c6d989c62e2410a17fe4ffb4d428d51655ed1 |
--- /dev/null |
+++ b/Source/platform/graphics/RecordingImageBufferSurface.h |
@@ -0,0 +1,47 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef RecordingImageBufferSurface_h |
+#define RecordingImageBufferSurface_h |
+ |
+#include "platform/graphics/ImageBufferSurface.h" |
+#include "wtf/OwnPtr.h" |
+#include "wtf/RefPtr.h" |
+ |
+class SkPicture; |
+class SkPictureRecorder; |
+ |
+namespace WebCore { |
+ |
+class GraphicsContext; |
+ |
+class PLATFORM_EXPORT RecordingImageBufferSurface : public ImageBufferSurface { |
+ WTF_MAKE_NONCOPYABLE(RecordingImageBufferSurface); WTF_MAKE_FAST_ALLOCATED; |
+public: |
+ RecordingImageBufferSurface(const IntSize&, OpacityMode = NonOpaque); |
+ virtual ~RecordingImageBufferSurface(); |
+ |
+ // Implementation of ImageBufferSurface interfaces |
+ virtual SkCanvas* canvas() const OVERRIDE; |
+ virtual PassRefPtr<SkPicture> getPicture() OVERRIDE; |
+ virtual bool isValid() const OVERRIDE { return true; } |
+ virtual void willReadback() OVERRIDE; |
+ virtual void didClearCanvas() OVERRIDE; |
+ virtual void setImageBuffer(ImageBuffer*) OVERRIDE; |
+ |
+private: |
+ void fallBackToRasterCanvas(); |
+ void initializeCurrentFrame(); |
+ bool handleOpaqueFrame(); |
+ |
+ OwnPtr<SkPictureRecorder> m_currentFrame; |
+ RefPtr<SkPicture> m_previousFrame; |
+ OwnPtr<SkCanvas> m_rasterCanvas; |
+ GraphicsContext* m_graphicsContext; |
+ bool m_frameWasCleared; |
+}; |
+ |
+} // namespace WebCore |
+ |
+#endif |