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 BitmapCanvasLayerTextureUpdater_h | 6 #ifndef BitmapCanvasLayerTextureUpdater_h |
7 #define BitmapCanvasLayerTextureUpdater_h | 7 #define BitmapCanvasLayerTextureUpdater_h |
8 | 8 |
9 #include "cc/canvas_layer_texture_updater.h" | 9 #include "cc/canvas_layer_texture_updater.h" |
10 | 10 |
11 class SkCanvas; | 11 class SkCanvas; |
12 | 12 |
13 namespace cc { | 13 namespace cc { |
14 | 14 |
15 class LayerPainterChromium; | 15 class LayerPainter; |
16 | 16 |
17 // This class rasterizes the contentRect into a skia bitmap canvas. It then upda
tes | 17 // This class rasterizes the contentRect into a skia bitmap canvas. It then upda
tes |
18 // textures by copying from the canvas into the texture, using MapSubImage if | 18 // textures by copying from the canvas into the texture, using MapSubImage if |
19 // possible. | 19 // possible. |
20 class BitmapCanvasLayerTextureUpdater : public CanvasLayerTextureUpdater { | 20 class BitmapCanvasLayerTextureUpdater : public CanvasLayerTextureUpdater { |
21 public: | 21 public: |
22 class Texture : public LayerTextureUpdater::Texture { | 22 class Texture : public LayerTextureUpdater::Texture { |
23 public: | 23 public: |
24 Texture(BitmapCanvasLayerTextureUpdater*, scoped_ptr<CCPrioritizedTextur
e>); | 24 Texture(BitmapCanvasLayerTextureUpdater*, scoped_ptr<PrioritizedTexture>
); |
25 virtual ~Texture(); | 25 virtual ~Texture(); |
26 | 26 |
27 virtual void update(CCTextureUpdateQueue&, const IntRect& sourceRect, co
nst IntSize& destOffset, bool partialUpdate, CCRenderingStats&) OVERRIDE; | 27 virtual void update(TextureUpdateQueue&, const IntRect& sourceRect, cons
t IntSize& destOffset, bool partialUpdate, RenderingStats&) OVERRIDE; |
28 | 28 |
29 private: | 29 private: |
30 BitmapCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpda
ter; } | 30 BitmapCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpda
ter; } |
31 | 31 |
32 BitmapCanvasLayerTextureUpdater* m_textureUpdater; | 32 BitmapCanvasLayerTextureUpdater* m_textureUpdater; |
33 }; | 33 }; |
34 | 34 |
35 static scoped_refptr<BitmapCanvasLayerTextureUpdater> create(scoped_ptr<Laye
rPainterChromium>); | 35 static scoped_refptr<BitmapCanvasLayerTextureUpdater> create(scoped_ptr<Laye
rPainter>); |
36 | 36 |
37 virtual scoped_ptr<LayerTextureUpdater::Texture> createTexture(CCPrioritized
TextureManager*) OVERRIDE; | 37 virtual scoped_ptr<LayerTextureUpdater::Texture> createTexture(PrioritizedTe
xtureManager*) OVERRIDE; |
38 virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) OVERRI
DE; | 38 virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) OVERRI
DE; |
39 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tile
Size, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpa
queRect, CCRenderingStats&) OVERRIDE; | 39 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tile
Size, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpa
queRect, RenderingStats&) OVERRIDE; |
40 void updateTexture(CCTextureUpdateQueue&, CCPrioritizedTexture*, const IntRe
ct& sourceRect, const IntSize& destOffset, bool partialUpdate); | 40 void updateTexture(TextureUpdateQueue&, PrioritizedTexture*, const IntRect&
sourceRect, const IntSize& destOffset, bool partialUpdate); |
41 | 41 |
42 virtual void setOpaque(bool) OVERRIDE; | 42 virtual void setOpaque(bool) OVERRIDE; |
43 | 43 |
44 protected: | 44 protected: |
45 explicit BitmapCanvasLayerTextureUpdater(scoped_ptr<LayerPainterChromium>); | 45 explicit BitmapCanvasLayerTextureUpdater(scoped_ptr<LayerPainter>); |
46 virtual ~BitmapCanvasLayerTextureUpdater(); | 46 virtual ~BitmapCanvasLayerTextureUpdater(); |
47 | 47 |
48 scoped_ptr<SkCanvas> m_canvas; | 48 scoped_ptr<SkCanvas> m_canvas; |
49 IntSize m_canvasSize; | 49 IntSize m_canvasSize; |
50 bool m_opaque; | 50 bool m_opaque; |
51 }; | 51 }; |
52 | 52 |
53 } // namespace cc | 53 } // namespace cc |
54 | 54 |
55 #endif // BitmapCanvasLayerTextureUpdater_h | 55 #endif // BitmapCanvasLayerTextureUpdater_h |
OLD | NEW |