| 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 cc { | 12 namespace cc { |
| 13 | 13 |
| 14 class IntRect; | 14 class IntRect; |
| 15 class IntSize; | 15 class IntSize; |
| 16 class TextureManager; | 16 class TextureManager; |
| 17 struct RenderingStats; | 17 struct RenderingStats; |
| 18 class TextureUpdateQueue; | 18 class ResourceUpdateQueue; |
| 19 | 19 |
| 20 class LayerUpdater : public base::RefCounted<LayerUpdater> { | 20 class LayerUpdater : public base::RefCounted<LayerUpdater> { |
| 21 public: | 21 public: |
| 22 // Allows updaters to store per-resource update properties. | 22 // Allows updaters to store per-resource update properties. |
| 23 class Resource { | 23 class Resource { |
| 24 public: | 24 public: |
| 25 virtual ~Resource(); | 25 virtual ~Resource(); |
| 26 | 26 |
| 27 PrioritizedTexture* texture() { return m_texture.get(); } | 27 PrioritizedTexture* texture() { return m_texture.get(); } |
| 28 void swapTextureWith(scoped_ptr<PrioritizedTexture>& texture) { m_textur
e.swap(texture); } | 28 void swapTextureWith(scoped_ptr<PrioritizedTexture>& texture) { m_textur
e.swap(texture); } |
| 29 // TODO(reveman): partialUpdate should be a property of this class | 29 // TODO(reveman): partialUpdate should be a property of this class |
| 30 // instead of an argument passed to update(). | 30 // instead of an argument passed to update(). |
| 31 virtual void update(TextureUpdateQueue&, const IntRect& sourceRect, cons
t IntSize& destOffset, bool partialUpdate, RenderingStats&) = 0; | 31 virtual void update(ResourceUpdateQueue&, const IntRect& sourceRect, con
st IntSize& destOffset, bool partialUpdate, RenderingStats&) = 0; |
| 32 protected: | 32 protected: |
| 33 explicit Resource(scoped_ptr<PrioritizedTexture> texture); | 33 explicit Resource(scoped_ptr<PrioritizedTexture> texture); |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 scoped_ptr<PrioritizedTexture> m_texture; | 36 scoped_ptr<PrioritizedTexture> m_texture; |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 LayerUpdater() { } | 39 LayerUpdater() { } |
| 40 | 40 |
| 41 virtual scoped_ptr<Resource> createResource(PrioritizedTextureManager*) = 0; | 41 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, | 42 // 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. | 43 // 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&) { } | 44 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tile
Size, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpa
queRect, RenderingStats&) { } |
| 45 | 45 |
| 46 // Set true by the layer when it is known that the entire output is going to
be opaque. | 46 // Set true by the layer when it is known that the entire output is going to
be opaque. |
| 47 virtual void setOpaque(bool) { } | 47 virtual void setOpaque(bool) { } |
| 48 | 48 |
| 49 protected: | 49 protected: |
| 50 virtual ~LayerUpdater() { } | 50 virtual ~LayerUpdater() { } |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 friend class base::RefCounted<LayerUpdater>; | 53 friend class base::RefCounted<LayerUpdater>; |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 } // namespace cc | 56 } // namespace cc |
| 57 | 57 |
| 58 #endif // LayerUpdater_h | 58 #endif // LayerUpdater_h |
| OLD | NEW |