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

Side by Side Diff: cc/quad_culler_unittest.cc

Issue 11369188: cc: Guard overdraw metrics behind the --trace-overdraw command-line flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: renderflags Created 8 years, 1 month 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/overdraw_metrics.cc ('k') | cc/settings.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 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/quad_culler.h" 5 #include "cc/quad_culler.h"
6 6
7 #include "cc/append_quads_data.h" 7 #include "cc/append_quads_data.h"
8 #include "cc/layer_tiling_data.h" 8 #include "cc/layer_tiling_data.h"
9 #include "cc/math_util.h" 9 #include "cc/math_util.h"
10 #include "cc/occlusion_tracker.h" 10 #include "cc/occlusion_tracker.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 214
215 scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, rootTransform, rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList); 215 scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, rootTransform, rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
216 scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTran sform, childRect, 1, true, gfx::Rect(), renderSurfaceLayerList); 216 scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTran sform, childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
217 TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000)) ; 217 TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000)) ;
218 LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList); 218 LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
219 219
220 appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracke r); 220 appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracke r);
221 appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker ); 221 appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker );
222 EXPECT_EQ(quadList.size(), 2u); 222 EXPECT_EQ(quadList.size(), 2u);
223 223
224 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 20000, 1 ); 224 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 20363, 1 );
225 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1); 225 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1);
226 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 0, 1); 226 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 0, 1);
227 } 227 }
228 228
229 TEST(QuadCullerTest, verifyCullCenterTileNonIntegralSize2) 229 TEST(QuadCullerTest, verifyCullCenterTileNonIntegralSize2)
230 { 230 {
231 DECLARE_AND_INITIALIZE_TEST_QUADS 231 DECLARE_AND_INITIALIZE_TEST_QUADS
232 232
233 // Make the child's quad slightly smaller than, and centred over, the root l ayer tile. 233 // Make the child's quad slightly smaller than, and centred over, the root l ayer tile.
234 // Verify the child does not cause the quad below to be culled due to roundi ng. 234 // Verify the child does not cause the quad below to be culled due to roundi ng.
235 childTransform.translate(100.1, 100.1); 235 childTransform.translate(100.1, 100.1);
236 childTransform.scale(0.982); 236 childTransform.scale(0.982);
237 237
238 WebTransformationMatrix rootTransform; 238 WebTransformationMatrix rootTransform;
239 rootTransform.translate(100, 100); 239 rootTransform.translate(100, 100);
240 240
241 rootRect = childRect = gfx::Rect(0, 0, 100, 100); 241 rootRect = childRect = gfx::Rect(0, 0, 100, 100);
242 242
243 scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, rootTransform, rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList); 243 scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, rootTransform, rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
244 scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTran sform, childRect, 1, true, gfx::Rect(), renderSurfaceLayerList); 244 scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTran sform, childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
245 TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000)) ; 245 TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000)) ;
246 LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList); 246 LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
247 247
248 appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracke r); 248 appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracke r);
249 appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker ); 249 appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker );
250 EXPECT_EQ(quadList.size(), 2u); 250 EXPECT_EQ(quadList.size(), 2u);
251 251
252 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 20000, 1 ); 252 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 19643, 1 );
253 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1); 253 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1);
254 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 0, 1); 254 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 0, 1);
255 } 255 }
256 256
257 TEST(QuadCullerTest, verifyCullChildLinesUpBottomRight) 257 TEST(QuadCullerTest, verifyCullChildLinesUpBottomRight)
258 { 258 {
259 DECLARE_AND_INITIALIZE_TEST_QUADS 259 DECLARE_AND_INITIALIZE_TEST_QUADS
260 260
261 childTransform.translate(100, 100); 261 childTransform.translate(100, 100);
262 262
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracke r); 459 appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracke r);
460 appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker ); 460 appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker );
461 EXPECT_EQ(quadList.size(), 9u); 461 EXPECT_EQ(quadList.size(), 9u);
462 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 0, 1); 462 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 0, 1);
463 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1); 463 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1);
464 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 0, 1); 464 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 0, 1);
465 } 465 }
466 466
467 } // namespace 467 } // namespace
468 } // namespace cc 468 } // namespace cc
OLDNEW
« no previous file with comments | « cc/overdraw_metrics.cc ('k') | cc/settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698