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