OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef RecordingImageBufferSurface_h |
| 6 #define RecordingImageBufferSurface_h |
| 7 |
| 8 #include "platform/graphics/ImageBufferSurface.h" |
| 9 #include "wtf/OwnPtr.h" |
| 10 #include "wtf/RefPtr.h" |
| 11 |
| 12 class SkPicture; |
| 13 class SkPictureRecorder; |
| 14 |
| 15 namespace WebCore { |
| 16 |
| 17 class GraphicsContext; |
| 18 |
| 19 class PLATFORM_EXPORT RecordingImageBufferSurface : public ImageBufferSurface { |
| 20 WTF_MAKE_NONCOPYABLE(RecordingImageBufferSurface); WTF_MAKE_FAST_ALLOCATED; |
| 21 public: |
| 22 RecordingImageBufferSurface(const IntSize&, OpacityMode = NonOpaque); |
| 23 virtual ~RecordingImageBufferSurface(); |
| 24 |
| 25 // Implementation of ImageBufferSurface interfaces |
| 26 virtual SkCanvas* canvas() const OVERRIDE; |
| 27 virtual PassRefPtr<SkPicture> getPicture() OVERRIDE; |
| 28 virtual bool isValid() const OVERRIDE { return true; } |
| 29 virtual void willReadback() OVERRIDE; |
| 30 virtual void didClearCanvas() OVERRIDE; |
| 31 virtual void setImageBuffer(ImageBuffer*) OVERRIDE; |
| 32 |
| 33 private: |
| 34 void fallBackToRasterCanvas(); |
| 35 void initializeCurrentFrame(); |
| 36 bool handleOpaqueFrame(); |
| 37 |
| 38 OwnPtr<SkPictureRecorder> m_currentFrame; |
| 39 RefPtr<SkPicture> m_previousFrame; |
| 40 OwnPtr<SkCanvas> m_rasterCanvas; |
| 41 GraphicsContext* m_graphicsContext; |
| 42 bool m_frameWasCleared; |
| 43 }; |
| 44 |
| 45 } // namespace WebCore |
| 46 |
| 47 #endif |
OLD | NEW |