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