| 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" |
| 11 #include "cc/resources/platform_color.h" | |
| 12 #include "cc/resources/sync_point_helper.h" | 11 #include "cc/resources/sync_point_helper.h" |
| 13 #include "cc/test/fake_picture_pile_impl.h" | 12 #include "cc/test/fake_picture_pile_impl.h" |
| 14 #include "cc/test/pixel_test.h" | 13 #include "cc/test/pixel_test.h" |
| 15 #include "gpu/GLES2/gl2extchromium.h" | 14 #include "gpu/GLES2/gl2extchromium.h" |
| 16 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 15 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
| 17 #include "third_party/skia/include/core/SkImageFilter.h" | 16 #include "third_party/skia/include/core/SkImageFilter.h" |
| 18 #include "third_party/skia/include/core/SkMatrix.h" | 17 #include "third_party/skia/include/core/SkMatrix.h" |
| 19 #include "third_party/skia/include/effects/SkColorFilterImageFilter.h" | 18 #include "third_party/skia/include/effects/SkColorFilterImageFilter.h" |
| 20 #include "third_party/skia/include/effects/SkColorMatrixFilter.h" | 19 #include "third_party/skia/include/effects/SkColorMatrixFilter.h" |
| 21 #include "ui/gfx/rect_conversions.h" | 20 #include "ui/gfx/rect_conversions.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 SharedQuadState* shared_state, | 103 SharedQuadState* shared_state, |
| 105 ResourceProvider* resource_provider) { | 104 ResourceProvider* resource_provider) { |
| 106 SkPMColor pixel_color = premultiplied_alpha ? | 105 SkPMColor pixel_color = premultiplied_alpha ? |
| 107 SkPreMultiplyColor(texel_color) : | 106 SkPreMultiplyColor(texel_color) : |
| 108 SkPackARGB32NoCheck(SkColorGetA(texel_color), | 107 SkPackARGB32NoCheck(SkColorGetA(texel_color), |
| 109 SkColorGetR(texel_color), | 108 SkColorGetR(texel_color), |
| 110 SkColorGetG(texel_color), | 109 SkColorGetG(texel_color), |
| 111 SkColorGetB(texel_color)); | 110 SkColorGetB(texel_color)); |
| 112 std::vector<uint32_t> pixels(rect.size().GetArea(), pixel_color); | 111 std::vector<uint32_t> pixels(rect.size().GetArea(), pixel_color); |
| 113 | 112 |
| 114 ResourceProvider::ResourceId resource = resource_provider->CreateResource( | 113 ResourceProvider::ResourceId resource = |
| 115 rect.size(), GL_RGBA, GL_CLAMP_TO_EDGE, | 114 resource_provider->CreateResource(rect.size(), |
| 116 ResourceProvider::TextureUsageAny); | 115 GL_CLAMP_TO_EDGE, |
| 116 ResourceProvider::TextureUsageAny, |
| 117 RGBA_8888); |
| 117 resource_provider->SetPixels( | 118 resource_provider->SetPixels( |
| 118 resource, | 119 resource, |
| 119 reinterpret_cast<uint8_t*>(&pixels.front()), | 120 reinterpret_cast<uint8_t*>(&pixels.front()), |
| 120 rect, | 121 rect, |
| 121 rect, | 122 rect, |
| 122 gfx::Vector2d()); | 123 gfx::Vector2d()); |
| 123 | 124 |
| 124 float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; | 125 float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; |
| 125 | 126 |
| 126 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create(); | 127 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create(); |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 class VideoGLRendererPixelTest : public GLRendererPixelTest { | 403 class VideoGLRendererPixelTest : public GLRendererPixelTest { |
| 403 protected: | 404 protected: |
| 404 scoped_ptr<YUVVideoDrawQuad> CreateTestYUVVideoDrawQuad( | 405 scoped_ptr<YUVVideoDrawQuad> CreateTestYUVVideoDrawQuad( |
| 405 SharedQuadState* shared_state, bool with_alpha, bool is_transparent) { | 406 SharedQuadState* shared_state, bool with_alpha, bool is_transparent) { |
| 406 gfx::Rect rect(this->device_viewport_size_); | 407 gfx::Rect rect(this->device_viewport_size_); |
| 407 gfx::Rect opaque_rect(0, 0, 0, 0); | 408 gfx::Rect opaque_rect(0, 0, 0, 0); |
| 408 | 409 |
| 409 ResourceProvider::ResourceId y_resource = | 410 ResourceProvider::ResourceId y_resource = |
| 410 resource_provider_->CreateResource( | 411 resource_provider_->CreateResource( |
| 411 this->device_viewport_size_, | 412 this->device_viewport_size_, |
| 412 GL_LUMINANCE, | |
| 413 GL_CLAMP_TO_EDGE, | 413 GL_CLAMP_TO_EDGE, |
| 414 ResourceProvider::TextureUsageAny); | 414 ResourceProvider::TextureUsageAny, |
| 415 LUMINANCE_8); |
| 415 ResourceProvider::ResourceId u_resource = | 416 ResourceProvider::ResourceId u_resource = |
| 416 resource_provider_->CreateResource( | 417 resource_provider_->CreateResource( |
| 417 this->device_viewport_size_, | 418 this->device_viewport_size_, |
| 418 GL_LUMINANCE, | |
| 419 GL_CLAMP_TO_EDGE, | 419 GL_CLAMP_TO_EDGE, |
| 420 ResourceProvider::TextureUsageAny); | 420 ResourceProvider::TextureUsageAny, |
| 421 LUMINANCE_8); |
| 421 ResourceProvider::ResourceId v_resource = | 422 ResourceProvider::ResourceId v_resource = |
| 422 resource_provider_->CreateResource( | 423 resource_provider_->CreateResource( |
| 423 this->device_viewport_size_, | 424 this->device_viewport_size_, |
| 424 GL_LUMINANCE, | |
| 425 GL_CLAMP_TO_EDGE, | 425 GL_CLAMP_TO_EDGE, |
| 426 ResourceProvider::TextureUsageAny); | 426 ResourceProvider::TextureUsageAny, |
| 427 LUMINANCE_8); |
| 427 ResourceProvider::ResourceId a_resource = 0; | 428 ResourceProvider::ResourceId a_resource = 0; |
| 428 if (with_alpha) { | 429 if (with_alpha) { |
| 429 a_resource = resource_provider_->CreateResource( | 430 a_resource = resource_provider_->CreateResource( |
| 430 this->device_viewport_size_, | 431 this->device_viewport_size_, |
| 431 GL_LUMINANCE, | |
| 432 GL_CLAMP_TO_EDGE, | 432 GL_CLAMP_TO_EDGE, |
| 433 ResourceProvider::TextureUsageAny); | 433 ResourceProvider::TextureUsageAny, |
| 434 LUMINANCE_8); |
| 434 } | 435 } |
| 435 | 436 |
| 436 int w = this->device_viewport_size_.width(); | 437 int w = this->device_viewport_size_.width(); |
| 437 int h = this->device_viewport_size_.height(); | 438 int h = this->device_viewport_size_.height(); |
| 438 const int y_plane_size = w * h; | 439 const int y_plane_size = w * h; |
| 439 gfx::Rect uv_rect((w + 1) / 2, (h + 1) / 2); | 440 gfx::Rect uv_rect((w + 1) / 2, (h + 1) / 2); |
| 440 const int uv_plane_size = uv_rect.size().GetArea(); | 441 const int uv_plane_size = uv_rect.size().GetArea(); |
| 441 scoped_ptr<uint8_t[]> y_plane(new uint8_t[y_plane_size]); | 442 scoped_ptr<uint8_t[]> y_plane(new uint8_t[y_plane_size]); |
| 442 scoped_ptr<uint8_t[]> u_plane(new uint8_t[uv_plane_size]); | 443 scoped_ptr<uint8_t[]> u_plane(new uint8_t[uv_plane_size]); |
| 443 scoped_ptr<uint8_t[]> v_plane(new uint8_t[uv_plane_size]); | 444 scoped_ptr<uint8_t[]> v_plane(new uint8_t[uv_plane_size]); |
| (...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1359 PixelTest::NoOffscreenContext, | 1360 PixelTest::NoOffscreenContext, |
| 1360 base::FilePath(FILE_PATH_LITERAL("anti_aliasing_perspective.png")), | 1361 base::FilePath(FILE_PATH_LITERAL("anti_aliasing_perspective.png")), |
| 1361 FuzzyPixelOffByOneComparator(true))); | 1362 FuzzyPixelOffByOneComparator(true))); |
| 1362 } | 1363 } |
| 1363 | 1364 |
| 1364 TYPED_TEST(RendererPixelTestWithSkiaGPUBackend, PictureDrawQuadIdentityScale) { | 1365 TYPED_TEST(RendererPixelTestWithSkiaGPUBackend, PictureDrawQuadIdentityScale) { |
| 1365 gfx::Size pile_tile_size(1000, 1000); | 1366 gfx::Size pile_tile_size(1000, 1000); |
| 1366 gfx::Rect viewport(this->device_viewport_size_); | 1367 gfx::Rect viewport(this->device_viewport_size_); |
| 1367 bool use_skia_gpu_backend = this->UseSkiaGPUBackend(); | 1368 bool use_skia_gpu_backend = this->UseSkiaGPUBackend(); |
| 1368 // TODO(enne): the renderer should figure this out on its own. | 1369 // TODO(enne): the renderer should figure this out on its own. |
| 1369 bool contents_swizzled = !PlatformColor::SameComponentOrder(GL_RGBA); | 1370 ResourceFormat texture_format = RGBA_8888; |
| 1370 | 1371 |
| 1371 RenderPass::Id id(1, 1); | 1372 RenderPass::Id id(1, 1); |
| 1372 gfx::Transform transform_to_root; | 1373 gfx::Transform transform_to_root; |
| 1373 scoped_ptr<RenderPass> pass = | 1374 scoped_ptr<RenderPass> pass = |
| 1374 CreateTestRenderPass(id, viewport, transform_to_root); | 1375 CreateTestRenderPass(id, viewport, transform_to_root); |
| 1375 | 1376 |
| 1376 // One clipped blue quad in the lower right corner. Outside the clip | 1377 // One clipped blue quad in the lower right corner. Outside the clip |
| 1377 // is red, which should not appear. | 1378 // is red, which should not appear. |
| 1378 gfx::Rect blue_rect(gfx::Size(100, 100)); | 1379 gfx::Rect blue_rect(gfx::Size(100, 100)); |
| 1379 gfx::Rect blue_clip_rect(gfx::Point(50, 50), gfx::Size(50, 50)); | 1380 gfx::Rect blue_clip_rect(gfx::Point(50, 50), gfx::Size(50, 50)); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1397 blue_rect, | 1398 blue_rect, |
| 1398 gfx::ToEnclosingRect(blue_scissor_rect)); | 1399 gfx::ToEnclosingRect(blue_scissor_rect)); |
| 1399 | 1400 |
| 1400 scoped_ptr<PictureDrawQuad> blue_quad = PictureDrawQuad::Create(); | 1401 scoped_ptr<PictureDrawQuad> blue_quad = PictureDrawQuad::Create(); |
| 1401 | 1402 |
| 1402 blue_quad->SetNew(blue_shared_state.get(), | 1403 blue_quad->SetNew(blue_shared_state.get(), |
| 1403 viewport, // Intentionally bigger than clip. | 1404 viewport, // Intentionally bigger than clip. |
| 1404 gfx::Rect(), | 1405 gfx::Rect(), |
| 1405 viewport, | 1406 viewport, |
| 1406 viewport.size(), | 1407 viewport.size(), |
| 1407 contents_swizzled, | 1408 texture_format, |
| 1408 viewport, | 1409 viewport, |
| 1409 1.f, | 1410 1.f, |
| 1410 use_skia_gpu_backend, | 1411 use_skia_gpu_backend, |
| 1411 blue_pile); | 1412 blue_pile); |
| 1412 pass->quad_list.push_back(blue_quad.PassAs<DrawQuad>()); | 1413 pass->quad_list.push_back(blue_quad.PassAs<DrawQuad>()); |
| 1413 | 1414 |
| 1414 // One viewport-filling green quad. | 1415 // One viewport-filling green quad. |
| 1415 scoped_refptr<FakePicturePileImpl> green_pile = | 1416 scoped_refptr<FakePicturePileImpl> green_pile = |
| 1416 FakePicturePileImpl::CreateFilledPile(pile_tile_size, viewport.size()); | 1417 FakePicturePileImpl::CreateFilledPile(pile_tile_size, viewport.size()); |
| 1417 SkPaint green_paint; | 1418 SkPaint green_paint; |
| 1418 green_paint.setColor(SK_ColorGREEN); | 1419 green_paint.setColor(SK_ColorGREEN); |
| 1419 green_pile->add_draw_rect_with_paint(viewport, green_paint); | 1420 green_pile->add_draw_rect_with_paint(viewport, green_paint); |
| 1420 green_pile->RerecordPile(); | 1421 green_pile->RerecordPile(); |
| 1421 | 1422 |
| 1422 gfx::Transform green_content_to_target_transform; | 1423 gfx::Transform green_content_to_target_transform; |
| 1423 scoped_ptr<SharedQuadState> green_shared_state = | 1424 scoped_ptr<SharedQuadState> green_shared_state = |
| 1424 CreateTestSharedQuadState(green_content_to_target_transform, viewport); | 1425 CreateTestSharedQuadState(green_content_to_target_transform, viewport); |
| 1425 | 1426 |
| 1426 scoped_ptr<PictureDrawQuad> green_quad = PictureDrawQuad::Create(); | 1427 scoped_ptr<PictureDrawQuad> green_quad = PictureDrawQuad::Create(); |
| 1427 green_quad->SetNew(green_shared_state.get(), | 1428 green_quad->SetNew(green_shared_state.get(), |
| 1428 viewport, | 1429 viewport, |
| 1429 gfx::Rect(), | 1430 gfx::Rect(), |
| 1430 gfx::RectF(0.f, 0.f, 1.f, 1.f), | 1431 gfx::RectF(0.f, 0.f, 1.f, 1.f), |
| 1431 viewport.size(), | 1432 viewport.size(), |
| 1432 contents_swizzled, | 1433 texture_format, |
| 1433 viewport, | 1434 viewport, |
| 1434 1.f, | 1435 1.f, |
| 1435 use_skia_gpu_backend, | 1436 use_skia_gpu_backend, |
| 1436 green_pile); | 1437 green_pile); |
| 1437 pass->quad_list.push_back(green_quad.PassAs<DrawQuad>()); | 1438 pass->quad_list.push_back(green_quad.PassAs<DrawQuad>()); |
| 1438 | 1439 |
| 1439 RenderPassList pass_list; | 1440 RenderPassList pass_list; |
| 1440 pass_list.push_back(pass.Pass()); | 1441 pass_list.push_back(pass.Pass()); |
| 1441 | 1442 |
| 1442 EXPECT_TRUE(this->RunPixelTest( | 1443 EXPECT_TRUE(this->RunPixelTest( |
| 1443 &pass_list, | 1444 &pass_list, |
| 1444 PixelTest::NoOffscreenContext, | 1445 PixelTest::NoOffscreenContext, |
| 1445 base::FilePath(FILE_PATH_LITERAL("green_with_blue_corner.png")), | 1446 base::FilePath(FILE_PATH_LITERAL("green_with_blue_corner.png")), |
| 1446 ExactPixelComparator(true))); | 1447 ExactPixelComparator(true))); |
| 1447 } | 1448 } |
| 1448 | 1449 |
| 1449 // Not WithSkiaGPUBackend since that path currently requires tiles for opacity. | 1450 // Not WithSkiaGPUBackend since that path currently requires tiles for opacity. |
| 1450 TYPED_TEST(RendererPixelTest, PictureDrawQuadOpacity) { | 1451 TYPED_TEST(RendererPixelTest, PictureDrawQuadOpacity) { |
| 1451 gfx::Size pile_tile_size(1000, 1000); | 1452 gfx::Size pile_tile_size(1000, 1000); |
| 1452 gfx::Rect viewport(this->device_viewport_size_); | 1453 gfx::Rect viewport(this->device_viewport_size_); |
| 1453 bool use_skia_gpu_backend = this->UseSkiaGPUBackend(); | 1454 bool use_skia_gpu_backend = this->UseSkiaGPUBackend(); |
| 1454 bool contents_swizzled = !PlatformColor::SameComponentOrder(GL_RGBA); | 1455 ResourceFormat texture_format = RGBA_8888; |
| 1455 | 1456 |
| 1456 RenderPass::Id id(1, 1); | 1457 RenderPass::Id id(1, 1); |
| 1457 gfx::Transform transform_to_root; | 1458 gfx::Transform transform_to_root; |
| 1458 scoped_ptr<RenderPass> pass = | 1459 scoped_ptr<RenderPass> pass = |
| 1459 CreateTestRenderPass(id, viewport, transform_to_root); | 1460 CreateTestRenderPass(id, viewport, transform_to_root); |
| 1460 | 1461 |
| 1461 // One viewport-filling 0.5-opacity green quad. | 1462 // One viewport-filling 0.5-opacity green quad. |
| 1462 scoped_refptr<FakePicturePileImpl> green_pile = | 1463 scoped_refptr<FakePicturePileImpl> green_pile = |
| 1463 FakePicturePileImpl::CreateFilledPile(pile_tile_size, viewport.size()); | 1464 FakePicturePileImpl::CreateFilledPile(pile_tile_size, viewport.size()); |
| 1464 SkPaint green_paint; | 1465 SkPaint green_paint; |
| 1465 green_paint.setColor(SK_ColorGREEN); | 1466 green_paint.setColor(SK_ColorGREEN); |
| 1466 green_pile->add_draw_rect_with_paint(viewport, green_paint); | 1467 green_pile->add_draw_rect_with_paint(viewport, green_paint); |
| 1467 green_pile->RerecordPile(); | 1468 green_pile->RerecordPile(); |
| 1468 | 1469 |
| 1469 gfx::Transform green_content_to_target_transform; | 1470 gfx::Transform green_content_to_target_transform; |
| 1470 scoped_ptr<SharedQuadState> green_shared_state = | 1471 scoped_ptr<SharedQuadState> green_shared_state = |
| 1471 CreateTestSharedQuadState(green_content_to_target_transform, viewport); | 1472 CreateTestSharedQuadState(green_content_to_target_transform, viewport); |
| 1472 green_shared_state->opacity = 0.5f; | 1473 green_shared_state->opacity = 0.5f; |
| 1473 | 1474 |
| 1474 scoped_ptr<PictureDrawQuad> green_quad = PictureDrawQuad::Create(); | 1475 scoped_ptr<PictureDrawQuad> green_quad = PictureDrawQuad::Create(); |
| 1475 green_quad->SetNew(green_shared_state.get(), | 1476 green_quad->SetNew(green_shared_state.get(), |
| 1476 viewport, | 1477 viewport, |
| 1477 gfx::Rect(), | 1478 gfx::Rect(), |
| 1478 gfx::RectF(0, 0, 1, 1), | 1479 gfx::RectF(0, 0, 1, 1), |
| 1479 viewport.size(), | 1480 viewport.size(), |
| 1480 contents_swizzled, | 1481 texture_format, |
| 1481 viewport, | 1482 viewport, |
| 1482 1.f, | 1483 1.f, |
| 1483 use_skia_gpu_backend, | 1484 use_skia_gpu_backend, |
| 1484 green_pile); | 1485 green_pile); |
| 1485 pass->quad_list.push_back(green_quad.PassAs<DrawQuad>()); | 1486 pass->quad_list.push_back(green_quad.PassAs<DrawQuad>()); |
| 1486 | 1487 |
| 1487 // One viewport-filling white quad. | 1488 // One viewport-filling white quad. |
| 1488 scoped_refptr<FakePicturePileImpl> white_pile = | 1489 scoped_refptr<FakePicturePileImpl> white_pile = |
| 1489 FakePicturePileImpl::CreateFilledPile(pile_tile_size, viewport.size()); | 1490 FakePicturePileImpl::CreateFilledPile(pile_tile_size, viewport.size()); |
| 1490 SkPaint white_paint; | 1491 SkPaint white_paint; |
| 1491 white_paint.setColor(SK_ColorWHITE); | 1492 white_paint.setColor(SK_ColorWHITE); |
| 1492 white_pile->add_draw_rect_with_paint(viewport, white_paint); | 1493 white_pile->add_draw_rect_with_paint(viewport, white_paint); |
| 1493 white_pile->RerecordPile(); | 1494 white_pile->RerecordPile(); |
| 1494 | 1495 |
| 1495 gfx::Transform white_content_to_target_transform; | 1496 gfx::Transform white_content_to_target_transform; |
| 1496 scoped_ptr<SharedQuadState> white_shared_state = | 1497 scoped_ptr<SharedQuadState> white_shared_state = |
| 1497 CreateTestSharedQuadState(white_content_to_target_transform, viewport); | 1498 CreateTestSharedQuadState(white_content_to_target_transform, viewport); |
| 1498 | 1499 |
| 1499 scoped_ptr<PictureDrawQuad> white_quad = PictureDrawQuad::Create(); | 1500 scoped_ptr<PictureDrawQuad> white_quad = PictureDrawQuad::Create(); |
| 1500 white_quad->SetNew(white_shared_state.get(), | 1501 white_quad->SetNew(white_shared_state.get(), |
| 1501 viewport, | 1502 viewport, |
| 1502 gfx::Rect(), | 1503 gfx::Rect(), |
| 1503 gfx::RectF(0, 0, 1, 1), | 1504 gfx::RectF(0, 0, 1, 1), |
| 1504 viewport.size(), | 1505 viewport.size(), |
| 1505 contents_swizzled, | 1506 texture_format, |
| 1506 viewport, | 1507 viewport, |
| 1507 1.f, | 1508 1.f, |
| 1508 use_skia_gpu_backend, | 1509 use_skia_gpu_backend, |
| 1509 white_pile); | 1510 white_pile); |
| 1510 pass->quad_list.push_back(white_quad.PassAs<DrawQuad>()); | 1511 pass->quad_list.push_back(white_quad.PassAs<DrawQuad>()); |
| 1511 | 1512 |
| 1512 RenderPassList pass_list; | 1513 RenderPassList pass_list; |
| 1513 pass_list.push_back(pass.Pass()); | 1514 pass_list.push_back(pass.Pass()); |
| 1514 | 1515 |
| 1515 EXPECT_TRUE(this->RunPixelTest( | 1516 EXPECT_TRUE(this->RunPixelTest( |
| 1516 &pass_list, | 1517 &pass_list, |
| 1517 PixelTest::NoOffscreenContext, | 1518 PixelTest::NoOffscreenContext, |
| 1518 base::FilePath(FILE_PATH_LITERAL("green_alpha.png")), | 1519 base::FilePath(FILE_PATH_LITERAL("green_alpha.png")), |
| 1519 FuzzyPixelOffByOneComparator(true))); | 1520 FuzzyPixelOffByOneComparator(true))); |
| 1520 } | 1521 } |
| 1521 | 1522 |
| 1522 TYPED_TEST(RendererPixelTestWithSkiaGPUBackend, | 1523 TYPED_TEST(RendererPixelTestWithSkiaGPUBackend, |
| 1523 PictureDrawQuadNonIdentityScale) { | 1524 PictureDrawQuadNonIdentityScale) { |
| 1524 gfx::Size pile_tile_size(1000, 1000); | 1525 gfx::Size pile_tile_size(1000, 1000); |
| 1525 gfx::Rect viewport(this->device_viewport_size_); | 1526 gfx::Rect viewport(this->device_viewport_size_); |
| 1526 bool use_skia_gpu_backend = this->UseSkiaGPUBackend(); | 1527 bool use_skia_gpu_backend = this->UseSkiaGPUBackend(); |
| 1527 // TODO(enne): the renderer should figure this out on its own. | 1528 // TODO(enne): the renderer should figure this out on its own. |
| 1528 bool contents_swizzled = !PlatformColor::SameComponentOrder(GL_RGBA); | 1529 ResourceFormat texture_format = RGBA_8888; |
| 1529 | 1530 |
| 1530 RenderPass::Id id(1, 1); | 1531 RenderPass::Id id(1, 1); |
| 1531 gfx::Transform transform_to_root; | 1532 gfx::Transform transform_to_root; |
| 1532 scoped_ptr<RenderPass> pass = | 1533 scoped_ptr<RenderPass> pass = |
| 1533 CreateTestRenderPass(id, viewport, transform_to_root); | 1534 CreateTestRenderPass(id, viewport, transform_to_root); |
| 1534 | 1535 |
| 1535 // As scaling up the blue checkerboards will cause sampling on the GPU, | 1536 // As scaling up the blue checkerboards will cause sampling on the GPU, |
| 1536 // a few extra "cleanup rects" need to be added to clobber the blending | 1537 // a few extra "cleanup rects" need to be added to clobber the blending |
| 1537 // to make the output image more clean. This will also test subrects | 1538 // to make the output image more clean. This will also test subrects |
| 1538 // of the layer. | 1539 // of the layer. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1552 | 1553 |
| 1553 scoped_ptr<SharedQuadState> top_right_green_shared_quad_state = | 1554 scoped_ptr<SharedQuadState> top_right_green_shared_quad_state = |
| 1554 CreateTestSharedQuadState(green_content_to_target_transform, viewport); | 1555 CreateTestSharedQuadState(green_content_to_target_transform, viewport); |
| 1555 | 1556 |
| 1556 scoped_ptr<PictureDrawQuad> green_quad1 = PictureDrawQuad::Create(); | 1557 scoped_ptr<PictureDrawQuad> green_quad1 = PictureDrawQuad::Create(); |
| 1557 green_quad1->SetNew(top_right_green_shared_quad_state.get(), | 1558 green_quad1->SetNew(top_right_green_shared_quad_state.get(), |
| 1558 green_rect1, | 1559 green_rect1, |
| 1559 gfx::Rect(), | 1560 gfx::Rect(), |
| 1560 gfx::RectF(green_rect1.size()), | 1561 gfx::RectF(green_rect1.size()), |
| 1561 green_rect1.size(), | 1562 green_rect1.size(), |
| 1562 contents_swizzled, | 1563 texture_format, |
| 1563 green_rect1, | 1564 green_rect1, |
| 1564 1.f, | 1565 1.f, |
| 1565 use_skia_gpu_backend, | 1566 use_skia_gpu_backend, |
| 1566 green_pile); | 1567 green_pile); |
| 1567 pass->quad_list.push_back(green_quad1.PassAs<DrawQuad>()); | 1568 pass->quad_list.push_back(green_quad1.PassAs<DrawQuad>()); |
| 1568 | 1569 |
| 1569 scoped_ptr<PictureDrawQuad> green_quad2 = PictureDrawQuad::Create(); | 1570 scoped_ptr<PictureDrawQuad> green_quad2 = PictureDrawQuad::Create(); |
| 1570 green_quad2->SetNew(top_right_green_shared_quad_state.get(), | 1571 green_quad2->SetNew(top_right_green_shared_quad_state.get(), |
| 1571 green_rect2, | 1572 green_rect2, |
| 1572 gfx::Rect(), | 1573 gfx::Rect(), |
| 1573 gfx::RectF(green_rect2.size()), | 1574 gfx::RectF(green_rect2.size()), |
| 1574 green_rect2.size(), | 1575 green_rect2.size(), |
| 1575 contents_swizzled, | 1576 texture_format, |
| 1576 green_rect2, | 1577 green_rect2, |
| 1577 1.f, | 1578 1.f, |
| 1578 use_skia_gpu_backend, | 1579 use_skia_gpu_backend, |
| 1579 green_pile); | 1580 green_pile); |
| 1580 pass->quad_list.push_back(green_quad2.PassAs<DrawQuad>()); | 1581 pass->quad_list.push_back(green_quad2.PassAs<DrawQuad>()); |
| 1581 | 1582 |
| 1582 // Add a green clipped checkerboard in the bottom right to help test | 1583 // Add a green clipped checkerboard in the bottom right to help test |
| 1583 // interleaving picture quad content and solid color content. | 1584 // interleaving picture quad content and solid color content. |
| 1584 gfx::Rect bottom_right_rect( | 1585 gfx::Rect bottom_right_rect( |
| 1585 gfx::Point(viewport.width() / 2, viewport.height() / 2), | 1586 gfx::Point(viewport.width() / 2, viewport.height() / 2), |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1637 gfx::Rect quad_content_rect(gfx::Size(20, 20)); | 1638 gfx::Rect quad_content_rect(gfx::Size(20, 20)); |
| 1638 scoped_ptr<SharedQuadState> blue_shared_state = | 1639 scoped_ptr<SharedQuadState> blue_shared_state = |
| 1639 CreateTestSharedQuadState(content_to_target_transform, quad_content_rect); | 1640 CreateTestSharedQuadState(content_to_target_transform, quad_content_rect); |
| 1640 | 1641 |
| 1641 scoped_ptr<PictureDrawQuad> blue_quad = PictureDrawQuad::Create(); | 1642 scoped_ptr<PictureDrawQuad> blue_quad = PictureDrawQuad::Create(); |
| 1642 blue_quad->SetNew(blue_shared_state.get(), | 1643 blue_quad->SetNew(blue_shared_state.get(), |
| 1643 quad_content_rect, | 1644 quad_content_rect, |
| 1644 gfx::Rect(), | 1645 gfx::Rect(), |
| 1645 quad_content_rect, | 1646 quad_content_rect, |
| 1646 content_union_rect.size(), | 1647 content_union_rect.size(), |
| 1647 contents_swizzled, | 1648 texture_format, |
| 1648 content_union_rect, | 1649 content_union_rect, |
| 1649 contents_scale, | 1650 contents_scale, |
| 1650 use_skia_gpu_backend, | 1651 use_skia_gpu_backend, |
| 1651 pile); | 1652 pile); |
| 1652 pass->quad_list.push_back(blue_quad.PassAs<DrawQuad>()); | 1653 pass->quad_list.push_back(blue_quad.PassAs<DrawQuad>()); |
| 1653 | 1654 |
| 1654 // Fill left half of viewport with green. | 1655 // Fill left half of viewport with green. |
| 1655 gfx::Transform half_green_content_to_target_transform; | 1656 gfx::Transform half_green_content_to_target_transform; |
| 1656 gfx::Rect half_green_rect(gfx::Size(viewport.width() / 2, viewport.height())); | 1657 gfx::Rect half_green_rect(gfx::Size(viewport.width() / 2, viewport.height())); |
| 1657 scoped_ptr<SharedQuadState> half_green_shared_state = | 1658 scoped_ptr<SharedQuadState> half_green_shared_state = |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1668 EXPECT_TRUE(this->RunPixelTest( | 1669 EXPECT_TRUE(this->RunPixelTest( |
| 1669 &pass_list, | 1670 &pass_list, |
| 1670 PixelTest::NoOffscreenContext, | 1671 PixelTest::NoOffscreenContext, |
| 1671 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), | 1672 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), |
| 1672 ExactPixelComparator(true))); | 1673 ExactPixelComparator(true))); |
| 1673 } | 1674 } |
| 1674 #endif // !defined(OS_ANDROID) | 1675 #endif // !defined(OS_ANDROID) |
| 1675 | 1676 |
| 1676 } // namespace | 1677 } // namespace |
| 1677 } // namespace cc | 1678 } // namespace cc |
| OLD | NEW |