| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "content/common/cc_messages.h" | 5 #include "content/common/cc_messages.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "cc/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 EXPECT_EQ(a->orientation, b->orientation); | 129 EXPECT_EQ(a->orientation, b->orientation); |
| 130 } | 130 } |
| 131 | 131 |
| 132 void Compare(const RenderPassDrawQuad* a, const RenderPassDrawQuad* b) { | 132 void Compare(const RenderPassDrawQuad* a, const RenderPassDrawQuad* b) { |
| 133 EXPECT_EQ(a->render_pass_id, b->render_pass_id); | 133 EXPECT_EQ(a->render_pass_id, b->render_pass_id); |
| 134 EXPECT_EQ(a->is_replica, b->is_replica); | 134 EXPECT_EQ(a->is_replica, b->is_replica); |
| 135 EXPECT_EQ(a->mask_resource_id, b->mask_resource_id); | 135 EXPECT_EQ(a->mask_resource_id, b->mask_resource_id); |
| 136 EXPECT_EQ(a->contents_changed_since_last_frame, | 136 EXPECT_EQ(a->contents_changed_since_last_frame, |
| 137 b->contents_changed_since_last_frame); | 137 b->contents_changed_since_last_frame); |
| 138 EXPECT_EQ(a->mask_uv_rect.ToString(), b->mask_uv_rect.ToString()); | 138 EXPECT_EQ(a->mask_uv_rect.ToString(), b->mask_uv_rect.ToString()); |
| 139 EXPECT_EQ(a->filters, b->filters); | 139 EXPECT_EQ(a->filters.size(), b->filters.size()); |
| 140 if (!a->filter || !b->filter) | 140 for (size_t i = 0; i < a->filters.size(); ++i) { |
| 141 EXPECT_EQ(a->filter, b->filter); | 141 if (a->filters.at(i).type() != cc::FilterOperation::REFERENCE) { |
| 142 else | 142 EXPECT_EQ(a->filters.at(i), b->filters.at(i)); |
| 143 EXPECT_EQ(a->filter->countInputs(), b->filter->countInputs()); | 143 } else { |
| 144 EXPECT_EQ(b->filters.at(i).type(), cc::FilterOperation::REFERENCE); |
| 145 EXPECT_EQ(a->filters.at(i).image_filter()->countInputs(), |
| 146 b->filters.at(i).image_filter()->countInputs()); |
| 147 } |
| 148 } |
| 144 EXPECT_EQ(a->background_filters, b->background_filters); | 149 EXPECT_EQ(a->background_filters, b->background_filters); |
| 145 } | 150 } |
| 146 | 151 |
| 147 void Compare(const SolidColorDrawQuad* a, const SolidColorDrawQuad* b) { | 152 void Compare(const SolidColorDrawQuad* a, const SolidColorDrawQuad* b) { |
| 148 EXPECT_EQ(a->color, b->color); | 153 EXPECT_EQ(a->color, b->color); |
| 149 EXPECT_EQ(a->force_anti_aliasing_off, b->force_anti_aliasing_off); | 154 EXPECT_EQ(a->force_anti_aliasing_off, b->force_anti_aliasing_off); |
| 150 } | 155 } |
| 151 | 156 |
| 152 void Compare(const StreamVideoDrawQuad* a, const StreamVideoDrawQuad* b) { | 157 void Compare(const StreamVideoDrawQuad* a, const StreamVideoDrawQuad* b) { |
| 153 EXPECT_EQ(a->resource_id, b->resource_id); | 158 EXPECT_EQ(a->resource_id, b->resource_id); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 RenderPass::Id arbitrary_id(10, 14); | 233 RenderPass::Id arbitrary_id(10, 14); |
| 229 ResourceProvider::ResourceId arbitrary_resourceid1 = 55; | 234 ResourceProvider::ResourceId arbitrary_resourceid1 = 55; |
| 230 ResourceProvider::ResourceId arbitrary_resourceid2 = 47; | 235 ResourceProvider::ResourceId arbitrary_resourceid2 = 47; |
| 231 ResourceProvider::ResourceId arbitrary_resourceid3 = 23; | 236 ResourceProvider::ResourceId arbitrary_resourceid3 = 23; |
| 232 ResourceProvider::ResourceId arbitrary_resourceid4 = 16; | 237 ResourceProvider::ResourceId arbitrary_resourceid4 = 16; |
| 233 SkScalar arbitrary_sigma = SkFloatToScalar(2.0f); | 238 SkScalar arbitrary_sigma = SkFloatToScalar(2.0f); |
| 234 | 239 |
| 235 FilterOperations arbitrary_filters1; | 240 FilterOperations arbitrary_filters1; |
| 236 arbitrary_filters1.Append(FilterOperation::CreateGrayscaleFilter( | 241 arbitrary_filters1.Append(FilterOperation::CreateGrayscaleFilter( |
| 237 arbitrary_float1)); | 242 arbitrary_float1)); |
| 243 skia::RefPtr<SkImageFilter> arbitrary_filter = skia::AdoptRef( |
| 244 new SkBlurImageFilter(arbitrary_sigma, arbitrary_sigma)); |
| 245 arbitrary_filters1.Append( |
| 246 cc::FilterOperation::CreateReferenceFilter(arbitrary_filter)); |
| 238 | 247 |
| 239 FilterOperations arbitrary_filters2; | 248 FilterOperations arbitrary_filters2; |
| 240 arbitrary_filters2.Append(FilterOperation::CreateBrightnessFilter( | 249 arbitrary_filters2.Append(FilterOperation::CreateBrightnessFilter( |
| 241 arbitrary_float2)); | 250 arbitrary_float2)); |
| 242 | 251 |
| 243 skia::RefPtr<SkImageFilter> arbitrary_filter = skia::AdoptRef( | |
| 244 new SkBlurImageFilter(arbitrary_sigma, arbitrary_sigma)); | |
| 245 | |
| 246 scoped_ptr<SharedQuadState> shared_state1_in = SharedQuadState::Create(); | 252 scoped_ptr<SharedQuadState> shared_state1_in = SharedQuadState::Create(); |
| 247 shared_state1_in->SetAll(arbitrary_matrix, | 253 shared_state1_in->SetAll(arbitrary_matrix, |
| 248 arbitrary_size1, | 254 arbitrary_size1, |
| 249 arbitrary_rect1, | 255 arbitrary_rect1, |
| 250 arbitrary_rect2, | 256 arbitrary_rect2, |
| 251 arbitrary_bool1, | 257 arbitrary_bool1, |
| 252 arbitrary_float1); | 258 arbitrary_float1); |
| 253 scoped_ptr<SharedQuadState> shared_state1_cmp = shared_state1_in->Copy(); | 259 scoped_ptr<SharedQuadState> shared_state1_cmp = shared_state1_in->Copy(); |
| 254 | 260 |
| 255 scoped_ptr<CheckerboardDrawQuad> checkerboard_in = | 261 scoped_ptr<CheckerboardDrawQuad> checkerboard_in = |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 arbitrary_rect1, | 300 arbitrary_rect1, |
| 295 arbitrary_rect2, | 301 arbitrary_rect2, |
| 296 arbitrary_rect3, | 302 arbitrary_rect3, |
| 297 arbitrary_bool1, | 303 arbitrary_bool1, |
| 298 arbitrary_id, | 304 arbitrary_id, |
| 299 arbitrary_bool2, | 305 arbitrary_bool2, |
| 300 arbitrary_resourceid2, | 306 arbitrary_resourceid2, |
| 301 arbitrary_rect1, | 307 arbitrary_rect1, |
| 302 arbitrary_rectf1, | 308 arbitrary_rectf1, |
| 303 arbitrary_filters1, | 309 arbitrary_filters1, |
| 304 arbitrary_filter, | |
| 305 arbitrary_filters2); | 310 arbitrary_filters2); |
| 306 scoped_ptr<RenderPassDrawQuad> renderpass_cmp = renderpass_in->Copy( | 311 scoped_ptr<RenderPassDrawQuad> renderpass_cmp = renderpass_in->Copy( |
| 307 renderpass_in->shared_quad_state, renderpass_in->render_pass_id); | 312 renderpass_in->shared_quad_state, renderpass_in->render_pass_id); |
| 308 | 313 |
| 309 scoped_ptr<SharedQuadState> shared_state2_in = SharedQuadState::Create(); | 314 scoped_ptr<SharedQuadState> shared_state2_in = SharedQuadState::Create(); |
| 310 shared_state2_in->SetAll(arbitrary_matrix, | 315 shared_state2_in->SetAll(arbitrary_matrix, |
| 311 arbitrary_size2, | 316 arbitrary_size2, |
| 312 arbitrary_rect2, | 317 arbitrary_rect2, |
| 313 arbitrary_rect3, | 318 arbitrary_rect3, |
| 314 arbitrary_bool1, | 319 arbitrary_bool1, |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 EXPECT_TRUE(IPC::ParamTraits<DelegatedFrameData>::Read(&msg, | 539 EXPECT_TRUE(IPC::ParamTraits<DelegatedFrameData>::Read(&msg, |
| 535 &iter, &frame_out)); | 540 &iter, &frame_out)); |
| 536 | 541 |
| 537 ASSERT_EQ(2u, frame_out.resource_list.size()); | 542 ASSERT_EQ(2u, frame_out.resource_list.size()); |
| 538 Compare(arbitrary_resource1, frame_out.resource_list[0]); | 543 Compare(arbitrary_resource1, frame_out.resource_list[0]); |
| 539 Compare(arbitrary_resource2, frame_out.resource_list[1]); | 544 Compare(arbitrary_resource2, frame_out.resource_list[1]); |
| 540 } | 545 } |
| 541 | 546 |
| 542 } // namespace | 547 } // namespace |
| 543 } // namespace content | 548 } // namespace content |
| OLD | NEW |