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

Side by Side Diff: cc/layers/texture_layer_impl.cc

Issue 308193003: Removed QuadSink and MockQuadCuller (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@plumLayerImpl
Patch Set: rebase Created 6 years, 6 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
« no previous file with comments | « cc/layers/texture_layer_impl.h ('k') | cc/layers/tiled_layer_impl.h » ('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/layers/texture_layer_impl.h" 5 #include "cc/layers/texture_layer_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "cc/layers/quad_sink.h"
11 #include "cc/output/renderer.h" 10 #include "cc/output/renderer.h"
12 #include "cc/quads/texture_draw_quad.h" 11 #include "cc/quads/texture_draw_quad.h"
13 #include "cc/resources/platform_color.h" 12 #include "cc/resources/platform_color.h"
14 #include "cc/resources/scoped_resource.h" 13 #include "cc/resources/scoped_resource.h"
15 #include "cc/resources/single_release_callback.h" 14 #include "cc/resources/single_release_callback.h"
16 #include "cc/trees/layer_tree_impl.h" 15 #include "cc/trees/layer_tree_impl.h"
16 #include "cc/trees/occlusion_tracker.h"
17 17
18 namespace cc { 18 namespace cc {
19 19
20 TextureLayerImpl::TextureLayerImpl(LayerTreeImpl* tree_impl, int id) 20 TextureLayerImpl::TextureLayerImpl(LayerTreeImpl* tree_impl, int id)
21 : LayerImpl(tree_impl, id), 21 : LayerImpl(tree_impl, id),
22 external_texture_resource_(0), 22 external_texture_resource_(0),
23 premultiplied_alpha_(true), 23 premultiplied_alpha_(true),
24 blend_background_color_(false), 24 blend_background_color_(false),
25 flipped_(true), 25 flipped_(true),
26 uv_top_left_(0.f, 0.f), 26 uv_top_left_(0.f, 0.f),
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 gfx::Rect(texture_mailbox_.shared_memory_size()), 132 gfx::Rect(texture_mailbox_.shared_memory_size()),
133 gfx::Vector2d()); 133 gfx::Vector2d());
134 134
135 valid_texture_copy_ = true; 135 valid_texture_copy_ = true;
136 } 136 }
137 } 137 }
138 return (external_texture_resource_ || valid_texture_copy_) && 138 return (external_texture_resource_ || valid_texture_copy_) &&
139 LayerImpl::WillDraw(draw_mode, resource_provider); 139 LayerImpl::WillDraw(draw_mode, resource_provider);
140 } 140 }
141 141
142 void TextureLayerImpl::AppendQuads(QuadSink* quad_sink, 142 void TextureLayerImpl::AppendQuads(
143 AppendQuadsData* append_quads_data) { 143 RenderPass* render_pass,
144 const OcclusionTracker<LayerImpl>& occlusion_tracker,
145 AppendQuadsData* append_quads_data) {
144 DCHECK(external_texture_resource_ || valid_texture_copy_); 146 DCHECK(external_texture_resource_ || valid_texture_copy_);
145 147
146 SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState(); 148 SharedQuadState* shared_quad_state =
149 render_pass->CreateAndAppendSharedQuadState();
147 PopulateSharedQuadState(shared_quad_state); 150 PopulateSharedQuadState(shared_quad_state);
148 151
149 AppendDebugBorderQuad( 152 AppendDebugBorderQuad(
150 quad_sink, content_bounds(), shared_quad_state, append_quads_data); 153 render_pass, content_bounds(), shared_quad_state, append_quads_data);
151 154
152 SkColor bg_color = blend_background_color_ ? 155 SkColor bg_color = blend_background_color_ ?
153 background_color() : SK_ColorTRANSPARENT; 156 background_color() : SK_ColorTRANSPARENT;
154 bool opaque = contents_opaque() || (SkColorGetA(bg_color) == 0xFF); 157 bool opaque = contents_opaque() || (SkColorGetA(bg_color) == 0xFF);
155 158
156 gfx::Rect quad_rect(content_bounds()); 159 gfx::Rect quad_rect(content_bounds());
157 gfx::Rect opaque_rect = opaque ? quad_rect : gfx::Rect(); 160 gfx::Rect opaque_rect = opaque ? quad_rect : gfx::Rect();
158 gfx::Rect visible_quad_rect = quad_sink->UnoccludedContentRect( 161 gfx::Rect visible_quad_rect = occlusion_tracker.UnoccludedContentRect(
159 quad_rect, draw_properties().target_space_transform); 162 quad_rect, draw_properties().target_space_transform);
160 if (visible_quad_rect.IsEmpty()) 163 if (visible_quad_rect.IsEmpty())
161 return; 164 return;
162 165
163 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create(); 166 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create();
164 ResourceProvider::ResourceId id = 167 ResourceProvider::ResourceId id =
165 valid_texture_copy_ ? texture_copy_->id() : external_texture_resource_; 168 valid_texture_copy_ ? texture_copy_->id() : external_texture_resource_;
166 quad->SetNew(shared_quad_state, 169 quad->SetNew(shared_quad_state,
167 quad_rect, 170 quad_rect,
168 opaque_rect, 171 opaque_rect,
169 visible_quad_rect, 172 visible_quad_rect,
170 id, 173 id,
171 premultiplied_alpha_, 174 premultiplied_alpha_,
172 uv_top_left_, 175 uv_top_left_,
173 uv_bottom_right_, 176 uv_bottom_right_,
174 bg_color, 177 bg_color,
175 vertex_opacity_, 178 vertex_opacity_,
176 flipped_); 179 flipped_);
177 quad_sink->Append(quad.PassAs<DrawQuad>()); 180 render_pass->AppendDrawQuad(quad.PassAs<DrawQuad>());
178 } 181 }
179 182
180 Region TextureLayerImpl::VisibleContentOpaqueRegion() const { 183 Region TextureLayerImpl::VisibleContentOpaqueRegion() const {
181 if (contents_opaque()) 184 if (contents_opaque())
182 return visible_content_rect(); 185 return visible_content_rect();
183 186
184 if (blend_background_color_ && (SkColorGetA(background_color()) == 0xFF)) 187 if (blend_background_color_ && (SkColorGetA(background_color()) == 0xFF))
185 return visible_content_rect(); 188 return visible_content_rect();
186 189
187 return Region(); 190 return Region();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 } else if (external_texture_resource_) { 247 } else if (external_texture_resource_) {
245 DCHECK(!own_mailbox_); 248 DCHECK(!own_mailbox_);
246 ResourceProvider* resource_provider = 249 ResourceProvider* resource_provider =
247 layer_tree_impl()->resource_provider(); 250 layer_tree_impl()->resource_provider();
248 resource_provider->DeleteResource(external_texture_resource_); 251 resource_provider->DeleteResource(external_texture_resource_);
249 external_texture_resource_ = 0; 252 external_texture_resource_ = 0;
250 } 253 }
251 } 254 }
252 255
253 } // namespace cc 256 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/texture_layer_impl.h ('k') | cc/layers/tiled_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698