| 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 "cc/cc_export.h" | 8 #include "cc/cc_export.h" |
| 9 #include "cc/layer_impl.h" | 9 #include "cc/layer_impl.h" |
| 10 #include "cc/scoped_ptr_vector.h" | 10 #include "cc/scoped_ptr_vector.h" |
| 11 | 11 |
| 12 namespace cc { | 12 namespace cc { |
| 13 | 13 |
| 14 class CC_EXPORT DelegatedRendererLayerImpl : public LayerImpl { | 14 class CC_EXPORT DelegatedRendererLayerImpl : public LayerImpl { |
| 15 public: | 15 public: |
| 16 static scoped_ptr<DelegatedRendererLayerImpl> create(LayerTreeImpl* treeImpl
, int id) { return make_scoped_ptr(new DelegatedRendererLayerImpl(treeImpl, id))
; } | 16 static scoped_ptr<DelegatedRendererLayerImpl> Create( |
| 17 virtual ~DelegatedRendererLayerImpl(); | 17 LayerTreeImpl* tree_impl, int id) { |
| 18 return make_scoped_ptr(new DelegatedRendererLayerImpl(tree_impl, id)); |
| 19 } |
| 20 virtual ~DelegatedRendererLayerImpl(); |
| 18 | 21 |
| 19 virtual bool hasDelegatedContent() const OVERRIDE; | 22 // LayerImpl overrides. |
| 20 virtual bool hasContributingDelegatedRenderPasses() const OVERRIDE; | 23 virtual bool hasDelegatedContent() const OVERRIDE; |
| 24 virtual bool hasContributingDelegatedRenderPasses() const OVERRIDE; |
| 25 virtual RenderPass::Id firstContributingRenderPassId() const OVERRIDE; |
| 26 virtual RenderPass::Id nextContributingRenderPassId( |
| 27 RenderPass::Id previous) const OVERRIDE; |
| 28 virtual void didLoseOutputSurface() OVERRIDE; |
| 29 virtual void appendQuads( |
| 30 QuadSink& quad_sink, AppendQuadsData& append_quads_data) OVERRIDE; |
| 21 | 31 |
| 22 // This gives ownership of the RenderPasses to the layer. | 32 // This gives ownership of the RenderPasses to the layer. |
| 23 void setRenderPasses(ScopedPtrVector<RenderPass>&); | 33 void SetRenderPasses(ScopedPtrVector<RenderPass>&); |
| 24 void clearRenderPasses(); | 34 void ClearRenderPasses(); |
| 25 | 35 |
| 26 // Set the size at which the frame should be displayed, with the origin at t
he layer's origin. | 36 // Set the size at which the frame should be displayed, with the origin at the |
| 27 // This must always contain at least the layer's bounds. A value of (0, 0) i
mplies that the | 37 // layer's origin. This must always contain at least the layer's bounds. A |
| 28 // frame should be displayed to fit exactly in the layer's bounds. | 38 // value of (0, 0) implies that the frame should be displayed to fit exactly |
| 29 void setDisplaySize(gfx::Size displaySize) { m_displaySize = displaySize; } | 39 // in the layer's bounds. |
| 40 void set_display_size(gfx::Size size) { display_size_ = size; } |
| 30 | 41 |
| 31 virtual void didLoseOutputSurface() OVERRIDE; | 42 void AppendContributingRenderPasses(RenderPassSink* render_pass_sink); |
| 32 | 43 |
| 33 virtual RenderPass::Id firstContributingRenderPassId() const OVERRIDE; | 44 private: |
| 34 virtual RenderPass::Id nextContributingRenderPassId(RenderPass::Id) const OV
ERRIDE; | 45 DelegatedRendererLayerImpl(LayerTreeImpl* tree_impl, int id); |
| 35 | 46 |
| 36 void appendContributingRenderPasses(RenderPassSink&); | 47 RenderPass::Id ConvertDelegatedRenderPassId( |
| 37 virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE; | 48 RenderPass::Id delegated_render_pass_id) const; |
| 38 | 49 |
| 39 private: | 50 void AppendRenderPassQuads( |
| 40 DelegatedRendererLayerImpl(LayerTreeImpl* treeImpl, int id); | 51 QuadSink* quad_sink, |
| 52 AppendQuadsData* append_quads_data, |
| 53 const RenderPass* delegated_render_pass, |
| 54 gfx::Size frame_size) const; |
| 41 | 55 |
| 42 RenderPass::Id convertDelegatedRenderPassId(RenderPass::Id delegatedRenderPa
ssId) const; | 56 // LayerImpl overrides. |
| 57 virtual const char* layerTypeAsString() const OVERRIDE; |
| 43 | 58 |
| 44 void appendRenderPassQuads(QuadSink&, AppendQuadsData&, const RenderPass* fr
omDelegatedRenderPass, gfx::Size frameSize) const; | 59 ScopedPtrVector<RenderPass> render_passes_in_draw_order_; |
| 45 | 60 base::hash_map<RenderPass::Id, int> render_passes_index_by_id_; |
| 46 virtual const char* layerTypeAsString() const OVERRIDE; | 61 gfx::Size display_size_; |
| 47 | |
| 48 ScopedPtrVector<RenderPass> m_renderPassesInDrawOrder; | |
| 49 base::hash_map<RenderPass::Id, int> m_renderPassesIndexById; | |
| 50 gfx::Size m_displaySize; | |
| 51 }; | 62 }; |
| 52 | 63 |
| 53 } | 64 } |
| 54 | 65 |
| 55 #endif // CC_DELEGATED_RENDERER_LAYER_IMPL_H_ | 66 #endif // CC_DELEGATED_RENDERER_LAYER_IMPL_H_ |
| OLD | NEW |