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