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(); | 25 virtual ~SkPictureCanvasLayerTextureUpdater(); |
26 | 26 |
27 virtual void setOpaque(bool) OVERRIDE; | 27 virtual void setOpaque(bool) OVERRIDE; |
28 | 28 |
29 protected: | 29 protected: |
30 explicit SkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>
); | 30 explicit SkPictureCanvasLayerTextureUpdater(scoped_ptr<LayerPainterChromium>
); |
31 | 31 |
32 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tile
Size, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpa
queRect, CCRenderingStats&) OVERRIDE; | 32 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tile
Size, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpa
queRect, CCRenderingStats&) OVERRIDE; |
33 void drawPicture(SkCanvas*); | 33 void drawPicture(SkCanvas*); |
34 void updateTexture(CCTextureUpdateQueue& queue, CCPrioritizedTexture* textur
e, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate); | 34 void updateTexture(CCTextureUpdateQueue& queue, CCPrioritizedTexture* textur
e, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate); |
35 | 35 |
36 bool layerIsOpaque() const { return m_layerIsOpaque; } | 36 bool layerIsOpaque() const { return m_layerIsOpaque; } |
37 | 37 |
38 private: | 38 private: |
39 // Recording canvas. | 39 // Recording canvas. |
40 SkPicture m_picture; | 40 SkPicture m_picture; |
41 // True when it is known that all output pixels will be opaque. | 41 // True when it is known that all output pixels will be opaque. |
42 bool m_layerIsOpaque; | 42 bool m_layerIsOpaque; |
43 }; | 43 }; |
44 | 44 |
45 } // namespace cc | 45 } // namespace cc |
46 #endif // SkPictureCanvasLayerTextureUpdater_h | 46 #endif // SkPictureCanvasLayerTextureUpdater_h |
OLD | NEW |