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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 matrix[10] = 0.213f - 0.213f * amount; | 609 matrix[10] = 0.213f - 0.213f * amount; |
611 matrix[11] = 0.715f - 0.715f * amount; | 610 matrix[11] = 0.715f - 0.715f * amount; |
612 matrix[12] = 1.f - (matrix[10] + matrix[11]); | 611 matrix[12] = 1.f - (matrix[10] + matrix[11]); |
613 matrix[13] = matrix[14] = 0; | 612 matrix[13] = matrix[14] = 0; |
614 matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0; | 613 matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0; |
615 matrix[18] = 1; | 614 matrix[18] = 1; |
616 skia::RefPtr<SkColorFilter> colorFilter(skia::AdoptRef( | 615 skia::RefPtr<SkColorFilter> colorFilter(skia::AdoptRef( |
617 new SkColorMatrixFilter(matrix))); | 616 new SkColorMatrixFilter(matrix))); |
618 skia::RefPtr<SkImageFilter> filter = | 617 skia::RefPtr<SkImageFilter> filter = |
619 skia::AdoptRef(SkColorFilterImageFilter::Create(colorFilter.get(), NULL)); | 618 skia::AdoptRef(SkColorFilterImageFilter::Create(colorFilter.get(), NULL)); |
| 619 FilterOperations filters; |
| 620 filters.Append(FilterOperation::CreateReferenceFilter(filter)); |
620 | 621 |
621 scoped_ptr<RenderPassDrawQuad> render_pass_quad = | 622 scoped_ptr<RenderPassDrawQuad> render_pass_quad = |
622 RenderPassDrawQuad::Create(); | 623 RenderPassDrawQuad::Create(); |
623 render_pass_quad->SetNew(pass_shared_state.get(), | 624 render_pass_quad->SetNew(pass_shared_state.get(), |
624 pass_rect, | 625 pass_rect, |
625 child_pass_id, | 626 child_pass_id, |
626 false, | 627 false, |
627 0, | 628 0, |
628 pass_rect, | 629 pass_rect, |
629 gfx::RectF(), | 630 gfx::RectF(), |
630 FilterOperations(), | 631 filters, |
631 filter, | |
632 FilterOperations()); | 632 FilterOperations()); |
633 | 633 |
634 root_pass->quad_list.push_back(render_pass_quad.PassAs<DrawQuad>()); | 634 root_pass->quad_list.push_back(render_pass_quad.PassAs<DrawQuad>()); |
635 | 635 |
636 RenderPassList pass_list; | 636 RenderPassList pass_list; |
637 pass_list.push_back(child_pass.Pass()); | 637 pass_list.push_back(child_pass.Pass()); |
638 pass_list.push_back(root_pass.Pass()); | 638 pass_list.push_back(root_pass.Pass()); |
639 | 639 |
640 // This test has alpha=254 for the software renderer vs. alpha=255 for the gl | 640 // This test has alpha=254 for the software renderer vs. alpha=255 for the gl |
641 // renderer so use a fuzzy comparator. | 641 // renderer so use a fuzzy comparator. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 matrix[11] = 0.715f - 0.715f * amount; | 713 matrix[11] = 0.715f - 0.715f * amount; |
714 matrix[12] = 1.f - (matrix[10] + matrix[11]); | 714 matrix[12] = 1.f - (matrix[10] + matrix[11]); |
715 matrix[13] = 0; | 715 matrix[13] = 0; |
716 matrix[14] = 1.5f; | 716 matrix[14] = 1.5f; |
717 matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0; | 717 matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0; |
718 matrix[18] = 1; | 718 matrix[18] = 1; |
719 skia::RefPtr<SkColorFilter> colorFilter(skia::AdoptRef( | 719 skia::RefPtr<SkColorFilter> colorFilter(skia::AdoptRef( |
720 new SkColorMatrixFilter(matrix))); | 720 new SkColorMatrixFilter(matrix))); |
721 skia::RefPtr<SkImageFilter> filter = | 721 skia::RefPtr<SkImageFilter> filter = |
722 skia::AdoptRef(SkColorFilterImageFilter::Create(colorFilter.get(), NULL)); | 722 skia::AdoptRef(SkColorFilterImageFilter::Create(colorFilter.get(), NULL)); |
| 723 FilterOperations filters; |
| 724 filters.Append(FilterOperation::CreateReferenceFilter(filter)); |
723 | 725 |
724 scoped_ptr<RenderPassDrawQuad> render_pass_quad = | 726 scoped_ptr<RenderPassDrawQuad> render_pass_quad = |
725 RenderPassDrawQuad::Create(); | 727 RenderPassDrawQuad::Create(); |
726 render_pass_quad->SetNew(pass_shared_state.get(), | 728 render_pass_quad->SetNew(pass_shared_state.get(), |
727 pass_rect, | 729 pass_rect, |
728 child_pass_id, | 730 child_pass_id, |
729 false, | 731 false, |
730 0, | 732 0, |
731 pass_rect, | 733 pass_rect, |
732 gfx::RectF(), | 734 gfx::RectF(), |
733 FilterOperations(), | 735 filters, |
734 filter, | |
735 FilterOperations()); | 736 FilterOperations()); |
736 | 737 |
737 root_pass->quad_list.push_back(render_pass_quad.PassAs<DrawQuad>()); | 738 root_pass->quad_list.push_back(render_pass_quad.PassAs<DrawQuad>()); |
738 RenderPassList pass_list; | 739 RenderPassList pass_list; |
739 | 740 |
740 pass_list.push_back(child_pass.Pass()); | 741 pass_list.push_back(child_pass.Pass()); |
741 pass_list.push_back(root_pass.Pass()); | 742 pass_list.push_back(root_pass.Pass()); |
742 | 743 |
743 // This test has alpha=254 for the software renderer vs. alpha=255 for the gl | 744 // This test has alpha=254 for the software renderer vs. alpha=255 for the gl |
744 // renderer so use a fuzzy comparator. | 745 // renderer so use a fuzzy comparator. |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 RenderPassDrawQuad::Create(); | 919 RenderPassDrawQuad::Create(); |
919 filter_pass_quad->SetNew( | 920 filter_pass_quad->SetNew( |
920 shared_state.get(), | 921 shared_state.get(), |
921 filter_pass_content_rect_, | 922 filter_pass_content_rect_, |
922 filter_pass_id, | 923 filter_pass_id, |
923 false, // is_replica | 924 false, // is_replica |
924 0, // mask_resource_id | 925 0, // mask_resource_id |
925 filter_pass_content_rect_, // contents_changed_since_last_frame | 926 filter_pass_content_rect_, // contents_changed_since_last_frame |
926 gfx::RectF(), // mask_uv_rect | 927 gfx::RectF(), // mask_uv_rect |
927 FilterOperations(), // filters | 928 FilterOperations(), // filters |
928 skia::RefPtr<SkImageFilter>(), // filter | |
929 this->background_filters_); | 929 this->background_filters_); |
930 root_pass->quad_list.push_back(filter_pass_quad.PassAs<DrawQuad>()); | 930 root_pass->quad_list.push_back(filter_pass_quad.PassAs<DrawQuad>()); |
931 root_pass->shared_quad_state_list.push_back(shared_state.Pass()); | 931 root_pass->shared_quad_state_list.push_back(shared_state.Pass()); |
932 } | 932 } |
933 | 933 |
934 const int kColumnWidth = device_viewport_rect.width() / 3; | 934 const int kColumnWidth = device_viewport_rect.width() / 3; |
935 | 935 |
936 gfx::Rect left_rect = gfx::Rect(0, 0, kColumnWidth, 20); | 936 gfx::Rect left_rect = gfx::Rect(0, 0, kColumnWidth, 20); |
937 for (int i = 0; left_rect.y() < device_viewport_rect.height(); ++i) { | 937 for (int i = 0; left_rect.y() < device_viewport_rect.height(); ++i) { |
938 scoped_ptr<SharedQuadState> shared_state = | 938 scoped_ptr<SharedQuadState> shared_state = |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1638 EXPECT_TRUE(this->RunPixelTest( | 1638 EXPECT_TRUE(this->RunPixelTest( |
1639 &pass_list, | 1639 &pass_list, |
1640 PixelTest::NoOffscreenContext, | 1640 PixelTest::NoOffscreenContext, |
1641 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), | 1641 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), |
1642 ExactPixelComparator(true))); | 1642 ExactPixelComparator(true))); |
1643 } | 1643 } |
1644 #endif // !defined(OS_ANDROID) | 1644 #endif // !defined(OS_ANDROID) |
1645 | 1645 |
1646 } // namespace | 1646 } // namespace |
1647 } // namespace cc | 1647 } // namespace cc |
OLD | NEW |