| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_DELEGATED_RENDERER_LAYER_IMPL_H_ | 5 #ifndef CC_DELEGATED_RENDERER_LAYER_IMPL_H_ |
| 6 #define CC_DELEGATED_RENDERER_LAYER_IMPL_H_ | 6 #define CC_DELEGATED_RENDERER_LAYER_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "cc/cc_export.h" | 9 #include "cc/cc_export.h" |
| 10 #include "cc/layer_impl.h" | 10 #include "cc/layer_impl.h" |
| 11 #include "cc/scoped_ptr_vector.h" | 11 #include "cc/scoped_ptr_vector.h" |
| 12 | 12 |
| 13 namespace cc { | 13 namespace cc { |
| 14 class DelegatedFrameData; |
| 14 | 15 |
| 15 class CC_EXPORT DelegatedRendererLayerImpl : public LayerImpl { | 16 class CC_EXPORT DelegatedRendererLayerImpl : public LayerImpl { |
| 16 public: | 17 public: |
| 17 static scoped_ptr<DelegatedRendererLayerImpl> Create( | 18 static scoped_ptr<DelegatedRendererLayerImpl> Create( |
| 18 LayerTreeImpl* tree_impl, int id) { | 19 LayerTreeImpl* tree_impl, int id) { |
| 19 return make_scoped_ptr(new DelegatedRendererLayerImpl(tree_impl, id)); | 20 return make_scoped_ptr(new DelegatedRendererLayerImpl(tree_impl, id)); |
| 20 } | 21 } |
| 21 virtual ~DelegatedRendererLayerImpl(); | 22 virtual ~DelegatedRendererLayerImpl(); |
| 22 | 23 |
| 23 // LayerImpl overrides. | 24 // LayerImpl overrides. |
| 24 virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl*) OVERRIDE; | 25 virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl*) OVERRIDE; |
| 25 virtual bool hasDelegatedContent() const OVERRIDE; | 26 virtual bool hasDelegatedContent() const OVERRIDE; |
| 26 virtual bool hasContributingDelegatedRenderPasses() const OVERRIDE; | 27 virtual bool hasContributingDelegatedRenderPasses() const OVERRIDE; |
| 27 virtual RenderPass::Id firstContributingRenderPassId() const OVERRIDE; | 28 virtual RenderPass::Id firstContributingRenderPassId() const OVERRIDE; |
| 28 virtual RenderPass::Id nextContributingRenderPassId( | 29 virtual RenderPass::Id nextContributingRenderPassId( |
| 29 RenderPass::Id previous) const OVERRIDE; | 30 RenderPass::Id previous) const OVERRIDE; |
| 30 virtual void didLoseOutputSurface() OVERRIDE; | 31 virtual void didLoseOutputSurface() OVERRIDE; |
| 31 virtual void appendQuads( | 32 virtual void appendQuads( |
| 32 QuadSink& quad_sink, AppendQuadsData& append_quads_data) OVERRIDE; | 33 QuadSink& quad_sink, AppendQuadsData& append_quads_data) OVERRIDE; |
| 33 | 34 |
| 35 // TODO(danakj): Make private |
| 34 // This gives ownership of the RenderPasses to the layer. | 36 // This gives ownership of the RenderPasses to the layer. |
| 35 void SetRenderPasses(ScopedPtrVector<RenderPass>&); | 37 void SetRenderPasses(ScopedPtrVector<RenderPass>&); |
| 36 void ClearRenderPasses(); | 38 void ClearRenderPasses(); |
| 37 | 39 |
| 38 // Set the size at which the frame should be displayed, with the origin at the | |
| 39 // layer's origin. This must always contain at least the layer's bounds. A | |
| 40 // value of (0, 0) implies that the frame should be displayed to fit exactly | |
| 41 // in the layer's bounds. | |
| 42 void set_display_size(gfx::Size size) { display_size_ = size; } | |
| 43 | |
| 44 void AppendContributingRenderPasses(RenderPassSink* render_pass_sink); | 40 void AppendContributingRenderPasses(RenderPassSink* render_pass_sink); |
| 45 | 41 |
| 46 // Creates an ID with the resource provider for the child renderer | 42 void SetFrameData(scoped_ptr<DelegatedFrameData> frame_data, |
| 47 // that will be sending quads to the layer. | 43 gfx::RectF damage_in_frame); |
| 48 void CreateChildIdIfNeeded(); | 44 |
| 45 void SetDisplaySize(gfx::Size size); |
| 46 |
| 49 int child_id() const { return child_id_; } | 47 int child_id() const { return child_id_; } |
| 50 | 48 |
| 51 private: | 49 private: |
| 52 DelegatedRendererLayerImpl(LayerTreeImpl* tree_impl, int id); | 50 DelegatedRendererLayerImpl(LayerTreeImpl* tree_impl, int id); |
| 53 | 51 |
| 52 // Creates an ID with the resource provider for the child renderer |
| 53 // that will be sending quads to the layer. |
| 54 void CreateChildIdIfNeeded(); |
| 54 void ClearChildId(); | 55 void ClearChildId(); |
| 55 | 56 |
| 56 RenderPass::Id ConvertDelegatedRenderPassId( | 57 RenderPass::Id ConvertDelegatedRenderPassId( |
| 57 RenderPass::Id delegated_render_pass_id) const; | 58 RenderPass::Id delegated_render_pass_id) const; |
| 58 | 59 |
| 60 gfx::Transform DelegatedFrameToLayerSpaceTransform(gfx::Size frame_size) |
| 61 const; |
| 62 |
| 59 void AppendRenderPassQuads( | 63 void AppendRenderPassQuads( |
| 60 QuadSink* quad_sink, | 64 QuadSink* quad_sink, |
| 61 AppendQuadsData* append_quads_data, | 65 AppendQuadsData* append_quads_data, |
| 62 const RenderPass* delegated_render_pass, | 66 const RenderPass* delegated_render_pass, |
| 63 gfx::Size frame_size) const; | 67 gfx::Size frame_size) const; |
| 64 | 68 |
| 65 // LayerImpl overrides. | 69 // LayerImpl overrides. |
| 66 virtual const char* layerTypeAsString() const OVERRIDE; | 70 virtual const char* layerTypeAsString() const OVERRIDE; |
| 67 | 71 |
| 68 ScopedPtrVector<RenderPass> render_passes_in_draw_order_; | 72 ScopedPtrVector<RenderPass> render_passes_in_draw_order_; |
| 69 base::hash_map<RenderPass::Id, int> render_passes_index_by_id_; | 73 base::hash_map<RenderPass::Id, int> render_passes_index_by_id_; |
| 74 |
| 70 gfx::Size display_size_; | 75 gfx::Size display_size_; |
| 71 int child_id_; | 76 int child_id_; |
| 72 }; | 77 }; |
| 73 | 78 |
| 74 } | 79 } |
| 75 | 80 |
| 76 #endif // CC_DELEGATED_RENDERER_LAYER_IMPL_H_ | 81 #endif // CC_DELEGATED_RENDERER_LAYER_IMPL_H_ |
| OLD | NEW |