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 #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 Loading... |
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::CacheRenderSurface() const { |
| 157 return OwningEffectNode()->cache_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 Loading... |
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 (CacheRenderSurface() || 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 Loading... |
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::HasDamageFromeContributingContent() const { |
| 345 return damage_tracker_->has_damage_from_contributing_content(); |
| 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 std::unique_ptr<RenderPass> RenderSurfaceImpl::CreateRenderPass() { | 361 std::unique_ptr<RenderPass> RenderSurfaceImpl::CreateRenderPass() { |
354 std::unique_ptr<RenderPass> pass = RenderPass::Create(num_contributors_); | 362 std::unique_ptr<RenderPass> pass = RenderPass::Create(num_contributors_); |
355 gfx::Rect damage_rect = GetDamageRect(); | 363 gfx::Rect damage_rect = GetDamageRect(); |
356 damage_rect.Intersect(content_rect()); | 364 damage_rect.Intersect(content_rect()); |
357 pass->SetNew(id(), content_rect(), damage_rect, | 365 pass->SetNew(id(), content_rect(), damage_rect, |
358 draw_properties_.screen_space_transform); | 366 draw_properties_.screen_space_transform); |
359 pass->filters = Filters(); | 367 pass->filters = Filters(); |
360 pass->background_filters = BackgroundFilters(); | 368 pass->background_filters = BackgroundFilters(); |
| 369 pass->cache_render_surface = CacheRenderSurface(); |
| 370 pass->has_damage_from_contributing_content = |
| 371 HasDamageFromeContributingContent(); |
361 return pass; | 372 return pass; |
362 } | 373 } |
363 | 374 |
364 void RenderSurfaceImpl::AppendQuads(RenderPass* render_pass, | 375 void RenderSurfaceImpl::AppendQuads(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; |
370 | 381 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 NOTIMPLEMENTED(); | 544 NOTIMPLEMENTED(); |
534 break; | 545 break; |
535 default: | 546 default: |
536 NOTREACHED(); | 547 NOTREACHED(); |
537 break; | 548 break; |
538 } | 549 } |
539 } | 550 } |
540 } | 551 } |
541 | 552 |
542 } // namespace cc | 553 } // namespace cc |
OLD | NEW |