| 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 "cc/compositor_frame.h" | 9 #include "cc/compositor_frame.h" |
| 10 #include "ipc/ipc_message.h" | 10 #include "ipc/ipc_message.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 EXPECT_EQ(a->output_rect.ToString(), b->output_rect.ToString()); | 40 EXPECT_EQ(a->output_rect.ToString(), b->output_rect.ToString()); |
| 41 EXPECT_EQ(a->damage_rect.ToString(), b->damage_rect.ToString()); | 41 EXPECT_EQ(a->damage_rect.ToString(), b->damage_rect.ToString()); |
| 42 EXPECT_EQ(a->transform_to_root_target, b->transform_to_root_target); | 42 EXPECT_EQ(a->transform_to_root_target, b->transform_to_root_target); |
| 43 EXPECT_EQ(a->has_transparent_background, b->has_transparent_background); | 43 EXPECT_EQ(a->has_transparent_background, b->has_transparent_background); |
| 44 EXPECT_EQ(a->has_occlusion_from_outside_target_surface, | 44 EXPECT_EQ(a->has_occlusion_from_outside_target_surface, |
| 45 b->has_occlusion_from_outside_target_surface); | 45 b->has_occlusion_from_outside_target_surface); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void Compare(const SharedQuadState* a, const SharedQuadState* b) { | 48 void Compare(const SharedQuadState* a, const SharedQuadState* b) { |
| 49 EXPECT_EQ(a->content_to_target_transform, b->content_to_target_transform); | 49 EXPECT_EQ(a->content_to_target_transform, b->content_to_target_transform); |
| 50 EXPECT_EQ(a->content_bounds, b->content_bounds); |
| 50 EXPECT_EQ(a->visible_content_rect, b->visible_content_rect); | 51 EXPECT_EQ(a->visible_content_rect, b->visible_content_rect); |
| 51 EXPECT_EQ(a->clip_rect, b->clip_rect); | 52 EXPECT_EQ(a->clip_rect, b->clip_rect); |
| 52 EXPECT_EQ(a->is_clipped, b->is_clipped); | 53 EXPECT_EQ(a->is_clipped, b->is_clipped); |
| 53 EXPECT_EQ(a->opacity, b->opacity); | 54 EXPECT_EQ(a->opacity, b->opacity); |
| 54 } | 55 } |
| 55 | 56 |
| 56 void Compare(const DrawQuad* a, const DrawQuad* b) { | 57 void Compare(const DrawQuad* a, const DrawQuad* b) { |
| 57 ASSERT_NE(DrawQuad::INVALID, a->material); | 58 ASSERT_NE(DrawQuad::INVALID, a->material); |
| 58 ASSERT_EQ(a->material, b->material); | 59 ASSERT_EQ(a->material, b->material); |
| 59 EXPECT_EQ(a->rect.ToString(), b->rect.ToString()); | 60 EXPECT_EQ(a->rect.ToString(), b->rect.ToString()); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 EXPECT_EQ(a->vertex_opacity[2], b->vertex_opacity[2]); | 151 EXPECT_EQ(a->vertex_opacity[2], b->vertex_opacity[2]); |
| 151 EXPECT_EQ(a->vertex_opacity[3], b->vertex_opacity[3]); | 152 EXPECT_EQ(a->vertex_opacity[3], b->vertex_opacity[3]); |
| 152 EXPECT_EQ(a->flipped, b->flipped); | 153 EXPECT_EQ(a->flipped, b->flipped); |
| 153 } | 154 } |
| 154 | 155 |
| 155 void Compare(const TileDrawQuad* a, const TileDrawQuad* b) { | 156 void Compare(const TileDrawQuad* a, const TileDrawQuad* b) { |
| 156 EXPECT_EQ(a->resource_id, b->resource_id); | 157 EXPECT_EQ(a->resource_id, b->resource_id); |
| 157 EXPECT_EQ(a->tex_coord_rect, b->tex_coord_rect); | 158 EXPECT_EQ(a->tex_coord_rect, b->tex_coord_rect); |
| 158 EXPECT_EQ(a->texture_size, b->texture_size); | 159 EXPECT_EQ(a->texture_size, b->texture_size); |
| 159 EXPECT_EQ(a->swizzle_contents, b->swizzle_contents); | 160 EXPECT_EQ(a->swizzle_contents, b->swizzle_contents); |
| 160 EXPECT_EQ(a->left_edge_aa, b->left_edge_aa); | |
| 161 EXPECT_EQ(a->top_edge_aa, b->top_edge_aa); | |
| 162 EXPECT_EQ(a->right_edge_aa, b->right_edge_aa); | |
| 163 EXPECT_EQ(a->bottom_edge_aa, b->bottom_edge_aa); | |
| 164 } | 161 } |
| 165 | 162 |
| 166 void Compare(const YUVVideoDrawQuad* a, const YUVVideoDrawQuad* b) { | 163 void Compare(const YUVVideoDrawQuad* a, const YUVVideoDrawQuad* b) { |
| 167 EXPECT_EQ(a->tex_scale, b->tex_scale); | 164 EXPECT_EQ(a->tex_scale, b->tex_scale); |
| 168 EXPECT_EQ(a->y_plane.resourceId, b->y_plane.resourceId); | 165 EXPECT_EQ(a->y_plane.resourceId, b->y_plane.resourceId); |
| 169 EXPECT_EQ(a->y_plane.size.ToString(), b->y_plane.size.ToString()); | 166 EXPECT_EQ(a->y_plane.size.ToString(), b->y_plane.size.ToString()); |
| 170 EXPECT_EQ(a->y_plane.format, b->y_plane.format); | 167 EXPECT_EQ(a->y_plane.format, b->y_plane.format); |
| 171 EXPECT_EQ(a->u_plane.resourceId, b->u_plane.resourceId); | 168 EXPECT_EQ(a->u_plane.resourceId, b->u_plane.resourceId); |
| 172 EXPECT_EQ(a->u_plane.size.ToString(), b->u_plane.size.ToString()); | 169 EXPECT_EQ(a->u_plane.size.ToString(), b->u_plane.size.ToString()); |
| 173 EXPECT_EQ(a->u_plane.format, b->u_plane.format); | 170 EXPECT_EQ(a->u_plane.format, b->u_plane.format); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 204 gfx::SizeF arbitrary_sizef1(15.2f, 104.6f); | 201 gfx::SizeF arbitrary_sizef1(15.2f, 104.6f); |
| 205 gfx::PointF arbitrary_pointf1(31.4f, 15.9f); | 202 gfx::PointF arbitrary_pointf1(31.4f, 15.9f); |
| 206 gfx::PointF arbitrary_pointf2(26.5f, -35.8f); | 203 gfx::PointF arbitrary_pointf2(26.5f, -35.8f); |
| 207 float arbitrary_float1 = 0.7f; | 204 float arbitrary_float1 = 0.7f; |
| 208 float arbitrary_float2 = 0.3f; | 205 float arbitrary_float2 = 0.3f; |
| 209 float arbitrary_float3 = 0.9f; | 206 float arbitrary_float3 = 0.9f; |
| 210 float arbitrary_float_array[4] = {3.5f, 6.2f, 9.3f, 12.3f}; | 207 float arbitrary_float_array[4] = {3.5f, 6.2f, 9.3f, 12.3f}; |
| 211 bool arbitrary_bool1 = true; | 208 bool arbitrary_bool1 = true; |
| 212 bool arbitrary_bool2 = false; | 209 bool arbitrary_bool2 = false; |
| 213 bool arbitrary_bool3 = true; | 210 bool arbitrary_bool3 = true; |
| 214 bool arbitrary_bool4 = true; | |
| 215 bool arbitrary_bool5 = false; | |
| 216 bool arbitrary_bool6 = true; | |
| 217 int arbitrary_int = 5; | 211 int arbitrary_int = 5; |
| 218 SkColor arbitrary_color = SkColorSetARGB(25, 36, 47, 58); | 212 SkColor arbitrary_color = SkColorSetARGB(25, 36, 47, 58); |
| 219 IOSurfaceDrawQuad::Orientation arbitrary_orientation = | 213 IOSurfaceDrawQuad::Orientation arbitrary_orientation = |
| 220 IOSurfaceDrawQuad::UNFLIPPED; | 214 IOSurfaceDrawQuad::UNFLIPPED; |
| 221 RenderPass::Id arbitrary_id(10, 14); | 215 RenderPass::Id arbitrary_id(10, 14); |
| 222 ResourceProvider::ResourceId arbitrary_resourceid = 55; | 216 ResourceProvider::ResourceId arbitrary_resourceid = 55; |
| 223 | 217 |
| 224 VideoLayerImpl::FramePlane arbitrary_plane1; | 218 VideoLayerImpl::FramePlane arbitrary_plane1; |
| 225 arbitrary_plane1.resourceId = arbitrary_resourceid; | 219 arbitrary_plane1.resourceId = arbitrary_resourceid; |
| 226 arbitrary_plane1.size = arbitrary_size1; | 220 arbitrary_plane1.size = arbitrary_size1; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 242 | 236 |
| 243 WebFilterOperations arbitrary_filters2; | 237 WebFilterOperations arbitrary_filters2; |
| 244 arbitrary_filters2.append(WebFilterOperation::createBrightnessFilter( | 238 arbitrary_filters2.append(WebFilterOperation::createBrightnessFilter( |
| 245 arbitrary_float2)); | 239 arbitrary_float2)); |
| 246 | 240 |
| 247 // TODO(danakj): filter is not serialized. | 241 // TODO(danakj): filter is not serialized. |
| 248 skia::RefPtr<SkImageFilter> arbitrary_filter; | 242 skia::RefPtr<SkImageFilter> arbitrary_filter; |
| 249 | 243 |
| 250 scoped_ptr<SharedQuadState> shared_state1_in = SharedQuadState::Create(); | 244 scoped_ptr<SharedQuadState> shared_state1_in = SharedQuadState::Create(); |
| 251 shared_state1_in->SetAll(arbitrary_matrix, | 245 shared_state1_in->SetAll(arbitrary_matrix, |
| 246 arbitrary_size1, |
| 252 arbitrary_rect1, | 247 arbitrary_rect1, |
| 253 arbitrary_rect2, | 248 arbitrary_rect2, |
| 254 arbitrary_bool1, | 249 arbitrary_bool1, |
| 255 arbitrary_float1); | 250 arbitrary_float1); |
| 256 scoped_ptr<SharedQuadState> shared_state1_cmp = shared_state1_in->Copy(); | 251 scoped_ptr<SharedQuadState> shared_state1_cmp = shared_state1_in->Copy(); |
| 257 | 252 |
| 258 scoped_ptr<CheckerboardDrawQuad> checkerboard_in = | 253 scoped_ptr<CheckerboardDrawQuad> checkerboard_in = |
| 259 CheckerboardDrawQuad::Create(); | 254 CheckerboardDrawQuad::Create(); |
| 260 checkerboard_in->SetAll(shared_state1_in.get(), | 255 checkerboard_in->SetAll(shared_state1_in.get(), |
| 261 arbitrary_rect1, | 256 arbitrary_rect1, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 arbitrary_rect1, | 299 arbitrary_rect1, |
| 305 arbitrary_rectf1, | 300 arbitrary_rectf1, |
| 306 arbitrary_filters1, | 301 arbitrary_filters1, |
| 307 arbitrary_filter, // TODO(piman): not serialized. | 302 arbitrary_filter, // TODO(piman): not serialized. |
| 308 arbitrary_filters2); | 303 arbitrary_filters2); |
| 309 scoped_ptr<RenderPassDrawQuad> renderpass_cmp = renderpass_in->Copy( | 304 scoped_ptr<RenderPassDrawQuad> renderpass_cmp = renderpass_in->Copy( |
| 310 renderpass_in->shared_quad_state, renderpass_in->render_pass_id); | 305 renderpass_in->shared_quad_state, renderpass_in->render_pass_id); |
| 311 | 306 |
| 312 scoped_ptr<SharedQuadState> shared_state2_in = SharedQuadState::Create(); | 307 scoped_ptr<SharedQuadState> shared_state2_in = SharedQuadState::Create(); |
| 313 shared_state2_in->SetAll(arbitrary_matrix, | 308 shared_state2_in->SetAll(arbitrary_matrix, |
| 309 arbitrary_size2, |
| 314 arbitrary_rect2, | 310 arbitrary_rect2, |
| 315 arbitrary_rect3, | 311 arbitrary_rect3, |
| 316 arbitrary_bool1, | 312 arbitrary_bool1, |
| 317 arbitrary_float2); | 313 arbitrary_float2); |
| 318 scoped_ptr<SharedQuadState> shared_state2_cmp = shared_state2_in->Copy(); | 314 scoped_ptr<SharedQuadState> shared_state2_cmp = shared_state2_in->Copy(); |
| 319 | 315 |
| 320 scoped_ptr<SharedQuadState> shared_state3_in = SharedQuadState::Create(); | 316 scoped_ptr<SharedQuadState> shared_state3_in = SharedQuadState::Create(); |
| 321 shared_state3_in->SetAll(arbitrary_matrix, | 317 shared_state3_in->SetAll(arbitrary_matrix, |
| 318 arbitrary_size3, |
| 322 arbitrary_rect3, | 319 arbitrary_rect3, |
| 323 arbitrary_rect1, | 320 arbitrary_rect1, |
| 324 arbitrary_bool1, | 321 arbitrary_bool1, |
| 325 arbitrary_float3); | 322 arbitrary_float3); |
| 326 scoped_ptr<SharedQuadState> shared_state3_cmp = shared_state3_in->Copy(); | 323 scoped_ptr<SharedQuadState> shared_state3_cmp = shared_state3_in->Copy(); |
| 327 | 324 |
| 328 scoped_ptr<SolidColorDrawQuad> solidcolor_in = | 325 scoped_ptr<SolidColorDrawQuad> solidcolor_in = |
| 329 SolidColorDrawQuad::Create(); | 326 SolidColorDrawQuad::Create(); |
| 330 solidcolor_in->SetAll(shared_state1_in.get(), | 327 solidcolor_in->SetAll(shared_state1_in.get(), |
| 331 arbitrary_rect3, | 328 arbitrary_rect3, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 | 362 |
| 366 scoped_ptr<TileDrawQuad> tile_in = TileDrawQuad::Create(); | 363 scoped_ptr<TileDrawQuad> tile_in = TileDrawQuad::Create(); |
| 367 tile_in->SetAll(shared_state1_in.get(), | 364 tile_in->SetAll(shared_state1_in.get(), |
| 368 arbitrary_rect2, | 365 arbitrary_rect2, |
| 369 arbitrary_rect3, | 366 arbitrary_rect3, |
| 370 arbitrary_rect1, | 367 arbitrary_rect1, |
| 371 arbitrary_bool1, | 368 arbitrary_bool1, |
| 372 arbitrary_resourceid, | 369 arbitrary_resourceid, |
| 373 arbitrary_rectf1, | 370 arbitrary_rectf1, |
| 374 arbitrary_size1, | 371 arbitrary_size1, |
| 375 arbitrary_bool2, | 372 arbitrary_bool2); |
| 376 arbitrary_bool3, | |
| 377 arbitrary_bool4, | |
| 378 arbitrary_bool5, | |
| 379 arbitrary_bool6); | |
| 380 scoped_ptr<DrawQuad> tile_cmp = tile_in->Copy( | 373 scoped_ptr<DrawQuad> tile_cmp = tile_in->Copy( |
| 381 tile_in->shared_quad_state); | 374 tile_in->shared_quad_state); |
| 382 | 375 |
| 383 scoped_ptr<YUVVideoDrawQuad> yuvvideo_in = | 376 scoped_ptr<YUVVideoDrawQuad> yuvvideo_in = |
| 384 YUVVideoDrawQuad::Create(); | 377 YUVVideoDrawQuad::Create(); |
| 385 yuvvideo_in->SetAll(shared_state1_in.get(), | 378 yuvvideo_in->SetAll(shared_state1_in.get(), |
| 386 arbitrary_rect1, | 379 arbitrary_rect1, |
| 387 arbitrary_rect2, | 380 arbitrary_rect2, |
| 388 arbitrary_rect3, | 381 arbitrary_rect3, |
| 389 arbitrary_bool1, | 382 arbitrary_bool1, |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 EXPECT_TRUE(IPC::ParamTraits<DelegatedFrameData>::Read(&msg, | 529 EXPECT_TRUE(IPC::ParamTraits<DelegatedFrameData>::Read(&msg, |
| 537 &iter, &frame_out)); | 530 &iter, &frame_out)); |
| 538 | 531 |
| 539 ASSERT_EQ(2u, frame_out.resource_list.size()); | 532 ASSERT_EQ(2u, frame_out.resource_list.size()); |
| 540 Compare(arbitrary_resource1, frame_out.resource_list[0]); | 533 Compare(arbitrary_resource1, frame_out.resource_list[0]); |
| 541 Compare(arbitrary_resource2, frame_out.resource_list[1]); | 534 Compare(arbitrary_resource2, frame_out.resource_list[1]); |
| 542 } | 535 } |
| 543 | 536 |
| 544 } // namespace | 537 } // namespace |
| 545 } // namespace content | 538 } // namespace content |
| OLD | NEW |