OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/surfaces/surface_aggregator.h" | 5 #include "cc/surfaces/surface_aggregator.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 for (size_t j = 0; j < passes_to_copy; ++j) { | 236 for (size_t j = 0; j < passes_to_copy; ++j) { |
237 const RenderPass& source = *referenced_passes[j]; | 237 const RenderPass& source = *referenced_passes[j]; |
238 | 238 |
239 size_t sqs_size = source.shared_quad_state_list.size(); | 239 size_t sqs_size = source.shared_quad_state_list.size(); |
240 size_t dq_size = source.quad_list.size(); | 240 size_t dq_size = source.quad_list.size(); |
241 scoped_ptr<RenderPass> copy_pass(RenderPass::Create(sqs_size, dq_size)); | 241 scoped_ptr<RenderPass> copy_pass(RenderPass::Create(sqs_size, dq_size)); |
242 | 242 |
243 RenderPassId remapped_pass_id = RemapPassId(source.id, surface_id); | 243 RenderPassId remapped_pass_id = RemapPassId(source.id, surface_id); |
244 | 244 |
245 copy_pass->SetAll(remapped_pass_id, source.output_rect, gfx::Rect(), | 245 copy_pass->SetAll(remapped_pass_id, source.output_rect, gfx::Rect(), |
246 source.transform_to_root_target, | 246 gfx::Rect(), source.transform_to_root_target, |
247 source.has_transparent_background); | 247 source.has_transparent_background); |
248 | 248 |
249 MoveMatchingRequests(source.id, ©_requests, ©_pass->copy_requests); | 249 MoveMatchingRequests(source.id, ©_requests, ©_pass->copy_requests); |
250 | 250 |
251 // Contributing passes aggregated in to the pass list need to take the | 251 // Contributing passes aggregated in to the pass list need to take the |
252 // transform of the surface quad into account to update their transform to | 252 // transform of the surface quad into account to update their transform to |
253 // the root surface. | 253 // the root surface. |
254 copy_pass->transform_to_root_target.ConcatTransform( | 254 copy_pass->transform_to_root_target.ConcatTransform( |
255 surface_quad->quadTransform()); | 255 surface_quad->quadTransform()); |
256 copy_pass->transform_to_root_target.ConcatTransform( | 256 copy_pass->transform_to_root_target.ConcatTransform( |
(...skipping 21 matching lines...) Expand all Loading... |
278 // Intersect the transformed visible rect and the clip rect to create a | 278 // Intersect the transformed visible rect and the clip rect to create a |
279 // smaller cliprect for the quad. | 279 // smaller cliprect for the quad. |
280 ClipData surface_quad_clip_rect( | 280 ClipData surface_quad_clip_rect( |
281 true, MathUtil::MapEnclosingClippedRect(surface_quad->quadTransform(), | 281 true, MathUtil::MapEnclosingClippedRect(surface_quad->quadTransform(), |
282 surface_quad->visible_rect)); | 282 surface_quad->visible_rect)); |
283 if (surface_quad->isClipped()) | 283 if (surface_quad->isClipped()) |
284 surface_quad_clip_rect.rect.Intersect(surface_quad->clipRect()); | 284 surface_quad_clip_rect.rect.Intersect(surface_quad->clipRect()); |
285 | 285 |
286 ClipData quads_clip = CalculateClipRect(clip_rect, surface_quad_clip_rect, | 286 ClipData quads_clip = CalculateClipRect(clip_rect, surface_quad_clip_rect, |
287 content_to_target_transform); | 287 content_to_target_transform); |
| 288 dest_pass->overlay_rect = MathUtil::MapEnclosingClippedRect( |
| 289 surface_quad->quadTransform(), last_pass.overlay_rect); |
288 | 290 |
289 CopyQuadsToPass(quads, last_pass.shared_quad_state_list, surface_transform, | 291 CopyQuadsToPass(quads, last_pass.shared_quad_state_list, surface_transform, |
290 quads_clip, dest_pass, surface_id); | 292 quads_clip, dest_pass, surface_id); |
291 } else { | 293 } else { |
292 RenderPassId remapped_pass_id = RemapPassId(last_pass.id, surface_id); | 294 RenderPassId remapped_pass_id = RemapPassId(last_pass.id, surface_id); |
293 | 295 |
294 CopySharedQuadState(surface_quad->shared_quad_state, | 296 CopySharedQuadState(surface_quad->shared_quad_state, |
295 content_to_target_transform, clip_rect, dest_pass); | 297 content_to_target_transform, clip_rect, dest_pass); |
296 | 298 |
297 SharedQuadState* shared_quad_state = | 299 SharedQuadState* shared_quad_state = |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 MoveMatchingRequests(source.id, ©_requests, ©_pass->copy_requests); | 422 MoveMatchingRequests(source.id, ©_requests, ©_pass->copy_requests); |
421 | 423 |
422 RenderPassId remapped_pass_id = | 424 RenderPassId remapped_pass_id = |
423 RemapPassId(source.id, surface->surface_id()); | 425 RemapPassId(source.id, surface->surface_id()); |
424 | 426 |
425 gfx::Rect damage_rect = | 427 gfx::Rect damage_rect = |
426 (i < source_pass_list.size() - 1) | 428 (i < source_pass_list.size() - 1) |
427 ? gfx::Rect() | 429 ? gfx::Rect() |
428 : DamageRectForSurface(surface, source, source.output_rect); | 430 : DamageRectForSurface(surface, source, source.output_rect); |
429 copy_pass->SetAll(remapped_pass_id, source.output_rect, damage_rect, | 431 copy_pass->SetAll(remapped_pass_id, source.output_rect, damage_rect, |
430 source.transform_to_root_target, | 432 source.overlay_rect, source.transform_to_root_target, |
431 source.has_transparent_background); | 433 source.has_transparent_background); |
432 | 434 |
433 CopyQuadsToPass(source.quad_list, source.shared_quad_state_list, | 435 CopyQuadsToPass(source.quad_list, source.shared_quad_state_list, |
434 gfx::Transform(), ClipData(), copy_pass.get(), | 436 gfx::Transform(), ClipData(), copy_pass.get(), |
435 surface->surface_id()); | 437 surface->surface_id()); |
436 | 438 |
437 dest_pass_list_->push_back(copy_pass.Pass()); | 439 dest_pass_list_->push_back(copy_pass.Pass()); |
438 } | 440 } |
439 } | 441 } |
440 | 442 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 void SurfaceAggregator::ReleaseResources(SurfaceId surface_id) { | 506 void SurfaceAggregator::ReleaseResources(SurfaceId surface_id) { |
505 SurfaceToResourceChildIdMap::iterator it = | 507 SurfaceToResourceChildIdMap::iterator it = |
506 surface_id_to_resource_child_id_.find(surface_id); | 508 surface_id_to_resource_child_id_.find(surface_id); |
507 if (it != surface_id_to_resource_child_id_.end()) { | 509 if (it != surface_id_to_resource_child_id_.end()) { |
508 provider_->DestroyChild(it->second); | 510 provider_->DestroyChild(it->second); |
509 surface_id_to_resource_child_id_.erase(it); | 511 surface_id_to_resource_child_id_.erase(it); |
510 } | 512 } |
511 } | 513 } |
512 | 514 |
513 } // namespace cc | 515 } // namespace cc |
OLD | NEW |