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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 WebKit::WebFilterOperation::createInvertFilter(1.f)); | 355 WebKit::WebFilterOperation::createInvertFilter(1.f)); |
356 | 356 |
357 filter_pass_content_rect_ = | 357 filter_pass_content_rect_ = |
358 gfx::Rect(kDeviceViewportWidth, kDeviceViewportHeight); | 358 gfx::Rect(kDeviceViewportWidth, kDeviceViewportHeight); |
359 filter_pass_content_rect_.Inset(12, 14, 16, 18); | 359 filter_pass_content_rect_.Inset(12, 14, 16, 18); |
360 | 360 |
361 DrawFrame(); | 361 DrawFrame(); |
362 EXPECT_TRUE(PixelsMatchReference( | 362 EXPECT_TRUE(PixelsMatchReference( |
363 base::FilePath(FILE_PATH_LITERAL("background_filter.png")))); | 363 base::FilePath(FILE_PATH_LITERAL("background_filter.png")))); |
364 } | 364 } |
| 365 |
| 366 TEST_F(GLRendererPixelTest, AntiAliasing) { |
| 367 gfx::Rect rect(0, 0, 200, 200); |
| 368 |
| 369 RenderPass::Id id(1, 1); |
| 370 gfx::Transform transform_to_root; |
| 371 scoped_ptr<RenderPass> pass = |
| 372 CreateTestRenderPass(id, rect, transform_to_root); |
| 373 |
| 374 gfx::Transform red_content_to_target_transform; |
| 375 red_content_to_target_transform.Rotate(10); |
| 376 scoped_ptr<SharedQuadState> red_shared_state = |
| 377 CreateTestSharedQuadState(red_content_to_target_transform, rect); |
| 378 |
| 379 scoped_ptr<SolidColorDrawQuad> red = SolidColorDrawQuad::Create(); |
| 380 red->SetNew(red_shared_state.get(), rect, SK_ColorRED); |
| 381 |
| 382 pass->quad_list.push_back(red.PassAs<DrawQuad>()); |
| 383 |
| 384 gfx::Transform yellow_content_to_target_transform; |
| 385 yellow_content_to_target_transform.Rotate(5); |
| 386 scoped_ptr<SharedQuadState> yellow_shared_state = |
| 387 CreateTestSharedQuadState(yellow_content_to_target_transform, rect); |
| 388 |
| 389 scoped_ptr<SolidColorDrawQuad> yellow = SolidColorDrawQuad::Create(); |
| 390 yellow->SetNew(yellow_shared_state.get(), rect, SK_ColorYELLOW); |
| 391 |
| 392 pass->quad_list.push_back(yellow.PassAs<DrawQuad>()); |
| 393 |
| 394 gfx::Transform blue_content_to_target_transform; |
| 395 scoped_ptr<SharedQuadState> blue_shared_state = |
| 396 CreateTestSharedQuadState(blue_content_to_target_transform, rect); |
| 397 |
| 398 scoped_ptr<SolidColorDrawQuad> blue = SolidColorDrawQuad::Create(); |
| 399 blue->SetNew(blue_shared_state.get(), rect, SK_ColorBLUE); |
| 400 |
| 401 pass->quad_list.push_back(blue.PassAs<DrawQuad>()); |
| 402 |
| 403 RenderPassList pass_list; |
| 404 pass_list.push_back(pass.Pass()); |
| 405 |
| 406 renderer_->DrawFrame(pass_list); |
| 407 |
| 408 EXPECT_TRUE(PixelsMatchReference( |
| 409 base::FilePath(FILE_PATH_LITERAL("anti_aliasing.png")))); |
| 410 } |
365 #endif | 411 #endif |
366 | 412 |
367 } // namespace | 413 } // namespace |
368 } // namespace cc | 414 } // namespace cc |
OLD | NEW |