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

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

Issue 195803003: cc: Remove OverdrawMetrics and --trace-overdraw flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rm-overdraw: switches Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « cc/trees/occlusion_tracker_perftest.cc ('k') | cc/trees/quad_culler.cc » ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/occlusion_tracker.h" 5 #include "cc/trees/occlusion_tracker.h"
6 6
7 #include "cc/animation/layer_animation_controller.h" 7 #include "cc/animation/layer_animation_controller.h"
8 #include "cc/base/math_util.h" 8 #include "cc/base/math_util.h"
9 #include "cc/debug/overdraw_metrics.h"
10 #include "cc/layers/layer.h" 9 #include "cc/layers/layer.h"
11 #include "cc/layers/layer_impl.h" 10 #include "cc/layers/layer_impl.h"
12 #include "cc/output/copy_output_request.h" 11 #include "cc/output/copy_output_request.h"
13 #include "cc/output/copy_output_result.h" 12 #include "cc/output/copy_output_result.h"
14 #include "cc/output/filter_operation.h" 13 #include "cc/output/filter_operation.h"
15 #include "cc/output/filter_operations.h" 14 #include "cc/output/filter_operations.h"
16 #include "cc/test/animation_test_common.h" 15 #include "cc/test/animation_test_common.h"
17 #include "cc/test/fake_impl_proxy.h" 16 #include "cc/test/fake_impl_proxy.h"
18 #include "cc/test/fake_layer_tree_host.h" 17 #include "cc/test/fake_layer_tree_host.h"
19 #include "cc/test/fake_layer_tree_host_impl.h" 18 #include "cc/test/fake_layer_tree_host_impl.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 } 68 }
70 69
71 private: 70 private:
72 bool override_opaque_contents_rect_; 71 bool override_opaque_contents_rect_;
73 gfx::Rect opaque_contents_rect_; 72 gfx::Rect opaque_contents_rect_;
74 }; 73 };
75 74
76 template <typename LayerType> 75 template <typename LayerType>
77 class TestOcclusionTrackerWithClip : public TestOcclusionTracker<LayerType> { 76 class TestOcclusionTrackerWithClip : public TestOcclusionTracker<LayerType> {
78 public: 77 public:
79 TestOcclusionTrackerWithClip(const gfx::Rect& viewport_rect,
80 bool record_metrics_for_frame)
81 : TestOcclusionTracker<LayerType>(viewport_rect,
82 record_metrics_for_frame) {}
83 explicit TestOcclusionTrackerWithClip(const gfx::Rect& viewport_rect) 78 explicit TestOcclusionTrackerWithClip(const gfx::Rect& viewport_rect)
84 : TestOcclusionTracker<LayerType>(viewport_rect, false) {} 79 : TestOcclusionTracker<LayerType>(viewport_rect) {}
85 80
86 bool OccludedLayer(const LayerType* layer, 81 bool OccludedLayer(const LayerType* layer,
87 const gfx::Rect& content_rect) const { 82 const gfx::Rect& content_rect) const {
88 DCHECK(layer->visible_content_rect().Contains(content_rect)); 83 DCHECK(layer->visible_content_rect().Contains(content_rect));
89 return this->Occluded( 84 return this->Occluded(
90 layer->render_target(), content_rect, layer->draw_transform()); 85 layer->render_target(), content_rect, layer->draw_transform());
91 } 86 }
92 87
93 // Gives an unoccluded sub-rect of |content_rect| in the content space of the 88 // Gives an unoccluded sub-rect of |content_rect| in the content space of the
94 // layer. Simple wrapper around UnoccludedContentRect. 89 // layer. Simple wrapper around UnoccludedContentRect.
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 typename Types::ContentLayerType* layer = 519 typename Types::ContentLayerType* layer =
525 this->CreateDrawingLayer(parent, 520 this->CreateDrawingLayer(parent,
526 this->identity_matrix, 521 this->identity_matrix,
527 gfx::PointF(30.f, 30.f), 522 gfx::PointF(30.f, 30.f),
528 gfx::Size(500, 500), 523 gfx::Size(500, 500),
529 true); 524 true);
530 parent->SetMasksToBounds(true); 525 parent->SetMasksToBounds(true);
531 this->CalcDrawEtc(root); 526 this->CalcDrawEtc(root);
532 527
533 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( 528 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
534 gfx::Rect(0, 0, 1000, 1000), false); 529 gfx::Rect(0, 0, 1000, 1000));
535 530
536 this->VisitLayer(layer, &occlusion); 531 this->VisitLayer(layer, &occlusion);
537 this->EnterLayer(parent, &occlusion); 532 this->EnterLayer(parent, &occlusion);
538 533
539 EXPECT_EQ(gfx::Rect().ToString(), 534 EXPECT_EQ(gfx::Rect().ToString(),
540 occlusion.occlusion_from_outside_target().ToString()); 535 occlusion.occlusion_from_outside_target().ToString());
541 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), 536 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(),
542 occlusion.occlusion_from_inside_target().ToString()); 537 occlusion.occlusion_from_inside_target().ToString());
543 538
544 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(30, 30, 70, 70))); 539 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(30, 30, 70, 70)));
(...skipping 3163 matching lines...) Expand 10 before | Expand all | Expand 10 after
3708 typename Types::ContentLayerType* root = this->CreateRoot( 3703 typename Types::ContentLayerType* root = this->CreateRoot(
3709 this->identity_matrix, gfx::Point(), gfx::Size(400, 400)); 3704 this->identity_matrix, gfx::Point(), gfx::Size(400, 400));
3710 typename Types::ContentLayerType* empty_layer = this->CreateDrawingLayer( 3705 typename Types::ContentLayerType* empty_layer = this->CreateDrawingLayer(
3711 root, this->identity_matrix, gfx::Point(), gfx::Size(200, 200), true); 3706 root, this->identity_matrix, gfx::Point(), gfx::Size(200, 200), true);
3712 this->SetDrawsContent(empty_layer, false); 3707 this->SetDrawsContent(empty_layer, false);
3713 empty_layer->SetTouchEventHandlerRegion(gfx::Rect(10, 10, 10, 10)); 3708 empty_layer->SetTouchEventHandlerRegion(gfx::Rect(10, 10, 10, 10));
3714 3709
3715 this->CalcDrawEtc(root); 3710 this->CalcDrawEtc(root);
3716 3711
3717 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( 3712 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
3718 gfx::Rect(0, 0, 1000, 1000), false); 3713 gfx::Rect(0, 0, 1000, 1000));
3719 3714
3720 this->VisitLayer(empty_layer, &occlusion); 3715 this->VisitLayer(empty_layer, &occlusion);
3721 3716
3722 EXPECT_EQ(gfx::Rect().ToString(), 3717 EXPECT_EQ(gfx::Rect().ToString(),
3723 occlusion.occlusion_from_outside_target().ToString()); 3718 occlusion.occlusion_from_outside_target().ToString());
3724 EXPECT_EQ(gfx::Rect().ToString(), 3719 EXPECT_EQ(gfx::Rect().ToString(),
3725 occlusion.occlusion_from_inside_target().ToString()); 3720 occlusion.occlusion_from_inside_target().ToString());
3726 } 3721 }
3727 }; 3722 };
3728 3723
3729 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestEmptyEventLayerDoesNotOcclude) 3724 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestEmptyEventLayerDoesNotOcclude)
3730 3725
3731 } // namespace 3726 } // namespace
3732 } // namespace cc 3727 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/occlusion_tracker_perftest.cc ('k') | cc/trees/quad_culler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698