| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 PassRefPtr<SkImage> newImageSnapshot() const override; | 47 PassRefPtr<SkImage> newImageSnapshot() const 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& bitmap() override; | 53 const SkBitmap& bitmap() override; |
| 54 bool restore() override; | 54 bool restore() override; |
| 55 WebLayer* layer() const override; | 55 WebLayer* layer() const override; |
| 56 bool isAccelerated() const override; | 56 bool isAccelerated() const override; |
| 57 bool cachedBitmapEnabled() const override; | |
| 58 const SkBitmap& cachedBitmap() const override; | |
| 59 void invalidateCachedBitmap() override; | |
| 60 void updateCachedBitmapIfNeeded() override; | |
| 61 void setIsHidden(bool) override; | 57 void setIsHidden(bool) override; |
| 62 | 58 |
| 63 private: | 59 private: |
| 64 friend class RecordingImageBufferSurfaceTest; // for unit testing | 60 friend class RecordingImageBufferSurfaceTest; // for unit testing |
| 65 void fallBackToRasterCanvas(); | 61 void fallBackToRasterCanvas(); |
| 66 bool initializeCurrentFrame(); | 62 bool initializeCurrentFrame(); |
| 67 bool finalizeFrameInternal(); | 63 bool finalizeFrameInternal(); |
| 68 int approximateOpCount(); | 64 int approximateOpCount(); |
| 69 | 65 |
| 70 OwnPtr<SkPictureRecorder> m_currentFrame; | 66 OwnPtr<SkPictureRecorder> m_currentFrame; |
| 71 RefPtr<SkPicture> m_previousFrame; | 67 RefPtr<SkPicture> m_previousFrame; |
| 72 OwnPtr<ImageBufferSurface> m_fallbackSurface; | 68 OwnPtr<ImageBufferSurface> m_fallbackSurface; |
| 73 ImageBuffer* m_imageBuffer; | 69 ImageBuffer* m_imageBuffer; |
| 74 int m_initialSaveCount; | 70 int m_initialSaveCount; |
| 75 int m_currentFramePixelCount; | 71 int m_currentFramePixelCount; |
| 76 int m_previousFramePixelCount; | 72 int m_previousFramePixelCount; |
| 77 bool m_frameWasCleared; | 73 bool m_frameWasCleared; |
| 78 bool m_didRecordDrawCommandsInCurrentFrame; | 74 bool m_didRecordDrawCommandsInCurrentFrame; |
| 79 bool m_currentFrameHasExpensiveOp; | 75 bool m_currentFrameHasExpensiveOp; |
| 80 bool m_previousFrameHasExpensiveOp; | 76 bool m_previousFrameHasExpensiveOp; |
| 81 OwnPtr<RecordingImageBufferFallbackSurfaceFactory> m_fallbackFactory; | 77 OwnPtr<RecordingImageBufferFallbackSurfaceFactory> m_fallbackFactory; |
| 82 }; | 78 }; |
| 83 | 79 |
| 84 } // namespace blink | 80 } // namespace blink |
| 85 | 81 |
| 86 #endif | 82 #endif |
| OLD | NEW |