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 "cc/gl_renderer.h" | 5 #include "cc/gl_renderer.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "cc/compositor_frame_metadata.h" | 9 #include "cc/compositor_frame_metadata.h" |
10 #include "cc/draw_quad.h" | 10 #include "cc/draw_quad.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
190 pass_list.push_back(child_pass.Pass()); | 190 pass_list.push_back(child_pass.Pass()); |
191 pass_list.push_back(root_pass.Pass()); | 191 pass_list.push_back(root_pass.Pass()); |
192 | 192 |
193 renderer_->setEnlargePassTextureAmountForTesting(gfx::Vector2d(50, 75)); | 193 renderer_->setEnlargePassTextureAmountForTesting(gfx::Vector2d(50, 75)); |
194 renderer_->decideRenderPassAllocationsForFrame(pass_list); | 194 renderer_->decideRenderPassAllocationsForFrame(pass_list); |
195 renderer_->drawFrame(pass_list); | 195 renderer_->drawFrame(pass_list); |
196 | 196 |
197 EXPECT_TRUE(PixelsMatchReference( | 197 EXPECT_TRUE(PixelsMatchReference( |
198 base::FilePath(FILE_PATH_LITERAL("blue_yellow.png")), viewport_rect)); | 198 base::FilePath(FILE_PATH_LITERAL("blue_yellow.png")), viewport_rect)); |
199 } | 199 } |
200 | |
201 // This test is flaky on Windows. We only enable it on Linux for now. | |
jamesr
2013/03/05 18:50:00
Do we know why?
| |
202 #if defined(OS_LINUX) | |
203 TEST_F(GLRendererPixelTest, AntiAliasing) { | |
204 gfx::Rect rect(0, 0, 200, 200); | |
205 | |
206 RenderPass::Id id(1, 1); | |
207 scoped_ptr<RenderPass> pass = CreateTestRenderPass(id, rect); | |
208 | |
209 gfx::Transform red_content_to_target_transform; | |
210 red_content_to_target_transform.Rotate(10); | |
211 scoped_ptr<SharedQuadState> red_shared_state = | |
212 CreateTestSharedQuadState(red_content_to_target_transform, rect); | |
213 | |
214 scoped_ptr<SolidColorDrawQuad> red = SolidColorDrawQuad::Create(); | |
215 red->SetNew(red_shared_state.get(), rect, SK_ColorRED); | |
216 | |
217 pass->quad_list.push_back(red.PassAs<DrawQuad>()); | |
218 | |
219 gfx::Transform yellow_content_to_target_transform; | |
220 yellow_content_to_target_transform.Rotate(5); | |
221 scoped_ptr<SharedQuadState> yellow_shared_state = | |
222 CreateTestSharedQuadState(yellow_content_to_target_transform, rect); | |
223 | |
224 scoped_ptr<SolidColorDrawQuad> yellow = SolidColorDrawQuad::Create(); | |
225 yellow->SetNew(yellow_shared_state.get(), rect, SK_ColorYELLOW); | |
226 | |
227 pass->quad_list.push_back(yellow.PassAs<DrawQuad>()); | |
228 | |
229 gfx::Transform blue_content_to_target_transform; | |
230 scoped_ptr<SharedQuadState> blue_shared_state = | |
231 CreateTestSharedQuadState(blue_content_to_target_transform, rect); | |
232 | |
233 scoped_ptr<SolidColorDrawQuad> blue = SolidColorDrawQuad::Create(); | |
234 blue->SetNew(blue_shared_state.get(), rect, SK_ColorBLUE); | |
235 | |
236 pass->quad_list.push_back(blue.PassAs<DrawQuad>()); | |
237 | |
238 RenderPassList pass_list; | |
239 pass_list.push_back(pass.Pass()); | |
240 | |
241 renderer_->drawFrame(pass_list); | |
242 | |
243 EXPECT_TRUE(PixelsMatchReference( | |
244 base::FilePath(FILE_PATH_LITERAL("anti_aliasing.png")), rect)); | |
245 } | |
246 #endif // defined(OS_LINUX) | |
247 | |
200 #endif | 248 #endif |
201 | 249 |
202 } // namespace | 250 } // namespace |
203 } // namespace cc | 251 } // namespace cc |
OLD | NEW |