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_LAYER_UPDATER_H_ | 5 #ifndef CC_LAYER_UPDATER_H_ |
6 #define CC_LAYER_UPDATER_H_ | 6 #define CC_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 "cc/cc_export.h" | 10 #include "cc/cc_export.h" |
10 #include "cc/prioritized_resource.h" | 11 #include "ui/gfx/rect.h" |
danakj
2013/01/07 14:48:03
not sure why this can't be forward declared here s
| |
11 #include "third_party/khronos/GLES2/gl2.h" | |
12 | 12 |
13 namespace gfx { | 13 namespace gfx { |
14 class Rect; | |
15 class Vector2d; | 14 class Vector2d; |
16 } | 15 } |
17 | 16 |
18 namespace cc { | 17 namespace cc { |
19 | 18 |
19 class PrioritizedResource; | |
20 class PrioritizedResourceManager; | |
21 class ResourceUpdateQueue; | |
20 class TextureManager; | 22 class TextureManager; |
21 struct RenderingStats; | 23 struct RenderingStats; |
22 class ResourceUpdateQueue; | |
23 | 24 |
24 class CC_EXPORT LayerUpdater : public base::RefCounted<LayerUpdater> { | 25 class CC_EXPORT LayerUpdater : public base::RefCounted<LayerUpdater> { |
25 public: | 26 public: |
26 // Allows updaters to store per-resource update properties. | 27 // Allows updaters to store per-resource update properties. |
27 class CC_EXPORT Resource { | 28 class CC_EXPORT Resource { |
28 public: | 29 public: |
29 virtual ~Resource(); | 30 virtual ~Resource(); |
30 | 31 |
31 PrioritizedResource* texture() { return m_texture.get(); } | 32 PrioritizedResource* texture() { return m_texture.get(); } |
32 void swapTextureWith(scoped_ptr<PrioritizedResource>& texture) { m_textu re.swap(texture); } | 33 void swapTextureWith(scoped_ptr<PrioritizedResource>& texture); |
33 // TODO(reveman): partialUpdate should be a property of this class | 34 // TODO(reveman): partialUpdate should be a property of this class |
34 // instead of an argument passed to update(). | 35 // instead of an argument passed to update(). |
35 virtual void update(ResourceUpdateQueue&, const gfx::Rect& sourceRect, c onst gfx::Vector2d& destOffset, bool partialUpdate, RenderingStats&) = 0; | 36 virtual void update(ResourceUpdateQueue&, const gfx::Rect& sourceRect, c onst gfx::Vector2d& destOffset, bool partialUpdate, RenderingStats&) = 0; |
36 protected: | 37 protected: |
37 explicit Resource(scoped_ptr<PrioritizedResource> texture); | 38 explicit Resource(scoped_ptr<PrioritizedResource> texture); |
38 | 39 |
39 private: | 40 private: |
40 scoped_ptr<PrioritizedResource> m_texture; | 41 scoped_ptr<PrioritizedResource> m_texture; |
42 | |
43 DISALLOW_COPY_AND_ASSIGN(Resource); | |
41 }; | 44 }; |
42 | 45 |
43 LayerUpdater() { } | 46 LayerUpdater() { } |
44 | 47 |
45 virtual scoped_ptr<Resource> createResource(PrioritizedResourceManager*) = 0 ; | 48 virtual scoped_ptr<Resource> createResource(PrioritizedResourceManager*) = 0 ; |
46 // The |resultingOpaqueRect| gives back a region of the layer that was paint ed opaque. If the layer is marked opaque in the updater, | 49 // The |resultingOpaqueRect| gives back a region of the layer that was paint ed opaque. If the layer is marked opaque in the updater, |
47 // then this region should be ignored in preference for the entire layer's a rea. | 50 // then this region should be ignored in preference for the entire layer's a rea. |
48 virtual void prepareToUpdate(const gfx::Rect& contentRect, const gfx::Size& tileSize, float contentsWidthScale, float contentsHeightScale, gfx::Rect& result ingOpaqueRect, RenderingStats&) { } | 51 virtual void prepareToUpdate(const gfx::Rect& contentRect, const gfx::Size& tileSize, float contentsWidthScale, float contentsHeightScale, gfx::Rect& result ingOpaqueRect, RenderingStats&) { } |
49 | 52 |
50 // Set true by the layer when it is known that the entire output is going to be opaque. | 53 // Set true by the layer when it is known that the entire output is going to be opaque. |
51 virtual void setOpaque(bool) { } | 54 virtual void setOpaque(bool) { } |
52 | 55 |
53 protected: | 56 protected: |
54 virtual ~LayerUpdater() { } | 57 virtual ~LayerUpdater() { } |
55 | 58 |
56 private: | 59 private: |
57 friend class base::RefCounted<LayerUpdater>; | 60 friend class base::RefCounted<LayerUpdater>; |
58 }; | 61 }; |
59 | 62 |
60 } // namespace cc | 63 } // namespace cc |
61 | 64 |
62 #endif // CC_LAYER_UPDATER_H_ | 65 #endif // CC_LAYER_UPDATER_H_ |
OLD | NEW |