| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 | 5 |
| 6 #ifndef SkPictureCanvasLayerTextureUpdater_h | 6 #ifndef SkPictureCanvasLayerTextureUpdater_h |
| 7 #define SkPictureCanvasLayerTextureUpdater_h | 7 #define SkPictureCanvasLayerTextureUpdater_h |
| 8 | 8 |
| 9 #include "CanvasLayerTextureUpdater.h" | 9 #include "CanvasLayerTextureUpdater.h" |
| 10 #include "SkPicture.h" | 10 #include "SkPicture.h" |
| 11 | 11 |
| 12 class SkCanvas; | 12 class SkCanvas; |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 | 15 |
| 16 class LayerPainterChromium; | 16 class LayerPainterChromium; |
| 17 | 17 |
| 18 // This class records the contentRect into an SkPicture. Subclasses, provide | 18 // This class records the contentRect into an SkPicture. Subclasses, provide |
| 19 // different implementations of tile updating based on this recorded picture. | 19 // different implementations of tile updating based on this recorded picture. |
| 20 // The BitmapSkPictureCanvasLayerTextureUpdater and | 20 // The BitmapSkPictureCanvasLayerTextureUpdater and |
| 21 // FrameBufferSkPictureCanvasLayerTextureUpdater are two examples of such | 21 // FrameBufferSkPictureCanvasLayerTextureUpdater are two examples of such |
| 22 // implementations. | 22 // implementations. |
| 23 class SkPictureCanvasLayerTextureUpdater : public CanvasLayerTextureUpdater { | 23 class SkPictureCanvasLayerTextureUpdater : public CanvasLayerTextureUpdater { |
| 24 public: | 24 public: |
| 25 virtual ~SkPictureCanvasLayerTextureUpdater(); | |
| 26 | |
| 27 virtual void setOpaque(bool) OVERRIDE; | 25 virtual void setOpaque(bool) OVERRIDE; |
| 28 | 26 |
| 29 protected: | 27 protected: |
| 30 explicit SkPictureCanvasLayerTextureUpdater(scoped_ptr<LayerPainterChromium>
); | 28 explicit SkPictureCanvasLayerTextureUpdater(scoped_ptr<LayerPainterChromium>
); |
| 29 virtual ~SkPictureCanvasLayerTextureUpdater(); |
| 31 | 30 |
| 32 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tile
Size, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpa
queRect, CCRenderingStats&) OVERRIDE; | 31 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tile
Size, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpa
queRect, CCRenderingStats&) OVERRIDE; |
| 33 void drawPicture(SkCanvas*); | 32 void drawPicture(SkCanvas*); |
| 34 void updateTexture(CCTextureUpdateQueue& queue, CCPrioritizedTexture* textur
e, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate); | 33 void updateTexture(CCTextureUpdateQueue& queue, CCPrioritizedTexture* textur
e, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate); |
| 35 | 34 |
| 36 bool layerIsOpaque() const { return m_layerIsOpaque; } | 35 bool layerIsOpaque() const { return m_layerIsOpaque; } |
| 37 | 36 |
| 38 private: | 37 private: |
| 39 // Recording canvas. | 38 // Recording canvas. |
| 40 SkPicture m_picture; | 39 SkPicture m_picture; |
| 41 // True when it is known that all output pixels will be opaque. | 40 // True when it is known that all output pixels will be opaque. |
| 42 bool m_layerIsOpaque; | 41 bool m_layerIsOpaque; |
| 43 }; | 42 }; |
| 44 | 43 |
| 45 } // namespace cc | 44 } // namespace cc |
| 46 #endif // SkPictureCanvasLayerTextureUpdater_h | 45 #endif // SkPictureCanvasLayerTextureUpdater_h |
| OLD | NEW |