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 "cc/canvas_layer_texture_updater.h" | 9 #include "cc/canvas_layer_texture_updater.h" |
10 #include "third_party/skia/include/core/SkPicture.h" | 10 #include "third_party/skia/include/core/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 LayerPainter; |
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 void setOpaque(bool) OVERRIDE; | 25 virtual void setOpaque(bool) OVERRIDE; |
26 | 26 |
27 protected: | 27 protected: |
28 explicit SkPictureCanvasLayerTextureUpdater(scoped_ptr<LayerPainterChromium>
); | 28 explicit SkPictureCanvasLayerTextureUpdater(scoped_ptr<LayerPainter>); |
29 virtual ~SkPictureCanvasLayerTextureUpdater(); | 29 virtual ~SkPictureCanvasLayerTextureUpdater(); |
30 | 30 |
31 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, RenderingStats&) OVERRIDE; |
32 void drawPicture(SkCanvas*); | 32 void drawPicture(SkCanvas*); |
33 void updateTexture(CCTextureUpdateQueue& queue, CCPrioritizedTexture* textur
e, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate); | 33 void updateTexture(TextureUpdateQueue& queue, PrioritizedTexture* texture, c
onst IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate); |
34 | 34 |
35 bool layerIsOpaque() const { return m_layerIsOpaque; } | 35 bool layerIsOpaque() const { return m_layerIsOpaque; } |
36 | 36 |
37 private: | 37 private: |
38 // Recording canvas. | 38 // Recording canvas. |
39 SkPicture m_picture; | 39 SkPicture m_picture; |
40 // 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. |
41 bool m_layerIsOpaque; | 41 bool m_layerIsOpaque; |
42 }; | 42 }; |
43 | 43 |
44 } // namespace cc | 44 } // namespace cc |
45 #endif // SkPictureCanvasLayerTextureUpdater_h | 45 #endif // SkPictureCanvasLayerTextureUpdater_h |
OLD | NEW |