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 "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
6 #include "cc/layers/append_quads_data.h" | 6 #include "cc/layers/append_quads_data.h" |
7 #include "cc/output/gl_renderer.h" | 7 #include "cc/output/gl_renderer.h" |
8 #include "cc/quads/draw_quad.h" | 8 #include "cc/quads/draw_quad.h" |
9 #include "cc/quads/picture_draw_quad.h" | 9 #include "cc/quads/picture_draw_quad.h" |
10 #include "cc/quads/texture_draw_quad.h" | 10 #include "cc/quads/texture_draw_quad.h" |
(...skipping 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1409 RenderPassList pass_list; | 1409 RenderPassList pass_list; |
1410 pass_list.push_back(pass.Pass()); | 1410 pass_list.push_back(pass.Pass()); |
1411 | 1411 |
1412 EXPECT_TRUE(this->RunPixelTest( | 1412 EXPECT_TRUE(this->RunPixelTest( |
1413 &pass_list, | 1413 &pass_list, |
1414 PixelTest::NoOffscreenContext, | 1414 PixelTest::NoOffscreenContext, |
1415 base::FilePath(FILE_PATH_LITERAL("green_with_blue_corner.png")), | 1415 base::FilePath(FILE_PATH_LITERAL("green_with_blue_corner.png")), |
1416 ExactPixelComparator(true))); | 1416 ExactPixelComparator(true))); |
1417 } | 1417 } |
1418 | 1418 |
| 1419 // Not WithSkiaGPUBackend since that path currently requires tiles for opacity. |
| 1420 TYPED_TEST(RendererPixelTest, PictureDrawQuadOpacity) { |
| 1421 gfx::Size pile_tile_size(1000, 1000); |
| 1422 gfx::Rect viewport(this->device_viewport_size_); |
| 1423 bool use_skia_gpu_backend = this->UseSkiaGPUBackend(); |
| 1424 bool contents_swizzled = !PlatformColor::SameComponentOrder(GL_RGBA); |
| 1425 |
| 1426 RenderPass::Id id(1, 1); |
| 1427 gfx::Transform transform_to_root; |
| 1428 scoped_ptr<RenderPass> pass = |
| 1429 CreateTestRenderPass(id, viewport, transform_to_root); |
| 1430 |
| 1431 // One viewport-filling 0.5-opacity green quad. |
| 1432 scoped_refptr<FakePicturePileImpl> green_pile = |
| 1433 FakePicturePileImpl::CreateFilledPile(pile_tile_size, viewport.size()); |
| 1434 SkPaint green_paint; |
| 1435 green_paint.setColor(SK_ColorGREEN); |
| 1436 green_pile->add_draw_rect_with_paint(viewport, green_paint); |
| 1437 green_pile->RerecordPile(); |
| 1438 |
| 1439 gfx::Transform green_content_to_target_transform; |
| 1440 scoped_ptr<SharedQuadState> green_shared_state = |
| 1441 CreateTestSharedQuadState(green_content_to_target_transform, viewport); |
| 1442 green_shared_state->opacity = 0.5f; |
| 1443 |
| 1444 scoped_ptr<PictureDrawQuad> green_quad = PictureDrawQuad::Create(); |
| 1445 green_quad->SetNew(green_shared_state.get(), |
| 1446 viewport, |
| 1447 gfx::Rect(), |
| 1448 gfx::RectF(0, 0, 1, 1), |
| 1449 viewport.size(), |
| 1450 contents_swizzled, |
| 1451 viewport, |
| 1452 1.f, |
| 1453 use_skia_gpu_backend, |
| 1454 green_pile); |
| 1455 pass->quad_list.push_back(green_quad.PassAs<DrawQuad>()); |
| 1456 |
| 1457 // One viewport-filling white quad. |
| 1458 scoped_refptr<FakePicturePileImpl> white_pile = |
| 1459 FakePicturePileImpl::CreateFilledPile(pile_tile_size, viewport.size()); |
| 1460 SkPaint white_paint; |
| 1461 white_paint.setColor(SK_ColorWHITE); |
| 1462 white_pile->add_draw_rect_with_paint(viewport, white_paint); |
| 1463 white_pile->RerecordPile(); |
| 1464 |
| 1465 gfx::Transform white_content_to_target_transform; |
| 1466 scoped_ptr<SharedQuadState> white_shared_state = |
| 1467 CreateTestSharedQuadState(white_content_to_target_transform, viewport); |
| 1468 |
| 1469 scoped_ptr<PictureDrawQuad> white_quad = PictureDrawQuad::Create(); |
| 1470 white_quad->SetNew(white_shared_state.get(), |
| 1471 viewport, |
| 1472 gfx::Rect(), |
| 1473 gfx::RectF(0, 0, 1, 1), |
| 1474 viewport.size(), |
| 1475 contents_swizzled, |
| 1476 viewport, |
| 1477 1.f, |
| 1478 use_skia_gpu_backend, |
| 1479 white_pile); |
| 1480 pass->quad_list.push_back(white_quad.PassAs<DrawQuad>()); |
| 1481 |
| 1482 RenderPassList pass_list; |
| 1483 pass_list.push_back(pass.Pass()); |
| 1484 |
| 1485 EXPECT_TRUE(this->RunPixelTest( |
| 1486 &pass_list, |
| 1487 PixelTest::NoOffscreenContext, |
| 1488 base::FilePath(FILE_PATH_LITERAL("green_alpha.png")), |
| 1489 FuzzyPixelOffByOneComparator(true))); |
| 1490 } |
| 1491 |
1419 TYPED_TEST(RendererPixelTestWithSkiaGPUBackend, | 1492 TYPED_TEST(RendererPixelTestWithSkiaGPUBackend, |
1420 PictureDrawQuadNonIdentityScale) { | 1493 PictureDrawQuadNonIdentityScale) { |
1421 gfx::Size pile_tile_size(1000, 1000); | 1494 gfx::Size pile_tile_size(1000, 1000); |
1422 gfx::Rect viewport(this->device_viewport_size_); | 1495 gfx::Rect viewport(this->device_viewport_size_); |
1423 bool use_skia_gpu_backend = this->UseSkiaGPUBackend(); | 1496 bool use_skia_gpu_backend = this->UseSkiaGPUBackend(); |
1424 // TODO(enne): the renderer should figure this out on its own. | 1497 // TODO(enne): the renderer should figure this out on its own. |
1425 bool contents_swizzled = !PlatformColor::SameComponentOrder(GL_RGBA); | 1498 bool contents_swizzled = !PlatformColor::SameComponentOrder(GL_RGBA); |
1426 | 1499 |
1427 RenderPass::Id id(1, 1); | 1500 RenderPass::Id id(1, 1); |
1428 gfx::Transform transform_to_root; | 1501 gfx::Transform transform_to_root; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1565 EXPECT_TRUE(this->RunPixelTest( | 1638 EXPECT_TRUE(this->RunPixelTest( |
1566 &pass_list, | 1639 &pass_list, |
1567 PixelTest::NoOffscreenContext, | 1640 PixelTest::NoOffscreenContext, |
1568 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), | 1641 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), |
1569 ExactPixelComparator(true))); | 1642 ExactPixelComparator(true))); |
1570 } | 1643 } |
1571 #endif // !defined(OS_ANDROID) | 1644 #endif // !defined(OS_ANDROID) |
1572 | 1645 |
1573 } // namespace | 1646 } // namespace |
1574 } // namespace cc | 1647 } // namespace cc |
OLD | NEW |