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

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

Issue 2873593002: Force use of and cache render surface. (Closed)
Patch Set: Improve with comment in patch 18. Created 3 years, 4 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
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/render_surface_impl.h" 5 #include "cc/layers/render_surface_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 } 145 }
146 146
147 const FilterOperations& RenderSurfaceImpl::BackgroundFilters() const { 147 const FilterOperations& RenderSurfaceImpl::BackgroundFilters() const {
148 return OwningEffectNode()->background_filters; 148 return OwningEffectNode()->background_filters;
149 } 149 }
150 150
151 bool RenderSurfaceImpl::HasCopyRequest() const { 151 bool RenderSurfaceImpl::HasCopyRequest() const {
152 return OwningEffectNode()->has_copy_request; 152 return OwningEffectNode()->has_copy_request;
153 } 153 }
154 154
155 bool RenderSurfaceImpl::ShouldCacheRenderSurface() const {
156 return OwningEffectNode()->cache_render_surface;
157 }
158
155 int RenderSurfaceImpl::TransformTreeIndex() const { 159 int RenderSurfaceImpl::TransformTreeIndex() const {
156 return OwningEffectNode()->transform_id; 160 return OwningEffectNode()->transform_id;
157 } 161 }
158 162
159 int RenderSurfaceImpl::ClipTreeIndex() const { 163 int RenderSurfaceImpl::ClipTreeIndex() const {
160 return OwningEffectNode()->clip_id; 164 return OwningEffectNode()->clip_id;
161 } 165 }
162 166
163 int RenderSurfaceImpl::EffectTreeIndex() const { 167 int RenderSurfaceImpl::EffectTreeIndex() const {
164 return effect_tree_index_; 168 return effect_tree_index_;
(...skipping 29 matching lines...) Expand all
194 gfx::Rect clip_in_surface_space = 198 gfx::Rect clip_in_surface_space =
195 MathUtil::ProjectEnclosingClippedRect(target_to_surface, clip_rect()); 199 MathUtil::ProjectEnclosingClippedRect(target_to_surface, clip_rect());
196 gfx::Rect expanded_clip_in_surface_space = 200 gfx::Rect expanded_clip_in_surface_space =
197 Filters().MapRectReverse(clip_in_surface_space, SurfaceScale().matrix()); 201 Filters().MapRectReverse(clip_in_surface_space, SurfaceScale().matrix());
198 gfx::Rect expanded_clip_in_target_space = MathUtil::MapEnclosingClippedRect( 202 gfx::Rect expanded_clip_in_target_space = MathUtil::MapEnclosingClippedRect(
199 draw_transform(), expanded_clip_in_surface_space); 203 draw_transform(), expanded_clip_in_surface_space);
200 return expanded_clip_in_target_space; 204 return expanded_clip_in_target_space;
201 } 205 }
202 206
203 gfx::Rect RenderSurfaceImpl::CalculateClippedAccumulatedContentRect() { 207 gfx::Rect RenderSurfaceImpl::CalculateClippedAccumulatedContentRect() {
204 if (HasCopyRequest() || !is_clipped()) 208 if (ShouldCacheRenderSurface() || HasCopyRequest() || !is_clipped())
205 return accumulated_content_rect(); 209 return accumulated_content_rect();
206 210
207 if (accumulated_content_rect().IsEmpty()) 211 if (accumulated_content_rect().IsEmpty())
208 return gfx::Rect(); 212 return gfx::Rect();
209 213
210 // Calculate projection from the target surface rect to local 214 // Calculate projection from the target surface rect to local
211 // space. Non-invertible draw transforms means no able to bring clipped rect 215 // space. Non-invertible draw transforms means no able to bring clipped rect
212 // in target space back to local space, early out without clip. 216 // in target space back to local space, early out without clip.
213 gfx::Transform target_to_surface(gfx::Transform::kSkipInitialization); 217 gfx::Transform target_to_surface(gfx::Transform::kSkipInitialization);
214 if (!draw_transform().GetInverse(&target_to_surface)) 218 if (!draw_transform().GetInverse(&target_to_surface))
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 return ancestor_property_changed_ || property_trees->full_tree_damaged || 333 return ancestor_property_changed_ || property_trees->full_tree_damaged ||
330 property_trees->transform_tree.Node(TransformTreeIndex()) 334 property_trees->transform_tree.Node(TransformTreeIndex())
331 ->transform_changed || 335 ->transform_changed ||
332 property_trees->effect_tree.Node(EffectTreeIndex())->effect_changed; 336 property_trees->effect_tree.Node(EffectTreeIndex())->effect_changed;
333 } 337 }
334 338
335 void RenderSurfaceImpl::NoteAncestorPropertyChanged() { 339 void RenderSurfaceImpl::NoteAncestorPropertyChanged() {
336 ancestor_property_changed_ = true; 340 ancestor_property_changed_ = true;
337 } 341 }
338 342
343 bool RenderSurfaceImpl::HasDamageFromeContributingContent() const {
344 return damage_tracker_->has_damage_from_contributing_content();
345 }
346
339 gfx::Rect RenderSurfaceImpl::GetDamageRect() const { 347 gfx::Rect RenderSurfaceImpl::GetDamageRect() const {
340 gfx::Rect damage_rect; 348 gfx::Rect damage_rect;
341 bool is_valid_rect = damage_tracker_->GetDamageRectIfValid(&damage_rect); 349 bool is_valid_rect = damage_tracker_->GetDamageRectIfValid(&damage_rect);
342 if (!is_valid_rect) 350 if (!is_valid_rect)
343 return content_rect(); 351 return content_rect();
344 return damage_rect; 352 return damage_rect;
345 } 353 }
346 354
347 void RenderSurfaceImpl::ResetPropertyChangedFlags() { 355 void RenderSurfaceImpl::ResetPropertyChangedFlags() {
348 surface_property_changed_ = false; 356 surface_property_changed_ = false;
349 ancestor_property_changed_ = false; 357 ancestor_property_changed_ = false;
350 } 358 }
351 359
352 std::unique_ptr<RenderPass> RenderSurfaceImpl::CreateRenderPass() { 360 std::unique_ptr<RenderPass> RenderSurfaceImpl::CreateRenderPass() {
353 std::unique_ptr<RenderPass> pass = RenderPass::Create(num_contributors_); 361 std::unique_ptr<RenderPass> pass = RenderPass::Create(num_contributors_);
354 gfx::Rect damage_rect = GetDamageRect(); 362 gfx::Rect damage_rect = GetDamageRect();
355 damage_rect.Intersect(content_rect()); 363 damage_rect.Intersect(content_rect());
356 pass->SetNew(id(), content_rect(), damage_rect, 364 pass->SetNew(id(), content_rect(), damage_rect,
357 draw_properties_.screen_space_transform); 365 draw_properties_.screen_space_transform);
358 pass->filters = Filters(); 366 pass->filters = Filters();
359 pass->background_filters = BackgroundFilters(); 367 pass->background_filters = BackgroundFilters();
368 pass->cache_render_pass = ShouldCacheRenderSurface();
369 pass->has_damage_from_contributing_content =
370 HasDamageFromeContributingContent();
360 return pass; 371 return pass;
361 } 372 }
362 373
363 void RenderSurfaceImpl::AppendQuads(DrawMode draw_mode, 374 void RenderSurfaceImpl::AppendQuads(DrawMode draw_mode,
364 RenderPass* render_pass, 375 RenderPass* render_pass,
365 AppendQuadsData* append_quads_data) { 376 AppendQuadsData* append_quads_data) {
366 gfx::Rect visible_layer_rect = 377 gfx::Rect visible_layer_rect =
367 occlusion_in_content_space().GetUnoccludedContentRect(content_rect()); 378 occlusion_in_content_space().GetUnoccludedContentRect(content_rect());
368 if (visible_layer_rect.IsEmpty()) 379 if (visible_layer_rect.IsEmpty())
369 return; 380 return;
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 NOTIMPLEMENTED(); 548 NOTIMPLEMENTED();
538 break; 549 break;
539 default: 550 default:
540 NOTREACHED(); 551 NOTREACHED();
541 break; 552 break;
542 } 553 }
543 } 554 }
544 } 555 }
545 556
546 } // namespace cc 557 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698