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

Unified 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: Revert gl_renderer changes Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cc/output/software_renderer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/renderer_pixeltest.cc
diff --git a/cc/output/renderer_pixeltest.cc b/cc/output/renderer_pixeltest.cc
index d85db7f2aab7954bbc0fac942ac7f13e99bde6eb..e8d13237208d17442ad59c9eb7018673586b4664 100644
--- a/cc/output/renderer_pixeltest.cc
+++ b/cc/output/renderer_pixeltest.cc
@@ -1416,6 +1416,79 @@ TYPED_TEST(RendererPixelTestWithSkiaGPUBackend, PictureDrawQuadIdentityScale) {
ExactPixelComparator(true)));
}
+// Not WithSkiaGPUBackend since that path currently requires tiles for opacity.
+TYPED_TEST(RendererPixelTest, PictureDrawQuadOpacity) {
+ gfx::Size pile_tile_size(1000, 1000);
+ gfx::Rect viewport(this->device_viewport_size_);
+ bool use_skia_gpu_backend = this->UseSkiaGPUBackend();
+ bool contents_swizzled = !PlatformColor::SameComponentOrder(GL_RGBA);
+
+ RenderPass::Id id(1, 1);
+ gfx::Transform transform_to_root;
+ scoped_ptr<RenderPass> pass =
+ CreateTestRenderPass(id, viewport, transform_to_root);
+
+ // One viewport-filling 0.5-opacity green quad.
+ scoped_refptr<FakePicturePileImpl> green_pile =
+ FakePicturePileImpl::CreateFilledPile(pile_tile_size, viewport.size());
+ SkPaint green_paint;
+ green_paint.setColor(SK_ColorGREEN);
+ green_pile->add_draw_rect_with_paint(viewport, green_paint);
+ green_pile->RerecordPile();
+
+ gfx::Transform green_content_to_target_transform;
+ scoped_ptr<SharedQuadState> green_shared_state =
+ CreateTestSharedQuadState(green_content_to_target_transform, viewport);
+ green_shared_state->opacity = 0.5f;
+
+ scoped_ptr<PictureDrawQuad> green_quad = PictureDrawQuad::Create();
+ green_quad->SetNew(green_shared_state.get(),
+ viewport,
+ gfx::Rect(),
+ gfx::RectF(0, 0, 1, 1),
+ viewport.size(),
+ contents_swizzled,
+ viewport,
+ 1.f,
+ use_skia_gpu_backend,
+ green_pile);
+ pass->quad_list.push_back(green_quad.PassAs<DrawQuad>());
+
+ // One viewport-filling white quad.
+ scoped_refptr<FakePicturePileImpl> white_pile =
+ FakePicturePileImpl::CreateFilledPile(pile_tile_size, viewport.size());
+ SkPaint white_paint;
+ white_paint.setColor(SK_ColorWHITE);
+ white_pile->add_draw_rect_with_paint(viewport, white_paint);
+ white_pile->RerecordPile();
+
+ gfx::Transform white_content_to_target_transform;
+ scoped_ptr<SharedQuadState> white_shared_state =
+ CreateTestSharedQuadState(white_content_to_target_transform, viewport);
+
+ scoped_ptr<PictureDrawQuad> white_quad = PictureDrawQuad::Create();
+ white_quad->SetNew(white_shared_state.get(),
+ viewport,
+ gfx::Rect(),
+ gfx::RectF(0, 0, 1, 1),
+ viewport.size(),
+ contents_swizzled,
+ viewport,
+ 1.f,
+ use_skia_gpu_backend,
+ white_pile);
+ pass->quad_list.push_back(white_quad.PassAs<DrawQuad>());
+
+ RenderPassList pass_list;
+ pass_list.push_back(pass.Pass());
+
+ EXPECT_TRUE(this->RunPixelTest(
+ &pass_list,
+ PixelTest::NoOffscreenContext,
+ base::FilePath(FILE_PATH_LITERAL("green_alpha.png")),
+ FuzzyPixelOffByOneComparator(true)));
+}
+
TYPED_TEST(RendererPixelTestWithSkiaGPUBackend,
PictureDrawQuadNonIdentityScale) {
gfx::Size pile_tile_size(1000, 1000);
« no previous file with comments | « no previous file | cc/output/software_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698