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" |
(...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1142 pass_list.push_back(child_pass.Pass()); | 1142 pass_list.push_back(child_pass.Pass()); |
1143 pass_list.push_back(root_pass.Pass()); | 1143 pass_list.push_back(root_pass.Pass()); |
1144 | 1144 |
1145 EXPECT_TRUE(this->RunPixelTest( | 1145 EXPECT_TRUE(this->RunPixelTest( |
1146 &pass_list, | 1146 &pass_list, |
1147 PixelTest::NoOffscreenContext, | 1147 PixelTest::NoOffscreenContext, |
1148 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), | 1148 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), |
1149 ExactPixelComparator(true))); | 1149 ExactPixelComparator(true))); |
1150 } | 1150 } |
1151 | 1151 |
| 1152 TEST_F(ExternalStencilPixelTest, DeviceClip) { |
| 1153 ClearBackgroundToGreen(); |
| 1154 gfx::Rect clip_rect(gfx::Point(150, 150), gfx::Size(50, 50)); |
| 1155 this->ForceDeviceClip(clip_rect); |
| 1156 |
| 1157 // Draw a blue quad that covers the entire device viewport. It should be |
| 1158 // clipped to the bottom right corner by the device clip. |
| 1159 gfx::Rect rect(this->device_viewport_size_); |
| 1160 RenderPass::Id id(1, 1); |
| 1161 scoped_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect); |
| 1162 scoped_ptr<SharedQuadState> blue_shared_state = |
| 1163 CreateTestSharedQuadState(gfx::Transform(), rect); |
| 1164 scoped_ptr<SolidColorDrawQuad> blue = SolidColorDrawQuad::Create(); |
| 1165 blue->SetNew(blue_shared_state.get(), rect, SK_ColorBLUE, false); |
| 1166 pass->quad_list.push_back(blue.PassAs<DrawQuad>()); |
| 1167 RenderPassList pass_list; |
| 1168 pass_list.push_back(pass.Pass()); |
| 1169 |
| 1170 EXPECT_TRUE(this->RunPixelTest( |
| 1171 &pass_list, |
| 1172 PixelTest::NoOffscreenContext, |
| 1173 base::FilePath(FILE_PATH_LITERAL("green_with_blue_corner.png")), |
| 1174 ExactPixelComparator(true))); |
| 1175 } |
| 1176 |
1152 // Software renderer does not support anti-aliased edges. | 1177 // Software renderer does not support anti-aliased edges. |
1153 TEST_F(GLRendererPixelTest, AntiAliasing) { | 1178 TEST_F(GLRendererPixelTest, AntiAliasing) { |
1154 gfx::Rect rect(this->device_viewport_size_); | 1179 gfx::Rect rect(this->device_viewport_size_); |
1155 | 1180 |
1156 RenderPass::Id id(1, 1); | 1181 RenderPass::Id id(1, 1); |
1157 scoped_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect); | 1182 scoped_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect); |
1158 | 1183 |
1159 gfx::Transform red_content_to_target_transform; | 1184 gfx::Transform red_content_to_target_transform; |
1160 red_content_to_target_transform.Rotate(10); | 1185 red_content_to_target_transform.Rotate(10); |
1161 scoped_ptr<SharedQuadState> red_shared_state = | 1186 scoped_ptr<SharedQuadState> red_shared_state = |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1638 EXPECT_TRUE(this->RunPixelTest( | 1663 EXPECT_TRUE(this->RunPixelTest( |
1639 &pass_list, | 1664 &pass_list, |
1640 PixelTest::NoOffscreenContext, | 1665 PixelTest::NoOffscreenContext, |
1641 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), | 1666 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), |
1642 ExactPixelComparator(true))); | 1667 ExactPixelComparator(true))); |
1643 } | 1668 } |
1644 #endif // !defined(OS_ANDROID) | 1669 #endif // !defined(OS_ANDROID) |
1645 | 1670 |
1646 } // namespace | 1671 } // namespace |
1647 } // namespace cc | 1672 } // namespace cc |
OLD | NEW |