| 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 BitmapContentLayerUpdater_h | 6 #ifndef BitmapContentLayerUpdater_h |
| 7 #define BitmapContentLayerUpdater_h | 7 #define BitmapContentLayerUpdater_h |
| 8 | 8 |
| 9 #include "cc/content_layer_updater.h" | 9 #include "cc/content_layer_updater.h" |
| 10 | 10 |
| 11 class SkCanvas; | 11 class SkCanvas; |
| 12 | 12 |
| 13 namespace cc { | 13 namespace cc { |
| 14 | 14 |
| 15 class LayerPainter; | 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 BitmapContentLayerUpdater : public ContentLayerUpdater { | 20 class BitmapContentLayerUpdater : public ContentLayerUpdater { |
| 21 public: | 21 public: |
| 22 class Resource : public LayerUpdater::Resource { | 22 class Resource : public LayerUpdater::Resource { |
| 23 public: | 23 public: |
| 24 Resource(BitmapContentLayerUpdater*, scoped_ptr<PrioritizedTexture>); | 24 Resource(BitmapContentLayerUpdater*, scoped_ptr<PrioritizedTexture>); |
| 25 virtual ~Resource(); | 25 virtual ~Resource(); |
| 26 | 26 |
| 27 virtual void update(TextureUpdateQueue&, const IntRect& sourceRect, cons
t IntSize& destOffset, bool partialUpdate, RenderingStats&) OVERRIDE; | 27 virtual void update(ResourceUpdateQueue&, const IntRect& sourceRect, con
st IntSize& destOffset, bool partialUpdate, RenderingStats&) OVERRIDE; |
| 28 | 28 |
| 29 private: | 29 private: |
| 30 BitmapContentLayerUpdater* updater() { return m_updater; } | 30 BitmapContentLayerUpdater* updater() { return m_updater; } |
| 31 | 31 |
| 32 BitmapContentLayerUpdater* m_updater; | 32 BitmapContentLayerUpdater* m_updater; |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 static scoped_refptr<BitmapContentLayerUpdater> create(scoped_ptr<LayerPaint
er>); | 35 static scoped_refptr<BitmapContentLayerUpdater> create(scoped_ptr<LayerPaint
er>); |
| 36 | 36 |
| 37 virtual scoped_ptr<LayerUpdater::Resource> createResource(PrioritizedTexture
Manager*) OVERRIDE; | 37 virtual scoped_ptr<LayerUpdater::Resource> createResource(PrioritizedTexture
Manager*) OVERRIDE; |
| 38 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tile
Size, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpa
queRect, RenderingStats&) OVERRIDE; | 38 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tile
Size, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpa
queRect, RenderingStats&) OVERRIDE; |
| 39 void updateTexture(TextureUpdateQueue&, PrioritizedTexture*, const IntRect&
sourceRect, const IntSize& destOffset, bool partialUpdate); | 39 void updateTexture(ResourceUpdateQueue&, PrioritizedTexture*, const IntRect&
sourceRect, const IntSize& destOffset, bool partialUpdate); |
| 40 | 40 |
| 41 virtual void setOpaque(bool) OVERRIDE; | 41 virtual void setOpaque(bool) OVERRIDE; |
| 42 | 42 |
| 43 protected: | 43 protected: |
| 44 explicit BitmapContentLayerUpdater(scoped_ptr<LayerPainter>); | 44 explicit BitmapContentLayerUpdater(scoped_ptr<LayerPainter>); |
| 45 virtual ~BitmapContentLayerUpdater(); | 45 virtual ~BitmapContentLayerUpdater(); |
| 46 | 46 |
| 47 scoped_ptr<SkCanvas> m_canvas; | 47 scoped_ptr<SkCanvas> m_canvas; |
| 48 IntSize m_canvasSize; | 48 IntSize m_canvasSize; |
| 49 bool m_opaque; | 49 bool m_opaque; |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 } // namespace cc | 52 } // namespace cc |
| 53 | 53 |
| 54 #endif // BitmapContentLayerUpdater_h | 54 #endif // BitmapContentLayerUpdater_h |
| OLD | NEW |