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

Side by Side Diff: Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp

Issue 10383299: Merge 117645 - [chromium] add back-face visibility check for renderSurfaces (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
Patch Set: Created 8 years, 7 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
« no previous file with comments | « Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp ('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 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 1318
1319 EXPECT_FALSE(child2->visibleLayerRect().isEmpty()); 1319 EXPECT_FALSE(child2->visibleLayerRect().isEmpty());
1320 1320
1321 // But if the back face is visible, then the visibleLayerRect should be empt y. 1321 // But if the back face is visible, then the visibleLayerRect should be empt y.
1322 EXPECT_TRUE(animatingChild->visibleLayerRect().isEmpty()); 1322 EXPECT_TRUE(animatingChild->visibleLayerRect().isEmpty());
1323 EXPECT_TRUE(animatingSurface->visibleLayerRect().isEmpty()); 1323 EXPECT_TRUE(animatingSurface->visibleLayerRect().isEmpty());
1324 // And any layers in the subtree should not be considered visible either. 1324 // And any layers in the subtree should not be considered visible either.
1325 EXPECT_TRUE(childOfAnimatingSurface->visibleLayerRect().isEmpty()); 1325 EXPECT_TRUE(childOfAnimatingSurface->visibleLayerRect().isEmpty());
1326 } 1326 }
1327 1327
1328 TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3dForFlattenin gSurface)
1329 {
1330 // Verify the behavior of back-face culling for a renderSurface that is crea ted
1331 // when it flattens its subtree, and its parent has preserves-3d.
1332
1333 const TransformationMatrix identityMatrix;
1334 RefPtr<LayerChromium> parent = LayerChromium::create();
1335 RefPtr<LayerChromiumWithForcedDrawsContent> frontFacingSurface = adoptRef(ne w LayerChromiumWithForcedDrawsContent());
1336 RefPtr<LayerChromiumWithForcedDrawsContent> backFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent());
1337 RefPtr<LayerChromiumWithForcedDrawsContent> child1 = adoptRef(new LayerChrom iumWithForcedDrawsContent());
1338 RefPtr<LayerChromiumWithForcedDrawsContent> child2 = adoptRef(new LayerChrom iumWithForcedDrawsContent());
1339
1340 parent->createRenderSurface();
1341 parent->addChild(frontFacingSurface);
1342 parent->addChild(backFacingSurface);
1343 frontFacingSurface->addChild(child1);
1344 backFacingSurface->addChild(child2);
1345
1346 // RenderSurfaces are not double-sided
1347 frontFacingSurface->setDoubleSided(false);
1348 backFacingSurface->setDoubleSided(false);
1349
1350 TransformationMatrix backfaceMatrix;
1351 backfaceMatrix.translate(50, 50);
1352 backfaceMatrix.rotate3d(0, 1, 0, 180);
1353 backfaceMatrix.translate(-50, -50);
1354
1355 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, F loatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); // parent transform style is preserve3d.
1356 setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, ident ityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); // sur face transform style is flat.
1357 setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, ident ityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); // sur face transform style is flat.
1358 setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, F loatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
1359 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, F loatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
1360
1361 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
1362 Vector<RefPtr<LayerChromium> > dummyLayerList;
1363 int dummyMaxTextureSize = 512;
1364 parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds() ));
1365 parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
1366 renderSurfaceLayerList.append(parent.get());
1367
1368 CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), pa rent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerLi st, dummyMaxTextureSize);
1369
1370 // Verify which renderSurfaces were created.
1371 EXPECT_TRUE(frontFacingSurface->renderSurface());
1372 EXPECT_FALSE(backFacingSurface->renderSurface()); // because it should be cu lled
1373 EXPECT_FALSE(child1->renderSurface());
1374 EXPECT_FALSE(child2->renderSurface());
1375
1376 // Verify the renderSurfaceLayerList. The back-facing surface should be cull ed.
1377 ASSERT_EQ(2u, renderSurfaceLayerList.size());
1378 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id());
1379 EXPECT_EQ(frontFacingSurface->id(), renderSurfaceLayerList[1]->id());
1380
1381 // Verify root surface's layerList.
1382 ASSERT_EQ(1u, renderSurfaceLayerList[0]->renderSurface()->layerList().size() );
1383 EXPECT_EQ(frontFacingSurface->id(), renderSurfaceLayerList[0]->renderSurface ()->layerList()[0]->id());
1384
1385 // Verify frontFacingSurface's layerList.
1386 ASSERT_EQ(2u, renderSurfaceLayerList[1]->renderSurface()->layerList().size() );
1387 EXPECT_EQ(frontFacingSurface->id(), renderSurfaceLayerList[1]->renderSurface ()->layerList()[0]->id());
1388 EXPECT_EQ(child1->id(), renderSurfaceLayerList[1]->renderSurface()->layerLis t()[1]->id());
1389 }
1390
1328 // FIXME: 1391 // FIXME:
1329 // continue working on https://bugs.webkit.org/show_bug.cgi?id=68942 1392 // continue working on https://bugs.webkit.org/show_bug.cgi?id=68942
1330 // - add a test to verify clipping that changes the "center point" 1393 // - add a test to verify clipping that changes the "center point"
1331 // - add a case that checks if a render surface's drawTransform is computed cor rectly. For the general case, and for special cases when clipping. 1394 // - add a case that checks if a render surface's drawTransform is computed cor rectly. For the general case, and for special cases when clipping.
1332 // - add a case that checks if a render surface's replicaTransform is computed correctly. 1395 // - add a case that checks if a render surface's replicaTransform is computed correctly.
1333 // - test all the conditions under which render surfaces are created 1396 // - test all the conditions under which render surfaces are created
1334 // - if possible, test all conditions under which render surfaces are not creat ed 1397 // - if possible, test all conditions under which render surfaces are not creat ed
1335 // - verify that the layer lists of render surfaces are correct, verify that "t argetRenderSurface" values for each layer are correct. 1398 // - verify that the layer lists of render surfaces are correct, verify that "t argetRenderSurface" values for each layer are correct.
1336 // - test the computation of clip rects and content rects 1399 // - test the computation of clip rects and content rects
1337 // - test the special cases for mask layers and replica layers 1400 // - test the special cases for mask layers and replica layers
1338 // - test the other functions in CCLayerTreeHostCommon 1401 // - test the other functions in CCLayerTreeHostCommon
1339 // 1402 //
1340 1403
1341 } // namespace 1404 } // namespace
OLDNEW
« no previous file with comments | « Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698