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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 SharedQuadState* shared_state, gfx::Rect rect, RenderPass::Id pass_id) { | 83 SharedQuadState* shared_state, gfx::Rect rect, RenderPass::Id pass_id) { |
84 scoped_ptr<RenderPassDrawQuad> quad = RenderPassDrawQuad::Create(); | 84 scoped_ptr<RenderPassDrawQuad> quad = RenderPassDrawQuad::Create(); |
85 quad->SetNew(shared_state, | 85 quad->SetNew(shared_state, |
86 rect, | 86 rect, |
87 pass_id, | 87 pass_id, |
88 false, // is_replica | 88 false, // is_replica |
89 0, // mask_resource_id | 89 0, // mask_resource_id |
90 rect, // contents_changed_since_last_frame | 90 rect, // contents_changed_since_last_frame |
91 gfx::RectF(), // mask_uv_rect | 91 gfx::RectF(), // mask_uv_rect |
92 FilterOperations(), // foreground filters | 92 FilterOperations(), // foreground filters |
93 skia::RefPtr<SkImageFilter>(), // foreground filter | |
94 FilterOperations()); // background filters | 93 FilterOperations()); // background filters |
95 | 94 |
96 return quad.PassAs<DrawQuad>(); | 95 return quad.PassAs<DrawQuad>(); |
97 } | 96 } |
98 | 97 |
99 scoped_ptr<TextureDrawQuad> CreateTestTextureDrawQuad( | 98 scoped_ptr<TextureDrawQuad> CreateTestTextureDrawQuad( |
100 gfx::Rect rect, | 99 gfx::Rect rect, |
101 SkColor texel_color, | 100 SkColor texel_color, |
102 SkColor background_color, | 101 SkColor background_color, |
103 bool premultiplied_alpha, | 102 bool premultiplied_alpha, |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 matrix[10] = 0.213f - 0.213f * amount; | 614 matrix[10] = 0.213f - 0.213f * amount; |
616 matrix[11] = 0.715f - 0.715f * amount; | 615 matrix[11] = 0.715f - 0.715f * amount; |
617 matrix[12] = 1.f - (matrix[10] + matrix[11]); | 616 matrix[12] = 1.f - (matrix[10] + matrix[11]); |
618 matrix[13] = matrix[14] = 0; | 617 matrix[13] = matrix[14] = 0; |
619 matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0; | 618 matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0; |
620 matrix[18] = 1; | 619 matrix[18] = 1; |
621 skia::RefPtr<SkColorFilter> colorFilter(skia::AdoptRef( | 620 skia::RefPtr<SkColorFilter> colorFilter(skia::AdoptRef( |
622 new SkColorMatrixFilter(matrix))); | 621 new SkColorMatrixFilter(matrix))); |
623 skia::RefPtr<SkImageFilter> filter = | 622 skia::RefPtr<SkImageFilter> filter = |
624 skia::AdoptRef(SkColorFilterImageFilter::Create(colorFilter.get(), NULL)); | 623 skia::AdoptRef(SkColorFilterImageFilter::Create(colorFilter.get(), NULL)); |
| 624 FilterOperations filters; |
| 625 filters.Append(FilterOperation::CreateReferenceFilter(filter)); |
625 | 626 |
626 scoped_ptr<RenderPassDrawQuad> render_pass_quad = | 627 scoped_ptr<RenderPassDrawQuad> render_pass_quad = |
627 RenderPassDrawQuad::Create(); | 628 RenderPassDrawQuad::Create(); |
628 render_pass_quad->SetNew(pass_shared_state.get(), | 629 render_pass_quad->SetNew(pass_shared_state.get(), |
629 pass_rect, | 630 pass_rect, |
630 child_pass_id, | 631 child_pass_id, |
631 false, | 632 false, |
632 0, | 633 0, |
633 pass_rect, | 634 pass_rect, |
634 gfx::RectF(), | 635 gfx::RectF(), |
635 FilterOperations(), | 636 filters, |
636 filter, | |
637 FilterOperations()); | 637 FilterOperations()); |
638 | 638 |
639 root_pass->quad_list.push_back(render_pass_quad.PassAs<DrawQuad>()); | 639 root_pass->quad_list.push_back(render_pass_quad.PassAs<DrawQuad>()); |
640 | 640 |
641 RenderPassList pass_list; | 641 RenderPassList pass_list; |
642 pass_list.push_back(child_pass.Pass()); | 642 pass_list.push_back(child_pass.Pass()); |
643 pass_list.push_back(root_pass.Pass()); | 643 pass_list.push_back(root_pass.Pass()); |
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. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 matrix[11] = 0.715f - 0.715f * amount; | 718 matrix[11] = 0.715f - 0.715f * amount; |
719 matrix[12] = 1.f - (matrix[10] + matrix[11]); | 719 matrix[12] = 1.f - (matrix[10] + matrix[11]); |
720 matrix[13] = 0; | 720 matrix[13] = 0; |
721 matrix[14] = 1.5f; | 721 matrix[14] = 1.5f; |
722 matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0; | 722 matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0; |
723 matrix[18] = 1; | 723 matrix[18] = 1; |
724 skia::RefPtr<SkColorFilter> colorFilter(skia::AdoptRef( | 724 skia::RefPtr<SkColorFilter> colorFilter(skia::AdoptRef( |
725 new SkColorMatrixFilter(matrix))); | 725 new SkColorMatrixFilter(matrix))); |
726 skia::RefPtr<SkImageFilter> filter = | 726 skia::RefPtr<SkImageFilter> filter = |
727 skia::AdoptRef(SkColorFilterImageFilter::Create(colorFilter.get(), NULL)); | 727 skia::AdoptRef(SkColorFilterImageFilter::Create(colorFilter.get(), NULL)); |
| 728 FilterOperations filters; |
| 729 filters.Append(FilterOperation::CreateReferenceFilter(filter)); |
728 | 730 |
729 scoped_ptr<RenderPassDrawQuad> render_pass_quad = | 731 scoped_ptr<RenderPassDrawQuad> render_pass_quad = |
730 RenderPassDrawQuad::Create(); | 732 RenderPassDrawQuad::Create(); |
731 render_pass_quad->SetNew(pass_shared_state.get(), | 733 render_pass_quad->SetNew(pass_shared_state.get(), |
732 pass_rect, | 734 pass_rect, |
733 child_pass_id, | 735 child_pass_id, |
734 false, | 736 false, |
735 0, | 737 0, |
736 pass_rect, | 738 pass_rect, |
737 gfx::RectF(), | 739 gfx::RectF(), |
738 FilterOperations(), | 740 filters, |
739 filter, | |
740 FilterOperations()); | 741 FilterOperations()); |
741 | 742 |
742 root_pass->quad_list.push_back(render_pass_quad.PassAs<DrawQuad>()); | 743 root_pass->quad_list.push_back(render_pass_quad.PassAs<DrawQuad>()); |
743 RenderPassList pass_list; | 744 RenderPassList pass_list; |
744 | 745 |
745 pass_list.push_back(child_pass.Pass()); | 746 pass_list.push_back(child_pass.Pass()); |
746 pass_list.push_back(root_pass.Pass()); | 747 pass_list.push_back(root_pass.Pass()); |
747 | 748 |
748 // This test has alpha=254 for the software renderer vs. alpha=255 for the gl | 749 // This test has alpha=254 for the software renderer vs. alpha=255 for the gl |
749 // renderer so use a fuzzy comparator. | 750 // renderer so use a fuzzy comparator. |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 RenderPassDrawQuad::Create(); | 924 RenderPassDrawQuad::Create(); |
924 filter_pass_quad->SetNew( | 925 filter_pass_quad->SetNew( |
925 shared_state.get(), | 926 shared_state.get(), |
926 filter_pass_content_rect_, | 927 filter_pass_content_rect_, |
927 filter_pass_id, | 928 filter_pass_id, |
928 false, // is_replica | 929 false, // is_replica |
929 0, // mask_resource_id | 930 0, // mask_resource_id |
930 filter_pass_content_rect_, // contents_changed_since_last_frame | 931 filter_pass_content_rect_, // contents_changed_since_last_frame |
931 gfx::RectF(), // mask_uv_rect | 932 gfx::RectF(), // mask_uv_rect |
932 FilterOperations(), // filters | 933 FilterOperations(), // filters |
933 skia::RefPtr<SkImageFilter>(), // filter | |
934 this->background_filters_); | 934 this->background_filters_); |
935 root_pass->quad_list.push_back(filter_pass_quad.PassAs<DrawQuad>()); | 935 root_pass->quad_list.push_back(filter_pass_quad.PassAs<DrawQuad>()); |
936 root_pass->shared_quad_state_list.push_back(shared_state.Pass()); | 936 root_pass->shared_quad_state_list.push_back(shared_state.Pass()); |
937 } | 937 } |
938 | 938 |
939 const int kColumnWidth = device_viewport_rect.width() / 3; | 939 const int kColumnWidth = device_viewport_rect.width() / 3; |
940 | 940 |
941 gfx::Rect left_rect = gfx::Rect(0, 0, kColumnWidth, 20); | 941 gfx::Rect left_rect = gfx::Rect(0, 0, kColumnWidth, 20); |
942 for (int i = 0; left_rect.y() < device_viewport_rect.height(); ++i) { | 942 for (int i = 0; left_rect.y() < device_viewport_rect.height(); ++i) { |
943 scoped_ptr<SharedQuadState> shared_state = | 943 scoped_ptr<SharedQuadState> shared_state = |
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1668 EXPECT_TRUE(this->RunPixelTest( | 1668 EXPECT_TRUE(this->RunPixelTest( |
1669 &pass_list, | 1669 &pass_list, |
1670 PixelTest::NoOffscreenContext, | 1670 PixelTest::NoOffscreenContext, |
1671 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), | 1671 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), |
1672 ExactPixelComparator(true))); | 1672 ExactPixelComparator(true))); |
1673 } | 1673 } |
1674 #endif // !defined(OS_ANDROID) | 1674 #endif // !defined(OS_ANDROID) |
1675 | 1675 |
1676 } // namespace | 1676 } // namespace |
1677 } // namespace cc | 1677 } // namespace cc |
OLD | NEW |