| 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 CC_BITMAP_CONTENT_LAYER_UPDATER_H_ | 6 #ifndef CC_BITMAP_CONTENT_LAYER_UPDATER_H_ |
| 7 #define CC_BITMAP_CONTENT_LAYER_UPDATER_H_ | 7 #define CC_BITMAP_CONTENT_LAYER_UPDATER_H_ |
| 8 | 8 |
| 9 #include "cc/cc_export.h" | 9 #include "cc/cc_export.h" |
| 10 #include "cc/content_layer_updater.h" | 10 #include "cc/content_layer_updater.h" |
| 11 | 11 |
| 12 class SkCanvas; | 12 class SkCanvas; |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 | 15 |
| 16 class LayerPainter; | 16 class LayerPainter; |
| 17 | 17 |
| 18 // This class rasterizes the contentRect into a skia bitmap canvas. It then upda
tes | 18 // This class rasterizes the contentRect into a skia bitmap canvas. It then upda
tes |
| 19 // textures by copying from the canvas into the texture, using MapSubImage if | 19 // textures by copying from the canvas into the texture, using MapSubImage if |
| 20 // possible. | 20 // possible. |
| 21 class CC_EXPORT BitmapContentLayerUpdater : public ContentLayerUpdater { | 21 class CC_EXPORT BitmapContentLayerUpdater : public ContentLayerUpdater { |
| 22 public: | 22 public: |
| 23 class Resource : public LayerUpdater::Resource { | 23 class Resource : public LayerUpdater::Resource { |
| 24 public: | 24 public: |
| 25 Resource(BitmapContentLayerUpdater*, scoped_ptr<PrioritizedResource>); | 25 Resource(BitmapContentLayerUpdater*, scoped_ptr<PrioritizedResource>); |
| 26 virtual ~Resource(); | 26 virtual ~Resource(); |
| 27 | 27 |
| 28 virtual void update(ResourceUpdateQueue&, const gfx::Rect& sourceRect, c
onst gfx::Vector2d& destOffset, bool partialUpdate, RenderingStats&) OVERRIDE; | 28 virtual void update(ResourceUpdateQueue&, const gfx::Rect& sourceRect, c
onst gfx::Vector2d& destOffset, bool partialUpdate, RenderingStats*) OVERRIDE; |
| 29 | 29 |
| 30 private: | 30 private: |
| 31 BitmapContentLayerUpdater* updater() { return m_updater; } | 31 BitmapContentLayerUpdater* updater() { return m_updater; } |
| 32 | 32 |
| 33 BitmapContentLayerUpdater* m_updater; | 33 BitmapContentLayerUpdater* m_updater; |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 static scoped_refptr<BitmapContentLayerUpdater> create(scoped_ptr<LayerPaint
er>); | 36 static scoped_refptr<BitmapContentLayerUpdater> create(scoped_ptr<LayerPaint
er>); |
| 37 | 37 |
| 38 virtual scoped_ptr<LayerUpdater::Resource> createResource(PrioritizedResourc
eManager*) OVERRIDE; | 38 virtual scoped_ptr<LayerUpdater::Resource> createResource(PrioritizedResourc
eManager*) OVERRIDE; |
| 39 virtual void prepareToUpdate(const gfx::Rect& contentRect, const gfx::Size&
tileSize, float contentsWidthScale, float contentsHeightScale, gfx::Rect& result
ingOpaqueRect, RenderingStats&) OVERRIDE; | 39 virtual void prepareToUpdate(const gfx::Rect& contentRect, const gfx::Size&
tileSize, float contentsWidthScale, float contentsHeightScale, gfx::Rect& result
ingOpaqueRect, RenderingStats*) OVERRIDE; |
| 40 void updateTexture(ResourceUpdateQueue&, PrioritizedResource*, const gfx::Re
ct& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate); | 40 void updateTexture(ResourceUpdateQueue&, PrioritizedResource*, const gfx::Re
ct& sourceRect, const gfx::Vector2d& 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 BitmapContentLayerUpdater(scoped_ptr<LayerPainter>); | 45 explicit BitmapContentLayerUpdater(scoped_ptr<LayerPainter>); |
| 46 virtual ~BitmapContentLayerUpdater(); | 46 virtual ~BitmapContentLayerUpdater(); |
| 47 | 47 |
| 48 scoped_ptr<SkCanvas> m_canvas; | 48 scoped_ptr<SkCanvas> m_canvas; |
| 49 gfx::Size m_canvasSize; | 49 gfx::Size m_canvasSize; |
| 50 bool m_opaque; | 50 bool m_opaque; |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 } // namespace cc | 53 } // namespace cc |
| 54 | 54 |
| 55 #endif // CC_BITMAP_CONTENT_LAYER_UPDATER_H_ | 55 #endif // CC_BITMAP_CONTENT_LAYER_UPDATER_H_ |
| OLD | NEW |