| 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 #ifndef CC_RESOURCES_LAYER_UPDATER_H_ | 5 #ifndef CC_RESOURCES_LAYER_UPDATER_H_ |
| 6 #define CC_RESOURCES_LAYER_UPDATER_H_ | 6 #define CC_RESOURCES_LAYER_UPDATER_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "cc/base/cc_export.h" | 10 #include "cc/base/cc_export.h" |
| 11 #include "ui/gfx/rect.h" | 11 #include "ui/gfx/rect.h" |
| 12 #include "ui/gfx/vector2d.h" | 12 #include "ui/gfx/vector2d.h" |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 | 15 |
| 16 class PrioritizedResource; | 16 class PrioritizedResource; |
| 17 class PrioritizedResourceManager; | 17 class PrioritizedResourceManager; |
| 18 class ResourceUpdateQueue; | 18 class ResourceUpdateQueue; |
| 19 class TextureManager; | 19 class TextureManager; |
| 20 struct RenderingStats; | |
| 21 | 20 |
| 22 class CC_EXPORT LayerUpdater : public base::RefCounted<LayerUpdater> { | 21 class CC_EXPORT LayerUpdater : public base::RefCounted<LayerUpdater> { |
| 23 public: | 22 public: |
| 24 // Allows updaters to store per-resource update properties. | 23 // Allows updaters to store per-resource update properties. |
| 25 class CC_EXPORT Resource { | 24 class CC_EXPORT Resource { |
| 26 public: | 25 public: |
| 27 virtual ~Resource(); | 26 virtual ~Resource(); |
| 28 | 27 |
| 29 PrioritizedResource* texture() { return texture_.get(); } | 28 PrioritizedResource* texture() { return texture_.get(); } |
| 30 // TODO(reveman): partial_update should be a property of this class | 29 // TODO(reveman): partial_update should be a property of this class |
| 31 // instead of an argument passed to Update(). | 30 // instead of an argument passed to Update(). |
| 32 virtual void Update(ResourceUpdateQueue* queue, | 31 virtual void Update(ResourceUpdateQueue* queue, |
| 33 gfx::Rect source_rect, | 32 gfx::Rect source_rect, |
| 34 gfx::Vector2d dest_offset, | 33 gfx::Vector2d dest_offset, |
| 35 bool partial_update, | 34 bool partial_update) = 0; |
| 36 RenderingStats* stats) = 0; | |
| 37 protected: | 35 protected: |
| 38 explicit Resource(scoped_ptr<PrioritizedResource> texture); | 36 explicit Resource(scoped_ptr<PrioritizedResource> texture); |
| 39 | 37 |
| 40 private: | 38 private: |
| 41 scoped_ptr<PrioritizedResource> texture_; | 39 scoped_ptr<PrioritizedResource> texture_; |
| 42 | 40 |
| 43 DISALLOW_COPY_AND_ASSIGN(Resource); | 41 DISALLOW_COPY_AND_ASSIGN(Resource); |
| 44 }; | 42 }; |
| 45 | 43 |
| 46 LayerUpdater() {} | 44 LayerUpdater() {} |
| 47 | 45 |
| 48 virtual scoped_ptr<Resource> CreateResource( | 46 virtual scoped_ptr<Resource> CreateResource( |
| 49 PrioritizedResourceManager* manager) = 0; | 47 PrioritizedResourceManager* manager) = 0; |
| 50 // The |resulting_opaque_rect| gives back a region of the layer that was | 48 // The |resulting_opaque_rect| gives back a region of the layer that was |
| 51 // painted opaque. If the layer is marked opaque in the updater, then this | 49 // painted opaque. If the layer is marked opaque in the updater, then this |
| 52 // region should be ignored in preference for the entire layer's area. | 50 // region should be ignored in preference for the entire layer's area. |
| 53 virtual void PrepareToUpdate(gfx::Rect content_rect, | 51 virtual void PrepareToUpdate(gfx::Rect content_rect, |
| 54 gfx::Size tile_size, | 52 gfx::Size tile_size, |
| 55 float contents_width_scale, | 53 float contents_width_scale, |
| 56 float contents_height_scale, | 54 float contents_height_scale, |
| 57 gfx::Rect* resulting_opaque_rect, | 55 gfx::Rect* resulting_opaque_rect) {} |
| 58 RenderingStats* stats) {} | |
| 59 | 56 |
| 60 // Set true by the layer when it is known that the entire output is going to | 57 // Set true by the layer when it is known that the entire output is going to |
| 61 // be opaque. | 58 // be opaque. |
| 62 virtual void SetOpaque(bool opaque) {} | 59 virtual void SetOpaque(bool opaque) {} |
| 63 | 60 |
| 64 protected: | 61 protected: |
| 65 virtual ~LayerUpdater() {} | 62 virtual ~LayerUpdater() {} |
| 66 | 63 |
| 67 private: | 64 private: |
| 68 friend class base::RefCounted<LayerUpdater>; | 65 friend class base::RefCounted<LayerUpdater>; |
| 69 | 66 |
| 70 DISALLOW_COPY_AND_ASSIGN(LayerUpdater); | 67 DISALLOW_COPY_AND_ASSIGN(LayerUpdater); |
| 71 }; | 68 }; |
| 72 | 69 |
| 73 } // namespace cc | 70 } // namespace cc |
| 74 | 71 |
| 75 #endif // CC_RESOURCES_LAYER_UPDATER_H_ | 72 #endif // CC_RESOURCES_LAYER_UPDATER_H_ |
| OLD | NEW |