| Index: cc/output/renderer_pixeltest.cc
|
| diff --git a/cc/output/renderer_pixeltest.cc b/cc/output/renderer_pixeltest.cc
|
| index 9eeb98348241bc54f8718e1ce2f8cd9fd6af06ec..43488ce836894c4c19d5003de4a0ee4b28085f03 100644
|
| --- a/cc/output/renderer_pixeltest.cc
|
| +++ b/cc/output/renderer_pixeltest.cc
|
| @@ -152,6 +152,7 @@ void CreateTestTwoColoredTextureDrawQuad(const gfx::Rect& rect,
|
|
|
| void CreateTestTextureDrawQuad(const gfx::Rect& rect,
|
| SkColor texel_color,
|
| + float vertex_opacity[4],
|
| SkColor background_color,
|
| bool premultiplied_alpha,
|
| const SharedQuadState* shared_state,
|
| @@ -172,8 +173,6 @@ void CreateTestTextureDrawQuad(const gfx::Rect& rect,
|
| resource_provider->CopyToResource(
|
| resource, reinterpret_cast<uint8_t*>(&pixels.front()), rect.size());
|
|
|
| - float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f};
|
| -
|
| const gfx::PointF uv_top_left(0.0f, 0.0f);
|
| const gfx::PointF uv_bottom_right(1.0f, 1.0f);
|
| const bool flipped = false;
|
| @@ -186,6 +185,19 @@ void CreateTestTextureDrawQuad(const gfx::Rect& rect,
|
| false);
|
| }
|
|
|
| +void CreateTestTextureDrawQuad(const gfx::Rect& rect,
|
| + SkColor texel_color,
|
| + SkColor background_color,
|
| + bool premultiplied_alpha,
|
| + const SharedQuadState* shared_state,
|
| + ResourceProvider* resource_provider,
|
| + RenderPass* render_pass) {
|
| + float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f};
|
| + CreateTestTextureDrawQuad(rect, texel_color, vertex_opacity, background_color,
|
| + premultiplied_alpha, shared_state,
|
| + resource_provider, render_pass);
|
| +}
|
| +
|
| void CreateTestYUVVideoDrawQuad_FromVideoFrame(
|
| const SharedQuadState* shared_state,
|
| scoped_refptr<media::VideoFrame> video_frame,
|
| @@ -793,6 +805,41 @@ TYPED_TEST(RendererPixelTest, PremultipliedTextureWithBackground) {
|
| FuzzyPixelOffByOneComparator(true)));
|
| }
|
|
|
| +TEST_F(GLRendererPixelTest,
|
| + PremultipliedTextureWithBackgroundAndVertexOpacity) {
|
| + gfx::Rect rect(this->device_viewport_size_);
|
| +
|
| + int id = 1;
|
| + std::unique_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect);
|
| +
|
| + SharedQuadState* texture_quad_state =
|
| + CreateTestSharedQuadState(gfx::Transform(), rect, pass.get());
|
| + texture_quad_state->opacity = 0.8f;
|
| +
|
| + float vertex_opacity[4] = {1.f, 1.f, 0.f, 0.f};
|
| + CreateTestTextureDrawQuad(gfx::Rect(this->device_viewport_size_),
|
| + SkColorSetARGB(204, 120, 255, 120), // Texel color.
|
| + vertex_opacity,
|
| + SK_ColorGREEN, // Background color.
|
| + true, // Premultiplied alpha.
|
| + texture_quad_state, this->resource_provider_.get(),
|
| + pass.get());
|
| +
|
| + SharedQuadState* color_quad_state =
|
| + CreateTestSharedQuadState(gfx::Transform(), rect, pass.get());
|
| + SolidColorDrawQuad* color_quad =
|
| + pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>();
|
| + color_quad->SetNew(color_quad_state, rect, rect, SK_ColorWHITE, false);
|
| +
|
| + RenderPassList pass_list;
|
| + pass_list.push_back(std::move(pass));
|
| +
|
| + EXPECT_TRUE(this->RunPixelTest(
|
| + &pass_list,
|
| + base::FilePath(FILE_PATH_LITERAL("green_alpha_vertex_opacity.png")),
|
| + FuzzyPixelOffByOneComparator(true)));
|
| +}
|
| +
|
| template <typename TypeParam>
|
| class IntersectingQuadPixelTest : public RendererPixelTest<TypeParam> {
|
| protected:
|
|
|