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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 // TODO(jbauman): This rect may contain unnecessary area if | 370 // TODO(jbauman): This rect may contain unnecessary area if |
371 // transform isn't axis-aligned. | 371 // transform isn't axis-aligned. |
372 gfx::Rect damage_rect_in_quad_space; | 372 gfx::Rect damage_rect_in_quad_space; |
373 bool damage_rect_in_quad_space_valid = false; | 373 bool damage_rect_in_quad_space_valid = false; |
374 | 374 |
375 #if DCHECK_IS_ON() | 375 #if DCHECK_IS_ON() |
376 // If quads have come in with SharedQuadState out of order, or when quads have | 376 // If quads have come in with SharedQuadState out of order, or when quads have |
377 // invalid SharedQuadState pointer, it should DCHECK. | 377 // invalid SharedQuadState pointer, it should DCHECK. |
378 SharedQuadStateList::ConstIterator sqs_iter = | 378 SharedQuadStateList::ConstIterator sqs_iter = |
379 source_shared_quad_state_list.begin(); | 379 source_shared_quad_state_list.begin(); |
380 for (const auto& quad : source_quad_list) { | 380 for (auto* quad : source_quad_list) { |
381 while (sqs_iter != source_shared_quad_state_list.end() && | 381 while (sqs_iter != source_shared_quad_state_list.end() && |
382 quad->shared_quad_state != *sqs_iter) { | 382 quad->shared_quad_state != *sqs_iter) { |
383 ++sqs_iter; | 383 ++sqs_iter; |
384 } | 384 } |
385 DCHECK(sqs_iter != source_shared_quad_state_list.end()); | 385 DCHECK(sqs_iter != source_shared_quad_state_list.end()); |
386 } | 386 } |
387 #endif | 387 #endif |
388 | 388 |
389 for (const auto& quad : source_quad_list) { | 389 for (auto* quad : source_quad_list) { |
390 if (quad->material == DrawQuad::SURFACE_CONTENT) { | 390 if (quad->material == DrawQuad::SURFACE_CONTENT) { |
391 const SurfaceDrawQuad* surface_quad = SurfaceDrawQuad::MaterialCast(quad); | 391 const SurfaceDrawQuad* surface_quad = SurfaceDrawQuad::MaterialCast(quad); |
392 // HandleSurfaceQuad may add other shared quad state, so reset the | 392 // HandleSurfaceQuad may add other shared quad state, so reset the |
393 // current data. | 393 // current data. |
394 last_copied_source_shared_quad_state = nullptr; | 394 last_copied_source_shared_quad_state = nullptr; |
395 | 395 |
396 if (ignore_undamaged) { | 396 if (ignore_undamaged) { |
397 gfx::Transform quad_to_target_transform( | 397 gfx::Transform quad_to_target_transform( |
398 target_transform, | 398 target_transform, |
399 quad->shared_quad_state->quad_to_target_transform); | 399 quad->shared_quad_state->quad_to_target_transform); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 SurfaceId id; | 598 SurfaceId id; |
599 bool has_moved_pixels; | 599 bool has_moved_pixels; |
600 RenderPassId parent_pass; | 600 RenderPassId parent_pass; |
601 gfx::Transform target_to_surface_transform; | 601 gfx::Transform target_to_surface_transform; |
602 }; | 602 }; |
603 std::vector<SurfaceInfo> child_surfaces; | 603 std::vector<SurfaceInfo> child_surfaces; |
604 | 604 |
605 for (const auto& render_pass : base::Reversed(frame_data->render_pass_list)) { | 605 for (const auto& render_pass : base::Reversed(frame_data->render_pass_list)) { |
606 RenderPassId remapped_pass_id = RemapPassId(render_pass->id, surface_id); | 606 RenderPassId remapped_pass_id = RemapPassId(render_pass->id, surface_id); |
607 bool in_moved_pixel_pass = !!moved_pixel_passes_.count(remapped_pass_id); | 607 bool in_moved_pixel_pass = !!moved_pixel_passes_.count(remapped_pass_id); |
608 for (const auto& quad : render_pass->quad_list) { | 608 for (auto* quad : render_pass->quad_list) { |
609 if (quad->material == DrawQuad::SURFACE_CONTENT) { | 609 if (quad->material == DrawQuad::SURFACE_CONTENT) { |
610 const SurfaceDrawQuad* surface_quad = | 610 const SurfaceDrawQuad* surface_quad = |
611 SurfaceDrawQuad::MaterialCast(quad); | 611 SurfaceDrawQuad::MaterialCast(quad); |
612 gfx::Transform target_to_surface_transform( | 612 gfx::Transform target_to_surface_transform( |
613 render_pass->transform_to_root_target, | 613 render_pass->transform_to_root_target, |
614 surface_quad->shared_quad_state->quad_to_target_transform); | 614 surface_quad->shared_quad_state->quad_to_target_transform); |
615 child_surfaces.push_back( | 615 child_surfaces.push_back( |
616 SurfaceInfo{surface_quad->surface_id, in_moved_pixel_pass, | 616 SurfaceInfo{surface_quad->surface_id, in_moved_pixel_pass, |
617 remapped_pass_id, target_to_surface_transform}); | 617 remapped_pass_id, target_to_surface_transform}); |
618 } else if (quad->material == DrawQuad::RENDER_PASS) { | 618 } else if (quad->material == DrawQuad::RENDER_PASS) { |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 | 831 |
832 void SurfaceAggregator::SetFullDamageForSurface(const SurfaceId& surface_id) { | 832 void SurfaceAggregator::SetFullDamageForSurface(const SurfaceId& surface_id) { |
833 auto it = previous_contained_surfaces_.find(surface_id); | 833 auto it = previous_contained_surfaces_.find(surface_id); |
834 if (it == previous_contained_surfaces_.end()) | 834 if (it == previous_contained_surfaces_.end()) |
835 return; | 835 return; |
836 // Set the last drawn index as 0 to ensure full damage next time it's drawn. | 836 // Set the last drawn index as 0 to ensure full damage next time it's drawn. |
837 it->second = 0; | 837 it->second = 0; |
838 } | 838 } |
839 | 839 |
840 } // namespace cc | 840 } // namespace cc |
OLD | NEW |