| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |