Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(368)

Side by Side Diff: cc/quads/render_pass.cc

Issue 197223003: Start of hardware overlay support in CC with Ubercompositor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/quads/render_pass.h ('k') | cc/quads/render_pass_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "cc/quads/render_pass.h" 5 #include "cc/quads/render_pass.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "cc/base/math_util.h" 8 #include "cc/base/math_util.h"
9 #include "cc/debug/traced_value.h" 9 #include "cc/debug/traced_value.h"
10 #include "cc/output/copy_output_request.h" 10 #include "cc/output/copy_output_request.h"
(...skipping 17 matching lines...) Expand all
28 scoped_ptr<RenderPass> RenderPass::Create() { 28 scoped_ptr<RenderPass> RenderPass::Create() {
29 return make_scoped_ptr(new RenderPass()); 29 return make_scoped_ptr(new RenderPass());
30 } 30 }
31 31
32 scoped_ptr<RenderPass> RenderPass::Create(size_t num_layers) { 32 scoped_ptr<RenderPass> RenderPass::Create(size_t num_layers) {
33 return make_scoped_ptr(new RenderPass(num_layers)); 33 return make_scoped_ptr(new RenderPass(num_layers));
34 } 34 }
35 35
36 RenderPass::RenderPass() 36 RenderPass::RenderPass()
37 : id(Id(-1, -1)), 37 : id(Id(-1, -1)),
38 has_transparent_background(true) { 38 has_transparent_background(true),
39 overlay_state(NO_OVERLAY) {
39 shared_quad_state_list.reserve(kDefaultNumSharedQuadStatesToReserve); 40 shared_quad_state_list.reserve(kDefaultNumSharedQuadStatesToReserve);
40 quad_list.reserve(kDefaultNumQuadsToReserve); 41 quad_list.reserve(kDefaultNumQuadsToReserve);
41 } 42 }
42 43
43 RenderPass::RenderPass(size_t num_layers) 44 RenderPass::RenderPass(size_t num_layers)
44 : id(Id(-1, -1)), 45 : id(Id(-1, -1)),
45 has_transparent_background(true) { 46 has_transparent_background(true),
47 overlay_state(NO_OVERLAY) {
46 // Each layer usually produces one shared quad state, so the number of layers 48 // Each layer usually produces one shared quad state, so the number of layers
47 // is a good hint for what to reserve here. 49 // is a good hint for what to reserve here.
48 shared_quad_state_list.reserve(num_layers); 50 shared_quad_state_list.reserve(num_layers);
49 quad_list.reserve(kDefaultNumQuadsToReserve); 51 quad_list.reserve(kDefaultNumQuadsToReserve);
50 } 52 }
51 53
52 RenderPass::~RenderPass() { 54 RenderPass::~RenderPass() {
53 TRACE_EVENT_OBJECT_DELETED_WITH_ID( 55 TRACE_EVENT_OBJECT_DELETED_WITH_ID(
54 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), 56 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"),
55 "cc::RenderPass", id.AsTracingId()); 57 "cc::RenderPass", id.AsTracingId());
56 } 58 }
57 59
58 scoped_ptr<RenderPass> RenderPass::Copy(Id new_id) const { 60 scoped_ptr<RenderPass> RenderPass::Copy(Id new_id) const {
59 scoped_ptr<RenderPass> copy_pass(Create()); 61 scoped_ptr<RenderPass> copy_pass(Create());
60 copy_pass->SetAll(new_id, 62 copy_pass->SetAll(new_id,
61 output_rect, 63 output_rect,
62 damage_rect, 64 damage_rect,
63 transform_to_root_target, 65 transform_to_root_target,
64 has_transparent_background); 66 has_transparent_background,
67 overlay_state);
65 return copy_pass.Pass(); 68 return copy_pass.Pass();
66 } 69 }
67 70
68 // static 71 // static
69 void RenderPass::CopyAll(const ScopedPtrVector<RenderPass>& in, 72 void RenderPass::CopyAll(const ScopedPtrVector<RenderPass>& in,
70 ScopedPtrVector<RenderPass>* out) { 73 ScopedPtrVector<RenderPass>* out) {
71 for (size_t i = 0; i < in.size(); ++i) { 74 for (size_t i = 0; i < in.size(); ++i) {
72 RenderPass* source = in[i]; 75 RenderPass* source = in[i];
73 76
74 // Since we can't copy these, it's wrong to use CopyAll in a situation where 77 // Since we can't copy these, it's wrong to use CopyAll in a situation where
75 // you may have copy_requests present. 78 // you may have copy_requests present.
76 DCHECK_EQ(source->copy_requests.size(), 0u); 79 DCHECK_EQ(source->copy_requests.size(), 0u);
77 80
78 scoped_ptr<RenderPass> copy_pass(Create()); 81 scoped_ptr<RenderPass> copy_pass(Create());
79 copy_pass->SetAll(source->id, 82 copy_pass->SetAll(source->id,
80 source->output_rect, 83 source->output_rect,
81 source->damage_rect, 84 source->damage_rect,
82 source->transform_to_root_target, 85 source->transform_to_root_target,
83 source->has_transparent_background); 86 source->has_transparent_background,
87 source->overlay_state);
84 for (size_t i = 0; i < source->shared_quad_state_list.size(); ++i) { 88 for (size_t i = 0; i < source->shared_quad_state_list.size(); ++i) {
85 copy_pass->shared_quad_state_list.push_back( 89 copy_pass->shared_quad_state_list.push_back(
86 source->shared_quad_state_list[i]->Copy()); 90 source->shared_quad_state_list[i]->Copy());
87 } 91 }
88 for (size_t i = 0, sqs_i = 0; i < source->quad_list.size(); ++i) { 92 for (size_t i = 0, sqs_i = 0; i < source->quad_list.size(); ++i) {
89 while (source->quad_list[i]->shared_quad_state != 93 while (source->quad_list[i]->shared_quad_state !=
90 source->shared_quad_state_list[sqs_i]) { 94 source->shared_quad_state_list[sqs_i]) {
91 ++sqs_i; 95 ++sqs_i;
92 DCHECK_LT(sqs_i, source->shared_quad_state_list.size()); 96 DCHECK_LT(sqs_i, source->shared_quad_state_list.size());
93 } 97 }
(...skipping 30 matching lines...) Expand all
124 this->transform_to_root_target = transform_to_root_target; 128 this->transform_to_root_target = transform_to_root_target;
125 129
126 DCHECK(quad_list.empty()); 130 DCHECK(quad_list.empty());
127 DCHECK(shared_quad_state_list.empty()); 131 DCHECK(shared_quad_state_list.empty());
128 } 132 }
129 133
130 void RenderPass::SetAll(Id id, 134 void RenderPass::SetAll(Id id,
131 const gfx::Rect& output_rect, 135 const gfx::Rect& output_rect,
132 const gfx::RectF& damage_rect, 136 const gfx::RectF& damage_rect,
133 const gfx::Transform& transform_to_root_target, 137 const gfx::Transform& transform_to_root_target,
134 bool has_transparent_background) { 138 bool has_transparent_background,
139 OverlayState overlay_state) {
135 DCHECK_GT(id.layer_id, 0); 140 DCHECK_GT(id.layer_id, 0);
136 DCHECK_GE(id.index, 0); 141 DCHECK_GE(id.index, 0);
137 142
138 this->id = id; 143 this->id = id;
139 this->output_rect = output_rect; 144 this->output_rect = output_rect;
140 this->damage_rect = damage_rect; 145 this->damage_rect = damage_rect;
141 this->transform_to_root_target = transform_to_root_target; 146 this->transform_to_root_target = transform_to_root_target;
142 this->has_transparent_background = has_transparent_background; 147 this->has_transparent_background = has_transparent_background;
148 this->overlay_state = overlay_state;
143 149
144 DCHECK(quad_list.empty()); 150 DCHECK(quad_list.empty());
145 DCHECK(shared_quad_state_list.empty()); 151 DCHECK(shared_quad_state_list.empty());
146 } 152 }
147 153
148 scoped_ptr<base::Value> RenderPass::AsValue() const { 154 scoped_ptr<base::Value> RenderPass::AsValue() const {
149 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); 155 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
150 value->Set("output_rect", MathUtil::AsValue(output_rect).release()); 156 value->Set("output_rect", MathUtil::AsValue(output_rect).release());
151 value->Set("damage_rect", MathUtil::AsValue(damage_rect).release()); 157 value->Set("damage_rect", MathUtil::AsValue(damage_rect).release());
152 value->SetBoolean("has_transparent_background", has_transparent_background); 158 value->SetBoolean("has_transparent_background", has_transparent_background);
153 value->SetInteger("copy_requests", copy_requests.size()); 159 value->SetInteger("copy_requests", copy_requests.size());
154 scoped_ptr<base::ListValue> shared_states_value(new base::ListValue()); 160 scoped_ptr<base::ListValue> shared_states_value(new base::ListValue());
155 for (size_t i = 0; i < shared_quad_state_list.size(); ++i) { 161 for (size_t i = 0; i < shared_quad_state_list.size(); ++i) {
156 shared_states_value->Append(shared_quad_state_list[i]->AsValue().release()); 162 shared_states_value->Append(shared_quad_state_list[i]->AsValue().release());
157 } 163 }
158 value->Set("shared_quad_state_list", shared_states_value.release()); 164 value->Set("shared_quad_state_list", shared_states_value.release());
159 scoped_ptr<base::ListValue> quad_list_value(new base::ListValue()); 165 scoped_ptr<base::ListValue> quad_list_value(new base::ListValue());
160 for (size_t i = 0; i < quad_list.size(); ++i) { 166 for (size_t i = 0; i < quad_list.size(); ++i) {
161 quad_list_value->Append(quad_list[i]->AsValue().release()); 167 quad_list_value->Append(quad_list[i]->AsValue().release());
162 } 168 }
163 value->Set("quad_list", quad_list_value.release()); 169 value->Set("quad_list", quad_list_value.release());
164 170
165 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( 171 TracedValue::MakeDictIntoImplicitSnapshotWithCategory(
166 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), 172 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"),
167 value.get(), "cc::RenderPass", id.AsTracingId()); 173 value.get(), "cc::RenderPass", id.AsTracingId());
168 return value.PassAs<base::Value>(); 174 return value.PassAs<base::Value>();
169 } 175 }
170 176
171 } // namespace cc 177 } // namespace cc
OLDNEW
« no previous file with comments | « cc/quads/render_pass.h ('k') | cc/quads/render_pass_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698