Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: cc/ipc/struct_traits_unittest.cc

Issue 2873593002: Force use of and cache render surface. (Closed)
Patch Set: Reduce unneeded code in surface aggregator and add more test. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <utility> 5 #include <utility>
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "cc/input/selection.h" 9 #include "cc/input/selection.h"
10 #include "cc/ipc/copy_output_request_struct_traits.h" 10 #include "cc/ipc/copy_output_request_struct_traits.h"
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 const gfx::Rect damage_rect(56, 123, 19, 43); 824 const gfx::Rect damage_rect(56, 123, 19, 43);
825 FilterOperations filters; 825 FilterOperations filters;
826 filters.Append(FilterOperation::CreateBlurFilter(0.f)); 826 filters.Append(FilterOperation::CreateBlurFilter(0.f));
827 filters.Append(FilterOperation::CreateZoomFilter(2.0f, 1)); 827 filters.Append(FilterOperation::CreateZoomFilter(2.0f, 1));
828 FilterOperations background_filters; 828 FilterOperations background_filters;
829 background_filters.Append(FilterOperation::CreateSaturateFilter(4.f)); 829 background_filters.Append(FilterOperation::CreateSaturateFilter(4.f));
830 background_filters.Append(FilterOperation::CreateZoomFilter(2.0f, 1)); 830 background_filters.Append(FilterOperation::CreateZoomFilter(2.0f, 1));
831 background_filters.Append(FilterOperation::CreateSaturateFilter(2.f)); 831 background_filters.Append(FilterOperation::CreateSaturateFilter(2.f));
832 gfx::ColorSpace color_space = gfx::ColorSpace::CreateXYZD50(); 832 gfx::ColorSpace color_space = gfx::ColorSpace::CreateXYZD50();
833 const bool has_transparent_background = true; 833 const bool has_transparent_background = true;
834 const bool should_cache_render_surface = false;
835 const bool has_damage_from_contributing_content = false;
834 std::unique_ptr<RenderPass> input = RenderPass::Create(); 836 std::unique_ptr<RenderPass> input = RenderPass::Create();
835 input->SetAll(render_pass_id, output_rect, damage_rect, transform_to_root, 837 input->SetAll(render_pass_id, output_rect, damage_rect, transform_to_root,
836 filters, background_filters, color_space, 838 filters, background_filters, color_space,
837 has_transparent_background); 839 has_transparent_background, should_cache_render_surface,
840 has_damage_from_contributing_content);
838 841
839 SharedQuadState* shared_state_1 = input->CreateAndAppendSharedQuadState(); 842 SharedQuadState* shared_state_1 = input->CreateAndAppendSharedQuadState();
840 shared_state_1->SetAll( 843 shared_state_1->SetAll(
841 gfx::Transform(16.1f, 15.3f, 14.3f, 13.7f, 12.2f, 11.4f, 10.4f, 9.8f, 844 gfx::Transform(16.1f, 15.3f, 14.3f, 13.7f, 12.2f, 11.4f, 10.4f, 9.8f,
842 8.1f, 7.3f, 6.3f, 5.7f, 4.8f, 3.4f, 2.4f, 1.2f), 845 8.1f, 7.3f, 6.3f, 5.7f, 4.8f, 3.4f, 2.4f, 1.2f),
843 gfx::Rect(1, 2), gfx::Rect(1337, 5679, 9101112, 131415), 846 gfx::Rect(1, 2), gfx::Rect(1337, 5679, 9101112, 131415),
844 gfx::Rect(1357, 2468, 121314, 1337), true, 2, SkBlendMode::kSrcOver, 1); 847 gfx::Rect(1357, 2468, 121314, 1337), true, 2, SkBlendMode::kSrcOver, 1);
845 848
846 SharedQuadState* shared_state_2 = input->CreateAndAppendSharedQuadState(); 849 SharedQuadState* shared_state_2 = input->CreateAndAppendSharedQuadState();
847 shared_state_2->SetAll( 850 shared_state_2->SetAll(
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 TEST_F(StructTraitsTest, RenderPassWithEmptySharedQuadStateList) { 945 TEST_F(StructTraitsTest, RenderPassWithEmptySharedQuadStateList) {
943 const RenderPassId render_pass_id = 3u; 946 const RenderPassId render_pass_id = 3u;
944 const gfx::Rect output_rect(45, 22, 120, 13); 947 const gfx::Rect output_rect(45, 22, 120, 13);
945 const gfx::Transform transform_to_root = 948 const gfx::Transform transform_to_root =
946 gfx::Transform(1.0, 0.5, 0.5, -0.5, -1.0, 0.0); 949 gfx::Transform(1.0, 0.5, 0.5, -0.5, -1.0, 0.0);
947 const gfx::Rect damage_rect(56, 123, 19, 43); 950 const gfx::Rect damage_rect(56, 123, 19, 43);
948 SkMatrix44 to_XYZD50; 951 SkMatrix44 to_XYZD50;
949 SkColorSpaceTransferFn fn = {1, 0, 1, 0, 0, 0, 1}; 952 SkColorSpaceTransferFn fn = {1, 0, 1, 0, 0, 0, 1};
950 gfx::ColorSpace color_space = gfx::ColorSpace::CreateCustom(to_XYZD50, fn); 953 gfx::ColorSpace color_space = gfx::ColorSpace::CreateCustom(to_XYZD50, fn);
951 const bool has_transparent_background = true; 954 const bool has_transparent_background = true;
955 const bool should_cache_render_surface = false;
956 const bool has_damage_from_contributing_content = false;
952 std::unique_ptr<RenderPass> input = RenderPass::Create(); 957 std::unique_ptr<RenderPass> input = RenderPass::Create();
953 input->SetAll(render_pass_id, output_rect, damage_rect, transform_to_root, 958 input->SetAll(render_pass_id, output_rect, damage_rect, transform_to_root,
954 FilterOperations(), FilterOperations(), color_space, 959 FilterOperations(), FilterOperations(), color_space,
955 has_transparent_background); 960 has_transparent_background, should_cache_render_surface,
961 has_damage_from_contributing_content);
956 962
957 // Unlike the previous test, don't add any quads to the list; we need to 963 // Unlike the previous test, don't add any quads to the list; we need to
958 // verify that the serialization code can deal with that. 964 // verify that the serialization code can deal with that.
959 std::unique_ptr<RenderPass> output; 965 std::unique_ptr<RenderPass> output;
960 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); 966 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy();
961 proxy->EchoRenderPass(input->DeepCopy(), &output); 967 proxy->EchoRenderPass(input->DeepCopy(), &output);
962 968
963 EXPECT_EQ(input->quad_list.size(), output->quad_list.size()); 969 EXPECT_EQ(input->quad_list.size(), output->quad_list.size());
964 EXPECT_EQ(input->shared_quad_state_list.size(), 970 EXPECT_EQ(input->shared_quad_state_list.size(),
965 output->shared_quad_state_list.size()); 971 output->shared_quad_state_list.size());
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 EXPECT_EQ(v_plane_resource_id, out_quad->v_plane_resource_id()); 1230 EXPECT_EQ(v_plane_resource_id, out_quad->v_plane_resource_id());
1225 EXPECT_EQ(a_plane_resource_id, out_quad->a_plane_resource_id()); 1231 EXPECT_EQ(a_plane_resource_id, out_quad->a_plane_resource_id());
1226 EXPECT_EQ(color_space, out_quad->color_space); 1232 EXPECT_EQ(color_space, out_quad->color_space);
1227 EXPECT_EQ(resource_offset, out_quad->resource_offset); 1233 EXPECT_EQ(resource_offset, out_quad->resource_offset);
1228 EXPECT_EQ(resource_multiplier, out_quad->resource_multiplier); 1234 EXPECT_EQ(resource_multiplier, out_quad->resource_multiplier);
1229 EXPECT_EQ(bits_per_channel, out_quad->bits_per_channel); 1235 EXPECT_EQ(bits_per_channel, out_quad->bits_per_channel);
1230 EXPECT_EQ(require_overlay, out_quad->require_overlay); 1236 EXPECT_EQ(require_overlay, out_quad->require_overlay);
1231 } 1237 }
1232 1238
1233 } // namespace cc 1239 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698