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

Side by Side Diff: cc/quad_culler_unittest.cc

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

Powered by Google App Engine
This is Rietveld 408576698