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 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 | 644 |
645 // This test has alpha=254 for the software renderer vs. alpha=255 for the gl | 645 // This test has alpha=254 for the software renderer vs. alpha=255 for the gl |
646 // renderer so use a fuzzy comparator. | 646 // renderer so use a fuzzy comparator. |
647 EXPECT_TRUE(this->RunPixelTest( | 647 EXPECT_TRUE(this->RunPixelTest( |
648 &pass_list, | 648 &pass_list, |
649 PixelTest::NoOffscreenContext, | 649 PixelTest::NoOffscreenContext, |
650 base::FilePath(FILE_PATH_LITERAL("blue_yellow_alpha.png")), | 650 base::FilePath(FILE_PATH_LITERAL("blue_yellow_alpha.png")), |
651 FuzzyForSoftwareOnlyPixelComparator<TypeParam>(false))); | 651 FuzzyForSoftwareOnlyPixelComparator<TypeParam>(false))); |
652 } | 652 } |
653 | 653 |
| 654 TYPED_TEST(RendererPixelTest, FastPassSaturateFilter) { |
| 655 gfx::Rect viewport_rect(this->device_viewport_size_); |
| 656 |
| 657 RenderPass::Id root_pass_id(1, 1); |
| 658 scoped_ptr<RenderPass> root_pass = |
| 659 CreateTestRootRenderPass(root_pass_id, viewport_rect); |
| 660 |
| 661 RenderPass::Id child_pass_id(2, 2); |
| 662 gfx::Rect pass_rect(this->device_viewport_size_); |
| 663 gfx::Transform transform_to_root; |
| 664 scoped_ptr<RenderPass> child_pass = |
| 665 CreateTestRenderPass(child_pass_id, pass_rect, transform_to_root); |
| 666 |
| 667 gfx::Transform content_to_target_transform; |
| 668 scoped_ptr<SharedQuadState> shared_state = |
| 669 CreateTestSharedQuadState(content_to_target_transform, viewport_rect); |
| 670 shared_state->opacity = 0.5f; |
| 671 |
| 672 scoped_ptr<SolidColorDrawQuad> blue = SolidColorDrawQuad::Create(); |
| 673 blue->SetNew(shared_state.get(), |
| 674 gfx::Rect(0, |
| 675 0, |
| 676 this->device_viewport_size_.width(), |
| 677 this->device_viewport_size_.height() / 2), |
| 678 SK_ColorBLUE, |
| 679 false); |
| 680 scoped_ptr<SolidColorDrawQuad> yellow = SolidColorDrawQuad::Create(); |
| 681 yellow->SetNew(shared_state.get(), |
| 682 gfx::Rect(0, |
| 683 this->device_viewport_size_.height() / 2, |
| 684 this->device_viewport_size_.width(), |
| 685 this->device_viewport_size_.height() / 2), |
| 686 SK_ColorYELLOW, |
| 687 false); |
| 688 |
| 689 scoped_ptr<SharedQuadState> blank_state = |
| 690 CreateTestSharedQuadState(content_to_target_transform, viewport_rect); |
| 691 |
| 692 scoped_ptr<SolidColorDrawQuad> white = SolidColorDrawQuad::Create(); |
| 693 white->SetNew(blank_state.get(), |
| 694 viewport_rect, |
| 695 SK_ColorWHITE, |
| 696 false); |
| 697 |
| 698 child_pass->quad_list.push_back(blue.PassAs<DrawQuad>()); |
| 699 child_pass->quad_list.push_back(yellow.PassAs<DrawQuad>()); |
| 700 child_pass->quad_list.push_back(white.PassAs<DrawQuad>()); |
| 701 |
| 702 scoped_ptr<SharedQuadState> pass_shared_state = |
| 703 CreateTestSharedQuadState(gfx::Transform(), pass_rect); |
| 704 |
| 705 FilterOperations filters; |
| 706 filters.Append(FilterOperation::CreateSaturateFilter(0.5f)); |
| 707 |
| 708 scoped_ptr<RenderPassDrawQuad> render_pass_quad = |
| 709 RenderPassDrawQuad::Create(); |
| 710 render_pass_quad->SetNew(pass_shared_state.get(), |
| 711 pass_rect, |
| 712 child_pass_id, |
| 713 false, |
| 714 0, |
| 715 pass_rect, |
| 716 gfx::RectF(), |
| 717 filters, |
| 718 FilterOperations()); |
| 719 |
| 720 root_pass->quad_list.push_back(render_pass_quad.PassAs<DrawQuad>()); |
| 721 |
| 722 RenderPassList pass_list; |
| 723 pass_list.push_back(child_pass.Pass()); |
| 724 pass_list.push_back(root_pass.Pass()); |
| 725 |
| 726 EXPECT_TRUE(this->RunPixelTest( |
| 727 &pass_list, |
| 728 PixelTest::NoOffscreenContext, |
| 729 base::FilePath(FILE_PATH_LITERAL("blue_yellow_alpha.png")), |
| 730 ExactPixelComparator(true))); |
| 731 } |
| 732 |
| 733 TYPED_TEST(RendererPixelTest, FastPassFilterChain) { |
| 734 gfx::Rect viewport_rect(this->device_viewport_size_); |
| 735 |
| 736 RenderPass::Id root_pass_id(1, 1); |
| 737 scoped_ptr<RenderPass> root_pass = |
| 738 CreateTestRootRenderPass(root_pass_id, viewport_rect); |
| 739 |
| 740 RenderPass::Id child_pass_id(2, 2); |
| 741 gfx::Rect pass_rect(this->device_viewport_size_); |
| 742 gfx::Transform transform_to_root; |
| 743 scoped_ptr<RenderPass> child_pass = |
| 744 CreateTestRenderPass(child_pass_id, pass_rect, transform_to_root); |
| 745 |
| 746 gfx::Transform content_to_target_transform; |
| 747 scoped_ptr<SharedQuadState> shared_state = |
| 748 CreateTestSharedQuadState(content_to_target_transform, viewport_rect); |
| 749 shared_state->opacity = 0.5f; |
| 750 |
| 751 scoped_ptr<SolidColorDrawQuad> blue = SolidColorDrawQuad::Create(); |
| 752 blue->SetNew(shared_state.get(), |
| 753 gfx::Rect(0, |
| 754 0, |
| 755 this->device_viewport_size_.width(), |
| 756 this->device_viewport_size_.height() / 2), |
| 757 SK_ColorBLUE, |
| 758 false); |
| 759 scoped_ptr<SolidColorDrawQuad> yellow = SolidColorDrawQuad::Create(); |
| 760 yellow->SetNew(shared_state.get(), |
| 761 gfx::Rect(0, |
| 762 this->device_viewport_size_.height() / 2, |
| 763 this->device_viewport_size_.width(), |
| 764 this->device_viewport_size_.height() / 2), |
| 765 SK_ColorYELLOW, |
| 766 false); |
| 767 |
| 768 scoped_ptr<SharedQuadState> blank_state = |
| 769 CreateTestSharedQuadState(content_to_target_transform, viewport_rect); |
| 770 |
| 771 scoped_ptr<SolidColorDrawQuad> white = SolidColorDrawQuad::Create(); |
| 772 white->SetNew(blank_state.get(), |
| 773 viewport_rect, |
| 774 SK_ColorWHITE, |
| 775 false); |
| 776 |
| 777 child_pass->quad_list.push_back(blue.PassAs<DrawQuad>()); |
| 778 child_pass->quad_list.push_back(yellow.PassAs<DrawQuad>()); |
| 779 child_pass->quad_list.push_back(white.PassAs<DrawQuad>()); |
| 780 |
| 781 scoped_ptr<SharedQuadState> pass_shared_state = |
| 782 CreateTestSharedQuadState(gfx::Transform(), pass_rect); |
| 783 |
| 784 FilterOperations filters; |
| 785 filters.Append(FilterOperation::CreateGrayscaleFilter(1.f)); |
| 786 filters.Append(FilterOperation::CreateBrightnessFilter(0.5f)); |
| 787 |
| 788 scoped_ptr<RenderPassDrawQuad> render_pass_quad = |
| 789 RenderPassDrawQuad::Create(); |
| 790 render_pass_quad->SetNew(pass_shared_state.get(), |
| 791 pass_rect, |
| 792 child_pass_id, |
| 793 false, |
| 794 0, |
| 795 pass_rect, |
| 796 gfx::RectF(), |
| 797 filters, |
| 798 FilterOperations()); |
| 799 |
| 800 root_pass->quad_list.push_back(render_pass_quad.PassAs<DrawQuad>()); |
| 801 |
| 802 RenderPassList pass_list; |
| 803 pass_list.push_back(child_pass.Pass()); |
| 804 pass_list.push_back(root_pass.Pass()); |
| 805 |
| 806 EXPECT_TRUE(this->RunPixelTest( |
| 807 &pass_list, |
| 808 PixelTest::NoOffscreenContext, |
| 809 base::FilePath(FILE_PATH_LITERAL("blue_yellow_filter_chain.png")), |
| 810 ExactPixelComparator(true))); |
| 811 } |
| 812 |
654 TYPED_TEST(RendererPixelTest, FastPassColorFilterAlphaTranslation) { | 813 TYPED_TEST(RendererPixelTest, FastPassColorFilterAlphaTranslation) { |
655 gfx::Rect viewport_rect(this->device_viewport_size_); | 814 gfx::Rect viewport_rect(this->device_viewport_size_); |
656 | 815 |
657 RenderPass::Id root_pass_id(1, 1); | 816 RenderPass::Id root_pass_id(1, 1); |
658 scoped_ptr<RenderPass> root_pass = | 817 scoped_ptr<RenderPass> root_pass = |
659 CreateTestRootRenderPass(root_pass_id, viewport_rect); | 818 CreateTestRootRenderPass(root_pass_id, viewport_rect); |
660 | 819 |
661 RenderPass::Id child_pass_id(2, 2); | 820 RenderPass::Id child_pass_id(2, 2); |
662 gfx::Rect pass_rect(this->device_viewport_size_); | 821 gfx::Rect pass_rect(this->device_viewport_size_); |
663 gfx::Transform transform_to_root; | 822 gfx::Transform transform_to_root; |
(...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1668 EXPECT_TRUE(this->RunPixelTest( | 1827 EXPECT_TRUE(this->RunPixelTest( |
1669 &pass_list, | 1828 &pass_list, |
1670 PixelTest::NoOffscreenContext, | 1829 PixelTest::NoOffscreenContext, |
1671 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), | 1830 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), |
1672 ExactPixelComparator(true))); | 1831 ExactPixelComparator(true))); |
1673 } | 1832 } |
1674 #endif // !defined(OS_ANDROID) | 1833 #endif // !defined(OS_ANDROID) |
1675 | 1834 |
1676 } // namespace | 1835 } // namespace |
1677 } // namespace cc | 1836 } // namespace cc |
OLD | NEW |