| 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" |
| 11 #include "third_party/skia/include/core/SkCanvas.h" | 11 #include "third_party/skia/include/core/SkCanvas.h" |
| 12 #include "wtf/Allocator.h" | 12 #include "wtf/Allocator.h" |
| 13 #include "wtf/Noncopyable.h" | 13 #include "wtf/Noncopyable.h" |
| 14 #include "wtf/OwnPtr.h" | 14 #include "wtf/OwnPtr.h" |
| 15 #include "wtf/RefPtr.h" | 15 #include "wtf/RefPtr.h" |
| 16 | 16 |
| 17 class SkColorFilter; |
| 17 class SkPicture; | 18 class SkPicture; |
| 18 class SkPictureRecorder; | 19 class SkPictureRecorder; |
| 19 | 20 |
| 20 namespace blink { | 21 namespace blink { |
| 21 | 22 |
| 22 class ImageBuffer; | 23 class ImageBuffer; |
| 23 class RecordingImageBufferSurfaceTest; | 24 class RecordingImageBufferSurfaceTest; |
| 24 | 25 |
| 25 class RecordingImageBufferFallbackSurfaceFactory { | 26 class RecordingImageBufferFallbackSurfaceFactory { |
| 26 USING_FAST_MALLOC(RecordingImageBufferFallbackSurfaceFactory); | 27 USING_FAST_MALLOC(RecordingImageBufferFallbackSurfaceFactory); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 44 PassRefPtr<SkPicture> getPicture() override; | 45 PassRefPtr<SkPicture> getPicture() override; |
| 45 void flush() override; | 46 void flush() override; |
| 46 void didDraw(const FloatRect&) override; | 47 void didDraw(const FloatRect&) override; |
| 47 bool isValid() const override { return true; } | 48 bool isValid() const override { return true; } |
| 48 bool isRecording() const override { return !m_fallbackSurface; } | 49 bool isRecording() const override { return !m_fallbackSurface; } |
| 49 bool writePixels(const SkImageInfo& origInfo, const void* pixels, size_t row
Bytes, int x, int y) override; | 50 bool writePixels(const SkImageInfo& origInfo, const void* pixels, size_t row
Bytes, int x, int y) override; |
| 50 void willOverwriteCanvas() override; | 51 void willOverwriteCanvas() override; |
| 51 virtual void finalizeFrame(const FloatRect&); | 52 virtual void finalizeFrame(const FloatRect&); |
| 52 void setImageBuffer(ImageBuffer*) override; | 53 void setImageBuffer(ImageBuffer*) override; |
| 53 PassRefPtr<SkImage> newImageSnapshot(AccelerationHint) override; | 54 PassRefPtr<SkImage> newImageSnapshot(AccelerationHint) override; |
| 54 void draw(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcR
ect, SkXfermode::Mode) override; | 55 void draw(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcR
ect, SkXfermode::Mode, SkColorFilter* transform) override; |
| 55 bool isExpensiveToPaint() override; | 56 bool isExpensiveToPaint() override; |
| 56 void setHasExpensiveOp() override { m_currentFrameHasExpensiveOp = true; } | 57 void setHasExpensiveOp() override { m_currentFrameHasExpensiveOp = true; } |
| 57 | 58 |
| 58 // Passthroughs to fallback surface | 59 // Passthroughs to fallback surface |
| 59 bool restore() override; | 60 bool restore() override; |
| 60 WebLayer* layer() const override; | 61 WebLayer* layer() const override; |
| 61 bool isAccelerated() const override; | 62 bool isAccelerated() const override; |
| 62 void setIsHidden(bool) override; | 63 void setIsHidden(bool) override; |
| 63 | 64 |
| 64 private: | 65 private: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 78 bool m_frameWasCleared; | 79 bool m_frameWasCleared; |
| 79 bool m_didRecordDrawCommandsInCurrentFrame; | 80 bool m_didRecordDrawCommandsInCurrentFrame; |
| 80 bool m_currentFrameHasExpensiveOp; | 81 bool m_currentFrameHasExpensiveOp; |
| 81 bool m_previousFrameHasExpensiveOp; | 82 bool m_previousFrameHasExpensiveOp; |
| 82 OwnPtr<RecordingImageBufferFallbackSurfaceFactory> m_fallbackFactory; | 83 OwnPtr<RecordingImageBufferFallbackSurfaceFactory> m_fallbackFactory; |
| 83 }; | 84 }; |
| 84 | 85 |
| 85 } // namespace blink | 86 } // namespace blink |
| 86 | 87 |
| 87 #endif | 88 #endif |
| OLD | NEW |