| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef RecordingImageBufferSurface_h | 5 #ifndef RecordingImageBufferSurface_h |
| 6 #define RecordingImageBufferSurface_h | 6 #define RecordingImageBufferSurface_h |
| 7 | 7 |
| 8 #include "platform/graphics/GraphicsContext.h" | 8 #include "platform/graphics/GraphicsContext.h" |
| 9 #include "platform/graphics/ImageBufferSurface.h" | 9 #include "platform/graphics/ImageBufferSurface.h" |
| 10 #include "public/platform/WebThread.h" | 10 #include "public/platform/WebThread.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 public: | 28 public: |
| 29 virtual PassOwnPtr<ImageBufferSurface> createSurface(const IntSize&, Opacity
Mode) = 0; | 29 virtual PassOwnPtr<ImageBufferSurface> createSurface(const IntSize&, Opacity
Mode) = 0; |
| 30 virtual ~RecordingImageBufferFallbackSurfaceFactory() { } | 30 virtual ~RecordingImageBufferFallbackSurfaceFactory() { } |
| 31 protected: | 31 protected: |
| 32 RecordingImageBufferFallbackSurfaceFactory() { } | 32 RecordingImageBufferFallbackSurfaceFactory() { } |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 class PLATFORM_EXPORT RecordingImageBufferSurface : public ImageBufferSurface { | 35 class PLATFORM_EXPORT RecordingImageBufferSurface : public ImageBufferSurface { |
| 36 WTF_MAKE_NONCOPYABLE(RecordingImageBufferSurface); USING_FAST_MALLOC(Recordi
ngImageBufferSurface); | 36 WTF_MAKE_NONCOPYABLE(RecordingImageBufferSurface); USING_FAST_MALLOC(Recordi
ngImageBufferSurface); |
| 37 public: | 37 public: |
| 38 RecordingImageBufferSurface(const IntSize&, PassOwnPtr<RecordingImageBufferF
allbackSurfaceFactory> fallbackFactory, OpacityMode = NonOpaque); | 38 // If the fallbackFactory is null the buffer surface should only be used |
| 39 // for one frame and should not be used for any operations which need a |
| 40 // raster surface, (i.e. writePixels). |
| 41 // Only #getPicture should be used to access the resulting frame. |
| 42 RecordingImageBufferSurface(const IntSize&, PassOwnPtr<RecordingImageBufferF
allbackSurfaceFactory> fallbackFactory = nullptr, OpacityMode = NonOpaque); |
| 39 ~RecordingImageBufferSurface() override; | 43 ~RecordingImageBufferSurface() override; |
| 40 | 44 |
| 41 // Implementation of ImageBufferSurface interfaces | 45 // Implementation of ImageBufferSurface interfaces |
| 42 SkCanvas* canvas() override; | 46 SkCanvas* canvas() override; |
| 43 void disableDeferral(DisableDeferralReason) override; | 47 void disableDeferral(DisableDeferralReason) override; |
| 44 PassRefPtr<SkPicture> getPicture() override; | 48 PassRefPtr<SkPicture> getPicture() override; |
| 45 void flush(FlushReason) override; | 49 void flush(FlushReason) override; |
| 46 void didDraw(const FloatRect&) override; | 50 void didDraw(const FloatRect&) override; |
| 47 bool isValid() const override { return true; } | 51 bool isValid() const override { return true; } |
| 48 bool isRecording() const override { return !m_fallbackSurface; } | 52 bool isRecording() const override { return !m_fallbackSurface; } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 bool m_frameWasCleared; | 104 bool m_frameWasCleared; |
| 101 bool m_didRecordDrawCommandsInCurrentFrame; | 105 bool m_didRecordDrawCommandsInCurrentFrame; |
| 102 bool m_currentFrameHasExpensiveOp; | 106 bool m_currentFrameHasExpensiveOp; |
| 103 bool m_previousFrameHasExpensiveOp; | 107 bool m_previousFrameHasExpensiveOp; |
| 104 OwnPtr<RecordingImageBufferFallbackSurfaceFactory> m_fallbackFactory; | 108 OwnPtr<RecordingImageBufferFallbackSurfaceFactory> m_fallbackFactory; |
| 105 }; | 109 }; |
| 106 | 110 |
| 107 } // namespace blink | 111 } // namespace blink |
| 108 | 112 |
| 109 #endif | 113 #endif |
| OLD | NEW |