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

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

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

Powered by Google App Engine
This is Rietveld 408576698