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

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 917763003: cc: Move occlusion debug rects into the debug layer borders. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: occlusiondebugrects: reviewed Created 5 years, 10 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
« no previous file with comments | « cc/test/layer_test_common.cc ('k') | cc/trees/occlusion_tracker.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 occlusion_tracker.GetCurrentOcclusionForLayer(layer->draw_transform()), 599 occlusion_tracker.GetCurrentOcclusionForLayer(layer->draw_transform()),
600 append_quads_data); 600 append_quads_data);
601 } 601 }
602 602
603 static void AppendQuadsForRenderSurfaceLayer( 603 static void AppendQuadsForRenderSurfaceLayer(
604 RenderPass* target_render_pass, 604 RenderPass* target_render_pass,
605 LayerImpl* layer, 605 LayerImpl* layer,
606 const RenderPass* contributing_render_pass, 606 const RenderPass* contributing_render_pass,
607 const OcclusionTracker<LayerImpl>& occlusion_tracker, 607 const OcclusionTracker<LayerImpl>& occlusion_tracker,
608 AppendQuadsData* append_quads_data) { 608 AppendQuadsData* append_quads_data) {
609 bool is_replica = false; 609 RenderSurfaceImpl* surface = layer->render_surface();
610 layer->render_surface()->AppendQuads(target_render_pass, 610 const gfx::Transform& draw_transform = surface->draw_transform();
611 occlusion_tracker, 611 const Occlusion& occlusion =
612 append_quads_data, 612 occlusion_tracker.GetCurrentOcclusionForContributingSurface(
613 is_replica, 613 draw_transform);
614 contributing_render_pass->id); 614 SkColor debug_border_color = surface->GetDebugBorderColor();
615 float debug_border_width = surface->GetDebugBorderWidth();
616 LayerImpl* mask_layer = layer->mask_layer();
617
618 surface->AppendQuads(target_render_pass, draw_transform, occlusion,
619 debug_border_color, debug_border_width, mask_layer,
620 append_quads_data, contributing_render_pass->id);
615 621
616 // Add replica after the surface so that it appears below the surface. 622 // Add replica after the surface so that it appears below the surface.
617 if (layer->has_replica()) { 623 if (layer->has_replica()) {
618 is_replica = true; 624 const gfx::Transform& replica_draw_transform =
619 layer->render_surface()->AppendQuads(target_render_pass, 625 surface->replica_draw_transform();
620 occlusion_tracker, 626 const Occlusion& replica_occlusion =
621 append_quads_data, 627 occlusion_tracker.GetCurrentOcclusionForContributingSurface(
622 is_replica, 628 replica_draw_transform);
623 contributing_render_pass->id); 629 SkColor replica_debug_border_color = surface->GetReplicaDebugBorderColor();
630 float replica_debug_border_width = surface->GetReplicaDebugBorderWidth();
631 // TODO(danakj): By using the same RenderSurfaceImpl for both the
632 // content and its reflection, it's currently not possible to apply a
633 // separate mask to the reflection layer or correctly handle opacity in
634 // reflections (opacity must be applied after drawing both the layer and its
635 // reflection). The solution is to introduce yet another RenderSurfaceImpl
636 // to draw the layer and its reflection in. For now we only apply a separate
637 // reflection mask if the contents don't have a mask of their own.
638 LayerImpl* replica_mask_layer =
639 mask_layer ? mask_layer : layer->replica_layer()->mask_layer();
640
641 surface->AppendQuads(target_render_pass, replica_draw_transform,
642 replica_occlusion, replica_debug_border_color,
643 replica_debug_border_width, replica_mask_layer,
644 append_quads_data, contributing_render_pass->id);
624 } 645 }
625 } 646 }
626 647
627 static void AppendQuadsToFillScreen( 648 static void AppendQuadsToFillScreen(
628 const gfx::Rect& root_scroll_layer_rect, 649 const gfx::Rect& root_scroll_layer_rect,
629 RenderPass* target_render_pass, 650 RenderPass* target_render_pass,
630 LayerImpl* root_layer, 651 LayerImpl* root_layer,
631 SkColor screen_background_color, 652 SkColor screen_background_color,
632 const OcclusionTracker<LayerImpl>& occlusion_tracker) { 653 const OcclusionTracker<LayerImpl>& occlusion_tracker) {
633 if (!root_layer || !SkColorGetA(screen_background_color)) 654 if (!root_layer || !SkColorGetA(screen_background_color))
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 if (active_tree_->hud_layer()) { 756 if (active_tree_->hud_layer()) {
736 RenderPass* root_pass = frame->render_passes.back(); 757 RenderPass* root_pass = frame->render_passes.back();
737 root_pass->damage_rect = root_pass->output_rect; 758 root_pass->damage_rect = root_pass->output_rect;
738 } 759 }
739 760
740 OcclusionTracker<LayerImpl> occlusion_tracker( 761 OcclusionTracker<LayerImpl> occlusion_tracker(
741 active_tree_->root_layer()->render_surface()->content_rect()); 762 active_tree_->root_layer()->render_surface()->content_rect());
742 occlusion_tracker.set_minimum_tracking_size( 763 occlusion_tracker.set_minimum_tracking_size(
743 settings_.minimum_occlusion_tracking_size); 764 settings_.minimum_occlusion_tracking_size);
744 765
745 if (debug_state_.show_occluding_rects) {
746 occlusion_tracker.set_occluding_screen_space_rects_container(
747 &frame->occluding_screen_space_rects);
748 }
749 if (debug_state_.show_non_occluding_rects) {
750 occlusion_tracker.set_non_occluding_screen_space_rects_container(
751 &frame->non_occluding_screen_space_rects);
752 }
753
754 // Add quads to the Render passes in front-to-back order to allow for testing 766 // Add quads to the Render passes in front-to-back order to allow for testing
755 // occlusion and performing culling during the tree walk. 767 // occlusion and performing culling during the tree walk.
756 typedef LayerIterator<LayerImpl> LayerIteratorType; 768 typedef LayerIterator<LayerImpl> LayerIteratorType;
757 769
758 // Typically when we are missing a texture and use a checkerboard quad, we 770 // Typically when we are missing a texture and use a checkerboard quad, we
759 // still draw the frame. However when the layer being checkerboarded is moving 771 // still draw the frame. However when the layer being checkerboarded is moving
760 // due to an impl-animation, we drop the frame to avoid flashing due to the 772 // due to an impl-animation, we drop the frame to avoid flashing due to the
761 // texture suddenly appearing in the future. 773 // texture suddenly appearing in the future.
762 DrawResult draw_result = DRAW_SUCCESS; 774 DrawResult draw_result = DRAW_SUCCESS;
763 // When we have a copy request for a layer, we need to draw no matter 775 // When we have a copy request for a layer, we need to draw no matter
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
1496 if (tile_manager_) { 1508 if (tile_manager_) {
1497 memory_history_->SaveEntry( 1509 memory_history_->SaveEntry(
1498 tile_manager_->memory_stats_from_last_assign()); 1510 tile_manager_->memory_stats_from_last_assign());
1499 } 1511 }
1500 1512
1501 if (debug_state_.ShowHudRects()) { 1513 if (debug_state_.ShowHudRects()) {
1502 debug_rect_history_->SaveDebugRectsForCurrentFrame( 1514 debug_rect_history_->SaveDebugRectsForCurrentFrame(
1503 active_tree_->root_layer(), 1515 active_tree_->root_layer(),
1504 active_tree_->hud_layer(), 1516 active_tree_->hud_layer(),
1505 *frame->render_surface_layer_list, 1517 *frame->render_surface_layer_list,
1506 frame->occluding_screen_space_rects,
1507 frame->non_occluding_screen_space_rects,
1508 debug_state_); 1518 debug_state_);
1509 } 1519 }
1510 1520
1511 if (!settings_.impl_side_painting && debug_state_.continuous_painting) { 1521 if (!settings_.impl_side_painting && debug_state_.continuous_painting) {
1512 const RenderingStats& stats = 1522 const RenderingStats& stats =
1513 rendering_stats_instrumentation_->GetRenderingStats(); 1523 rendering_stats_instrumentation_->GetRenderingStats();
1514 paint_time_counter_->SavePaintTime( 1524 paint_time_counter_->SavePaintTime(
1515 stats.begin_main_frame_to_commit_duration.GetLastTimeDelta()); 1525 stats.begin_main_frame_to_commit_duration.GetLastTimeDelta());
1516 } 1526 }
1517 1527
(...skipping 1990 matching lines...) Expand 10 before | Expand all | Expand 10 after
3508 } 3518 }
3509 3519
3510 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { 3520 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) {
3511 std::vector<PictureLayerImpl*>::iterator it = 3521 std::vector<PictureLayerImpl*>::iterator it =
3512 std::find(picture_layers_.begin(), picture_layers_.end(), layer); 3522 std::find(picture_layers_.begin(), picture_layers_.end(), layer);
3513 DCHECK(it != picture_layers_.end()); 3523 DCHECK(it != picture_layers_.end());
3514 picture_layers_.erase(it); 3524 picture_layers_.erase(it);
3515 } 3525 }
3516 3526
3517 } // namespace cc 3527 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_test_common.cc ('k') | cc/trees/occlusion_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698