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::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 DCHECK_EQ( | 169 DCHECK_EQ( |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 gfx::Rect clip_in_surface_space = | 203 gfx::Rect clip_in_surface_space = |
200 MathUtil::ProjectEnclosingClippedRect(target_to_surface, clip_rect()); | 204 MathUtil::ProjectEnclosingClippedRect(target_to_surface, clip_rect()); |
201 gfx::Rect expanded_clip_in_surface_space = | 205 gfx::Rect expanded_clip_in_surface_space = |
202 Filters().MapRectReverse(clip_in_surface_space, SurfaceScale().matrix()); | 206 Filters().MapRectReverse(clip_in_surface_space, SurfaceScale().matrix()); |
203 gfx::Rect expanded_clip_in_target_space = MathUtil::MapEnclosingClippedRect( | 207 gfx::Rect expanded_clip_in_target_space = MathUtil::MapEnclosingClippedRect( |
204 draw_transform(), expanded_clip_in_surface_space); | 208 draw_transform(), expanded_clip_in_surface_space); |
205 return expanded_clip_in_target_space; | 209 return expanded_clip_in_target_space; |
206 } | 210 } |
207 | 211 |
208 gfx::Rect RenderSurfaceImpl::CalculateClippedAccumulatedContentRect() { | 212 gfx::Rect RenderSurfaceImpl::CalculateClippedAccumulatedContentRect() { |
209 if (HasCopyRequest() || !is_clipped()) | 213 if (ForceRenderSurface() || HasCopyRequest() || !is_clipped()) |
210 return accumulated_content_rect(); | 214 return accumulated_content_rect(); |
211 | 215 |
212 if (accumulated_content_rect().IsEmpty()) | 216 if (accumulated_content_rect().IsEmpty()) |
213 return gfx::Rect(); | 217 return gfx::Rect(); |
214 | 218 |
215 // Calculate projection from the target surface rect to local | 219 // Calculate projection from the target surface rect to local |
216 // space. Non-invertible draw transforms means no able to bring clipped rect | 220 // space. Non-invertible draw transforms means no able to bring clipped rect |
217 // in target space back to local space, early out without clip. | 221 // in target space back to local space, early out without clip. |
218 gfx::Transform target_to_surface(gfx::Transform::kSkipInitialization); | 222 gfx::Transform target_to_surface(gfx::Transform::kSkipInitialization); |
219 if (!draw_transform().GetInverse(&target_to_surface)) | 223 if (!draw_transform().GetInverse(&target_to_surface)) |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 } | 363 } |
360 | 364 |
361 std::unique_ptr<RenderPass> RenderSurfaceImpl::CreateRenderPass() { | 365 std::unique_ptr<RenderPass> RenderSurfaceImpl::CreateRenderPass() { |
362 std::unique_ptr<RenderPass> pass = RenderPass::Create(num_contributors_); | 366 std::unique_ptr<RenderPass> pass = RenderPass::Create(num_contributors_); |
363 gfx::Rect damage_rect = GetDamageRect(); | 367 gfx::Rect damage_rect = GetDamageRect(); |
364 damage_rect.Intersect(content_rect()); | 368 damage_rect.Intersect(content_rect()); |
365 pass->SetNew(id(), content_rect(), damage_rect, | 369 pass->SetNew(id(), content_rect(), damage_rect, |
366 draw_properties_.screen_space_transform); | 370 draw_properties_.screen_space_transform); |
367 pass->filters = Filters(); | 371 pass->filters = Filters(); |
368 pass->background_filters = BackgroundFilters(); | 372 pass->background_filters = BackgroundFilters(); |
| 373 pass->force_render_surface = ForceRenderSurface(); |
369 return pass; | 374 return pass; |
370 } | 375 } |
371 | 376 |
372 void RenderSurfaceImpl::AppendQuads(RenderPass* render_pass, | 377 void RenderSurfaceImpl::AppendQuads(RenderPass* render_pass, |
373 AppendQuadsData* append_quads_data) { | 378 AppendQuadsData* append_quads_data) { |
374 gfx::Rect visible_layer_rect = | 379 gfx::Rect visible_layer_rect = |
375 occlusion_in_content_space().GetUnoccludedContentRect(content_rect()); | 380 occlusion_in_content_space().GetUnoccludedContentRect(content_rect()); |
376 if (visible_layer_rect.IsEmpty()) | 381 if (visible_layer_rect.IsEmpty()) |
377 return; | 382 return; |
378 | 383 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 NOTIMPLEMENTED(); | 547 NOTIMPLEMENTED(); |
543 break; | 548 break; |
544 default: | 549 default: |
545 NOTREACHED(); | 550 NOTREACHED(); |
546 break; | 551 break; |
547 } | 552 } |
548 } | 553 } |
549 } | 554 } |
550 | 555 |
551 } // namespace cc | 556 } // namespace cc |
OLD | NEW |