| 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_QUADS_RENDER_PASS_H_ | 5 #ifndef CC_QUADS_RENDER_PASS_H_ |
| 6 #define CC_QUADS_RENDER_PASS_H_ | 6 #define CC_QUADS_RENDER_PASS_H_ |
| 7 | 7 |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 } | 55 } |
| 56 bool operator!=(const Id& other) const { | 56 bool operator!=(const Id& other) const { |
| 57 return !(*this == other); | 57 return !(*this == other); |
| 58 } | 58 } |
| 59 bool operator<(const Id& other) const { | 59 bool operator<(const Id& other) const { |
| 60 return layer_id < other.layer_id || | 60 return layer_id < other.layer_id || |
| 61 (layer_id == other.layer_id && index < other.index); | 61 (layer_id == other.layer_id && index < other.index); |
| 62 } | 62 } |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 // Specifies whether the pass is going into an overlay, needs to be rendered |
| 66 // into a buffer before it can be presented to overlay hardware or a quad |
| 67 // inside it is presented as is. |
| 68 enum OverlayState { NO_OVERLAY, RENDER_AND_OVERLAY, SIMPLE_OVERLAY, }; |
| 69 |
| 65 ~RenderPass(); | 70 ~RenderPass(); |
| 66 | 71 |
| 67 static scoped_ptr<RenderPass> Create(); | 72 static scoped_ptr<RenderPass> Create(); |
| 68 static scoped_ptr<RenderPass> Create(size_t num_layers); | 73 static scoped_ptr<RenderPass> Create(size_t num_layers); |
| 69 | 74 |
| 70 // A shallow copy of the render pass, which does not include its quads or copy | 75 // A shallow copy of the render pass, which does not include its quads or copy |
| 71 // requests. | 76 // requests. |
| 72 scoped_ptr<RenderPass> Copy(Id new_id) const; | 77 scoped_ptr<RenderPass> Copy(Id new_id) const; |
| 73 | 78 |
| 74 // A deep copy of the render passes in the list including the quads. | 79 // A deep copy of the render passes in the list including the quads. |
| 75 static void CopyAll(const ScopedPtrVector<RenderPass>& in, | 80 static void CopyAll(const ScopedPtrVector<RenderPass>& in, |
| 76 ScopedPtrVector<RenderPass>* out); | 81 ScopedPtrVector<RenderPass>* out); |
| 77 | 82 |
| 78 void SetNew(Id id, | 83 void SetNew(Id id, |
| 79 const gfx::Rect& output_rect, | 84 const gfx::Rect& output_rect, |
| 80 const gfx::RectF& damage_rect, | 85 const gfx::RectF& damage_rect, |
| 81 const gfx::Transform& transform_to_root_target); | 86 const gfx::Transform& transform_to_root_target); |
| 82 | 87 |
| 83 void SetAll(Id id, | 88 void SetAll(Id id, |
| 84 const gfx::Rect& output_rect, | 89 const gfx::Rect& output_rect, |
| 85 const gfx::RectF& damage_rect, | 90 const gfx::RectF& damage_rect, |
| 86 const gfx::Transform& transform_to_root_target, | 91 const gfx::Transform& transform_to_root_target, |
| 87 bool has_transparent_background); | 92 bool has_transparent_background, |
| 93 OverlayState overlay_state); |
| 88 | 94 |
| 89 scoped_ptr<base::Value> AsValue() const; | 95 scoped_ptr<base::Value> AsValue() const; |
| 90 | 96 |
| 91 // Uniquely identifies the render pass in the compositor's current frame. | 97 // Uniquely identifies the render pass in the compositor's current frame. |
| 92 Id id; | 98 Id id; |
| 93 | 99 |
| 94 // These are in the space of the render pass' physical pixels. | 100 // These are in the space of the render pass' physical pixels. |
| 95 gfx::Rect output_rect; | 101 gfx::Rect output_rect; |
| 96 gfx::RectF damage_rect; | 102 gfx::RectF damage_rect; |
| 97 | 103 |
| 98 // Transforms from the origin of the |output_rect| to the origin of the root | 104 // Transforms from the origin of the |output_rect| to the origin of the root |
| 99 // render pass' |output_rect|. | 105 // render pass' |output_rect|. |
| 100 gfx::Transform transform_to_root_target; | 106 gfx::Transform transform_to_root_target; |
| 101 | 107 |
| 102 // If false, the pixels in the render pass' texture are all opaque. | 108 // If false, the pixels in the render pass' texture are all opaque. |
| 103 bool has_transparent_background; | 109 bool has_transparent_background; |
| 104 | 110 |
| 105 // If non-empty, the renderer should produce a copy of the render pass' | 111 // If non-empty, the renderer should produce a copy of the render pass' |
| 106 // contents as a bitmap, and give a copy of the bitmap to each callback in | 112 // contents as a bitmap, and give a copy of the bitmap to each callback in |
| 107 // this list. This property should not be serialized between compositors, as | 113 // this list. This property should not be serialized between compositors, as |
| 108 // it only makes sense in the root compositor. | 114 // it only makes sense in the root compositor. |
| 109 ScopedPtrVector<CopyOutputRequest> copy_requests; | 115 ScopedPtrVector<CopyOutputRequest> copy_requests; |
| 110 | 116 |
| 111 QuadList quad_list; | 117 QuadList quad_list; |
| 112 SharedQuadStateList shared_quad_state_list; | 118 SharedQuadStateList shared_quad_state_list; |
| 113 | 119 |
| 120 OverlayState overlay_state; |
| 121 |
| 114 protected: | 122 protected: |
| 115 explicit RenderPass(size_t num_layers); | 123 explicit RenderPass(size_t num_layers); |
| 116 RenderPass(); | 124 RenderPass(); |
| 117 | 125 |
| 118 private: | 126 private: |
| 119 DISALLOW_COPY_AND_ASSIGN(RenderPass); | 127 DISALLOW_COPY_AND_ASSIGN(RenderPass); |
| 120 }; | 128 }; |
| 121 | 129 |
| 122 } // namespace cc | 130 } // namespace cc |
| 123 | 131 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 137 #error define a hash function for your compiler | 145 #error define a hash function for your compiler |
| 138 #endif // COMPILER | 146 #endif // COMPILER |
| 139 } // namespace BASE_HASH_NAMESPACE | 147 } // namespace BASE_HASH_NAMESPACE |
| 140 | 148 |
| 141 namespace cc { | 149 namespace cc { |
| 142 typedef ScopedPtrVector<RenderPass> RenderPassList; | 150 typedef ScopedPtrVector<RenderPass> RenderPassList; |
| 143 typedef base::hash_map<RenderPass::Id, RenderPass*> RenderPassIdHashMap; | 151 typedef base::hash_map<RenderPass::Id, RenderPass*> RenderPassIdHashMap; |
| 144 } // namespace cc | 152 } // namespace cc |
| 145 | 153 |
| 146 #endif // CC_QUADS_RENDER_PASS_H_ | 154 #endif // CC_QUADS_RENDER_PASS_H_ |
| OLD | NEW |