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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 bool writePixels(const SkImageInfo& origInfo, const void* pixels, size_t row
Bytes, int x, int y) override; | 43 bool writePixels(const SkImageInfo& origInfo, const void* pixels, size_t row
Bytes, int x, int y) override; |
44 void willOverwriteCanvas() override; | 44 void willOverwriteCanvas() override; |
45 virtual void finalizeFrame(const FloatRect&); | 45 virtual void finalizeFrame(const FloatRect&); |
46 void setImageBuffer(ImageBuffer*) override; | 46 void setImageBuffer(ImageBuffer*) override; |
47 PassRefPtr<SkImage> newImageSnapshot(AccelerationHint) override; | 47 PassRefPtr<SkImage> newImageSnapshot(AccelerationHint) override; |
48 void draw(GraphicsContext*, const FloatRect& destRect, const FloatRect& srcR
ect, SkXfermode::Mode) override; | 48 void draw(GraphicsContext*, const FloatRect& destRect, const FloatRect& srcR
ect, SkXfermode::Mode) override; |
49 bool isExpensiveToPaint() override; | 49 bool isExpensiveToPaint() override; |
50 void setHasExpensiveOp() override { m_currentFrameHasExpensiveOp = true; } | 50 void setHasExpensiveOp() override { m_currentFrameHasExpensiveOp = true; } |
51 | 51 |
52 // Passthroughs to fallback surface | 52 // Passthroughs to fallback surface |
53 const SkBitmap& deprecatedBitmapForOverwrite() override; | |
54 bool restore() override; | 53 bool restore() override; |
55 WebLayer* layer() const override; | 54 WebLayer* layer() const override; |
56 bool isAccelerated() const override; | 55 bool isAccelerated() const override; |
57 void setIsHidden(bool) override; | 56 void setIsHidden(bool) override; |
58 | 57 |
59 private: | 58 private: |
60 friend class RecordingImageBufferSurfaceTest; // for unit testing | 59 friend class RecordingImageBufferSurfaceTest; // for unit testing |
61 void fallBackToRasterCanvas(); | 60 void fallBackToRasterCanvas(); |
62 bool initializeCurrentFrame(); | 61 bool initializeCurrentFrame(); |
63 bool finalizeFrameInternal(); | 62 bool finalizeFrameInternal(); |
64 int approximateOpCount(); | 63 int approximateOpCount(); |
65 | 64 |
66 OwnPtr<SkPictureRecorder> m_currentFrame; | 65 OwnPtr<SkPictureRecorder> m_currentFrame; |
67 RefPtr<SkPicture> m_previousFrame; | 66 RefPtr<SkPicture> m_previousFrame; |
68 OwnPtr<ImageBufferSurface> m_fallbackSurface; | 67 OwnPtr<ImageBufferSurface> m_fallbackSurface; |
69 ImageBuffer* m_imageBuffer; | 68 ImageBuffer* m_imageBuffer; |
70 int m_initialSaveCount; | 69 int m_initialSaveCount; |
71 int m_currentFramePixelCount; | 70 int m_currentFramePixelCount; |
72 int m_previousFramePixelCount; | 71 int m_previousFramePixelCount; |
73 bool m_frameWasCleared; | 72 bool m_frameWasCleared; |
74 bool m_didRecordDrawCommandsInCurrentFrame; | 73 bool m_didRecordDrawCommandsInCurrentFrame; |
75 bool m_currentFrameHasExpensiveOp; | 74 bool m_currentFrameHasExpensiveOp; |
76 bool m_previousFrameHasExpensiveOp; | 75 bool m_previousFrameHasExpensiveOp; |
77 OwnPtr<RecordingImageBufferFallbackSurfaceFactory> m_fallbackFactory; | 76 OwnPtr<RecordingImageBufferFallbackSurfaceFactory> m_fallbackFactory; |
78 }; | 77 }; |
79 | 78 |
80 } // namespace blink | 79 } // namespace blink |
81 | 80 |
82 #endif | 81 #endif |
OLD | NEW |