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

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

Issue 576173003: cc: Move UnoccludedContentRect to Occlusion. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
OLDNEW
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/trees/occlusion_tracker.h" 5 #include "cc/trees/occlusion_tracker.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "cc/debug/lap_timer.h" 8 #include "cc/debug/lap_timer.h"
9 #include "cc/layers/layer_iterator.h" 9 #include "cc/layers/layer_iterator.h"
10 #include "cc/layers/solid_color_layer_impl.h" 10 #include "cc/layers/solid_color_layer_impl.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 LayerIteratorPosition<LayerImpl> pos = begin; 99 LayerIteratorPosition<LayerImpl> pos = begin;
100 100
101 // The opaque_layer adds occlusion over the whole viewport. 101 // The opaque_layer adds occlusion over the whole viewport.
102 tracker.EnterLayer(pos); 102 tracker.EnterLayer(pos);
103 tracker.LeaveLayer(pos); 103 tracker.LeaveLayer(pos);
104 104
105 gfx::Transform transform_to_target; 105 gfx::Transform transform_to_target;
106 transform_to_target.Translate(0, 96); 106 transform_to_target.Translate(0, 96);
107 107
108 do { 108 do {
109 Occlusion occlusion =
110 tracker.GetCurrentOcclusionForLayer(transform_to_target);
109 for (int x = 0; x < viewport_rect.width(); x += 256) { 111 for (int x = 0; x < viewport_rect.width(); x += 256) {
110 for (int y = 0; y < viewport_rect.height(); y += 256) { 112 for (int y = 0; y < viewport_rect.height(); y += 256) {
111 gfx::Rect query_content_rect(x, y, 256, 256); 113 gfx::Rect query_content_rect(x, y, 256, 256);
112 gfx::Rect unoccluded = tracker.UnoccludedContentRect( 114 gfx::Rect unoccluded =
113 query_content_rect, transform_to_target); 115 occlusion.GetUnoccludedContentRect(query_content_rect);
114 // Sanity test that we're not hitting early outs. 116 // Sanity test that we're not hitting early outs.
115 bool expect_empty = 117 bool expect_empty =
116 query_content_rect.right() <= viewport_rect.width() && 118 query_content_rect.right() <= viewport_rect.width() &&
117 query_content_rect.bottom() + 96 <= viewport_rect.height(); 119 query_content_rect.bottom() + 96 <= viewport_rect.height();
118 CHECK_EQ(expect_empty, unoccluded.IsEmpty()) 120 CHECK_EQ(expect_empty, unoccluded.IsEmpty())
119 << query_content_rect.ToString(); 121 << query_content_rect.ToString();
120 } 122 }
121 } 123 }
122 124
123 timer_.NextLap(); 125 timer_.NextLap();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 ++begin; 176 ++begin;
175 } 177 }
176 LayerIteratorPosition<LayerImpl> pos = begin; 178 LayerIteratorPosition<LayerImpl> pos = begin;
177 tracker.EnterLayer(pos); 179 tracker.EnterLayer(pos);
178 tracker.LeaveLayer(pos); 180 tracker.LeaveLayer(pos);
179 181
180 gfx::Transform transform_to_target; 182 gfx::Transform transform_to_target;
181 transform_to_target.Translate(0, 96); 183 transform_to_target.Translate(0, 96);
182 184
183 do { 185 do {
186 Occlusion occlusion =
187 tracker.GetCurrentOcclusionForLayer(transform_to_target);
184 for (int x = 0; x < viewport_rect.width(); x += 256) { 188 for (int x = 0; x < viewport_rect.width(); x += 256) {
185 for (int y = 0; y < viewport_rect.height(); y += 256) { 189 for (int y = 0; y < viewport_rect.height(); y += 256) {
186 gfx::Rect query_content_rect(x, y, 256, 256); 190 gfx::Rect query_content_rect(x, y, 256, 256);
187 gfx::Rect unoccluded = tracker.UnoccludedContentRect( 191 gfx::Rect unoccluded =
188 query_content_rect, transform_to_target); 192 occlusion.GetUnoccludedContentRect(query_content_rect);
189 } 193 }
190 } 194 }
191 195
192 timer_.NextLap(); 196 timer_.NextLap();
193 } while (!timer_.HasTimeLimitExpired()); 197 } while (!timer_.HasTimeLimitExpired());
194 198
195 ++begin; 199 ++begin;
196 LayerIteratorPosition<LayerImpl> next = begin; 200 LayerIteratorPosition<LayerImpl> next = begin;
197 EXPECT_EQ(active_tree()->root_layer(), next.current_layer); 201 EXPECT_EQ(active_tree()->root_layer(), next.current_layer);
198 202
199 ++begin; 203 ++begin;
200 EXPECT_EQ(end, begin); 204 EXPECT_EQ(end, begin);
201 205
202 PrintResults(); 206 PrintResults();
203 } 207 }
204 208
205 } // namespace 209 } // namespace
206 } // namespace cc 210 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698