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

Side by Side Diff: cc/output/renderer_pixeltest.cc

Issue 22867046: Optimize alpha software PictureDrawQuads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tomhudson@'s code review comments Created 7 years, 3 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
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 "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 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 1387
1388 RenderPassList pass_list; 1388 RenderPassList pass_list;
1389 pass_list.push_back(pass.Pass()); 1389 pass_list.push_back(pass.Pass());
1390 1390
1391 EXPECT_TRUE(this->RunPixelTest( 1391 EXPECT_TRUE(this->RunPixelTest(
1392 &pass_list, 1392 &pass_list,
1393 base::FilePath(FILE_PATH_LITERAL("green_with_blue_corner.png")), 1393 base::FilePath(FILE_PATH_LITERAL("green_with_blue_corner.png")),
1394 ExactPixelComparator(true))); 1394 ExactPixelComparator(true)));
1395 } 1395 }
1396 1396
1397 TYPED_TEST(RendererPixelTestWithSkiaGPUBackend, PictureDrawQuadOpacity) {
1398 gfx::Size pile_tile_size(1000, 1000);
1399 gfx::Rect viewport(this->device_viewport_size_);
1400 bool use_skia_gpu_backend = this->UseSkiaGPUBackend();
1401 bool contents_swizzled = !PlatformColor::SameComponentOrder(GL_RGBA);
1402
1403 RenderPass::Id id(1, 1);
1404 gfx::Transform transform_to_root;
1405 scoped_ptr<RenderPass> pass =
1406 CreateTestRenderPass(id, viewport, transform_to_root);
1407
1408 // One viewport-filling 0.5-opacity green quad.
1409 scoped_refptr<FakePicturePileImpl> green_pile =
1410 FakePicturePileImpl::CreateFilledPile(pile_tile_size, viewport.size());
1411 SkPaint green_paint;
1412 green_paint.setColor(SK_ColorGREEN);
1413 green_pile->add_draw_rect_with_paint(viewport, green_paint);
1414 green_pile->RerecordPile();
1415
1416 gfx::Transform green_content_to_target_transform;
1417 scoped_ptr<SharedQuadState> green_shared_state =
1418 CreateTestSharedQuadState(green_content_to_target_transform, viewport);
1419 green_shared_state->opacity = 0.5f;
1420
1421 scoped_ptr<PictureDrawQuad> green_quad = PictureDrawQuad::Create();
1422 green_quad->SetNew(green_shared_state.get(),
1423 viewport,
1424 gfx::Rect(),
1425 gfx::RectF(0, 0, 1, 1),
1426 viewport.size(),
1427 contents_swizzled,
1428 viewport,
1429 1.f,
1430 use_skia_gpu_backend,
1431 green_pile);
1432 pass->quad_list.push_back(green_quad.PassAs<DrawQuad>());
1433
1434 // One viewport-filling white quad.
1435 scoped_refptr<FakePicturePileImpl> white_pile =
1436 FakePicturePileImpl::CreateFilledPile(pile_tile_size, viewport.size());
1437 SkPaint white_paint;
1438 white_paint.setColor(SK_ColorWHITE);
1439 white_pile->add_draw_rect_with_paint(viewport, white_paint);
1440 white_pile->RerecordPile();
1441
1442 gfx::Transform white_content_to_target_transform;
1443 scoped_ptr<SharedQuadState> white_shared_state =
1444 CreateTestSharedQuadState(white_content_to_target_transform, viewport);
1445
1446 scoped_ptr<PictureDrawQuad> white_quad = PictureDrawQuad::Create();
1447 white_quad->SetNew(white_shared_state.get(),
1448 viewport,
1449 gfx::Rect(),
1450 gfx::RectF(0, 0, 1, 1),
1451 viewport.size(),
1452 contents_swizzled,
1453 viewport,
1454 1.f,
1455 use_skia_gpu_backend,
1456 white_pile);
1457 pass->quad_list.push_back(white_quad.PassAs<DrawQuad>());
1458
1459 RenderPassList pass_list;
1460 pass_list.push_back(pass.Pass());
1461
1462 EXPECT_TRUE(this->RunPixelTest(
1463 &pass_list,
1464 base::FilePath(FILE_PATH_LITERAL("green_alpha.png")),
1465 FuzzyPixelOffByOneComparator(true)));
1466 }
1467
1397 TYPED_TEST(RendererPixelTestWithSkiaGPUBackend, 1468 TYPED_TEST(RendererPixelTestWithSkiaGPUBackend,
1398 PictureDrawQuadNonIdentityScale) { 1469 PictureDrawQuadNonIdentityScale) {
1399 gfx::Size pile_tile_size(1000, 1000); 1470 gfx::Size pile_tile_size(1000, 1000);
1400 gfx::Rect viewport(this->device_viewport_size_); 1471 gfx::Rect viewport(this->device_viewport_size_);
1401 bool use_skia_gpu_backend = this->UseSkiaGPUBackend(); 1472 bool use_skia_gpu_backend = this->UseSkiaGPUBackend();
1402 // TODO(enne): the renderer should figure this out on its own. 1473 // TODO(enne): the renderer should figure this out on its own.
1403 bool contents_swizzled = !PlatformColor::SameComponentOrder(GL_RGBA); 1474 bool contents_swizzled = !PlatformColor::SameComponentOrder(GL_RGBA);
1404 1475
1405 RenderPass::Id id(1, 1); 1476 RenderPass::Id id(1, 1);
1406 gfx::Transform transform_to_root; 1477 gfx::Transform transform_to_root;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1542 1613
1543 EXPECT_TRUE(this->RunPixelTest( 1614 EXPECT_TRUE(this->RunPixelTest(
1544 &pass_list, 1615 &pass_list,
1545 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), 1616 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")),
1546 ExactPixelComparator(true))); 1617 ExactPixelComparator(true)));
1547 } 1618 }
1548 #endif // !defined(OS_ANDROID) 1619 #endif // !defined(OS_ANDROID)
1549 1620
1550 } // namespace 1621 } // namespace
1551 } // namespace cc 1622 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698