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

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

Issue 2936343002: Add support to GLRenderer for different blending for solid color quads (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « cc/output/gl_renderer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 803
804 RenderPassList pass_list; 804 RenderPassList pass_list;
805 pass_list.push_back(std::move(pass)); 805 pass_list.push_back(std::move(pass));
806 806
807 EXPECT_TRUE(this->RunPixelTest( 807 EXPECT_TRUE(this->RunPixelTest(
808 &pass_list, 808 &pass_list,
809 base::FilePath(FILE_PATH_LITERAL("green_alpha.png")), 809 base::FilePath(FILE_PATH_LITERAL("green_alpha.png")),
810 FuzzyPixelOffByOneComparator(true))); 810 FuzzyPixelOffByOneComparator(true)));
811 } 811 }
812 812
813 TEST_F(GLRendererPixelTest, SolidColorBlend) {
814 gfx::Rect rect(this->device_viewport_size_);
815
816 int id = 1;
817 std::unique_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect);
818
819 SharedQuadState* shared_state =
820 CreateTestSharedQuadState(gfx::Transform(), rect, pass.get());
821 shared_state->opacity = 1 - 16.0f / 255;
822 shared_state->blend_mode = SkBlendMode::kDstOut;
823
824 SolidColorDrawQuad* color_quad =
825 pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>();
826 color_quad->SetNew(shared_state, rect, rect, SK_ColorRED, false);
827
828 SharedQuadState* shared_state_background =
829 CreateTestSharedQuadState(gfx::Transform(), rect, pass.get());
830
831 SkColor background_color = SkColorSetRGB(0xff, 0xff * 14 / 16, 0xff);
832 SolidColorDrawQuad* color_quad_background =
833 pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>();
834 color_quad_background->SetNew(shared_state_background, rect, rect,
835 background_color, false);
836 // Result should be r=16, g=14, b=16.
837
838 RenderPassList pass_list;
839 pass_list.push_back(std::move(pass));
840
841 EXPECT_TRUE(this->RunPixelTest(
842 &pass_list, base::FilePath(FILE_PATH_LITERAL("dark_grey.png")),
843 FuzzyPixelOffByOneComparator(true)));
844 }
845
813 TEST_F(GLRendererPixelTest, 846 TEST_F(GLRendererPixelTest,
814 PremultipliedTextureWithBackgroundAndVertexOpacity) { 847 PremultipliedTextureWithBackgroundAndVertexOpacity) {
815 gfx::Rect rect(this->device_viewport_size_); 848 gfx::Rect rect(this->device_viewport_size_);
816 849
817 int id = 1; 850 int id = 1;
818 std::unique_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect); 851 std::unique_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect);
819 852
820 SharedQuadState* texture_quad_state = 853 SharedQuadState* texture_quad_state =
821 CreateTestSharedQuadState(gfx::Transform(), rect, pass.get()); 854 CreateTestSharedQuadState(gfx::Transform(), rect, pass.get());
822 texture_quad_state->opacity = 0.8f; 855 texture_quad_state->opacity = 0.8f;
(...skipping 2726 matching lines...) Expand 10 before | Expand all | Expand 10 after
3549 INSTANTIATE_TEST_CASE_P( 3582 INSTANTIATE_TEST_CASE_P(
3550 ToColorSpace, 3583 ToColorSpace,
3551 ColorTransformPixelTest, 3584 ColorTransformPixelTest,
3552 testing::Combine(testing::ValuesIn(intermediate_color_spaces), 3585 testing::Combine(testing::ValuesIn(intermediate_color_spaces),
3553 testing::ValuesIn(dst_color_spaces))); 3586 testing::ValuesIn(dst_color_spaces)));
3554 3587
3555 #endif // !defined(OS_ANDROID) 3588 #endif // !defined(OS_ANDROID)
3556 3589
3557 } // namespace 3590 } // namespace
3558 } // namespace cc 3591 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/gl_renderer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698