| 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/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
| 10 #include "ipc/ipc_message.h" | 10 #include "ipc/ipc_message.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 EXPECT_EQ(a->color, b->color); | 115 EXPECT_EQ(a->color, b->color); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void Compare(const DebugBorderDrawQuad* a, const DebugBorderDrawQuad* b) { | 118 void Compare(const DebugBorderDrawQuad* a, const DebugBorderDrawQuad* b) { |
| 119 EXPECT_EQ(a->color, b->color); | 119 EXPECT_EQ(a->color, b->color); |
| 120 EXPECT_EQ(a->width, b->width); | 120 EXPECT_EQ(a->width, b->width); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void Compare(const IOSurfaceDrawQuad* a, const IOSurfaceDrawQuad* b) { | 123 void Compare(const IOSurfaceDrawQuad* a, const IOSurfaceDrawQuad* b) { |
| 124 EXPECT_EQ(a->io_surface_size.ToString(), b->io_surface_size.ToString()); | 124 EXPECT_EQ(a->io_surface_size.ToString(), b->io_surface_size.ToString()); |
| 125 EXPECT_EQ(a->io_surface_texture_id, b->io_surface_texture_id); | 125 EXPECT_EQ(a->io_surface_resource_id, b->io_surface_resource_id); |
| 126 EXPECT_EQ(a->orientation, b->orientation); | 126 EXPECT_EQ(a->orientation, b->orientation); |
| 127 } | 127 } |
| 128 | 128 |
| 129 void Compare(const RenderPassDrawQuad* a, const RenderPassDrawQuad* b) { | 129 void Compare(const RenderPassDrawQuad* a, const RenderPassDrawQuad* b) { |
| 130 EXPECT_EQ(a->is_replica, b->is_replica); | 130 EXPECT_EQ(a->is_replica, b->is_replica); |
| 131 EXPECT_EQ(a->mask_resource_id, b->mask_resource_id); | 131 EXPECT_EQ(a->mask_resource_id, b->mask_resource_id); |
| 132 EXPECT_EQ(a->contents_changed_since_last_frame, | 132 EXPECT_EQ(a->contents_changed_since_last_frame, |
| 133 b->contents_changed_since_last_frame); | 133 b->contents_changed_since_last_frame); |
| 134 EXPECT_EQ(a->mask_uv_rect.ToString(), b->mask_uv_rect.ToString()); | 134 EXPECT_EQ(a->mask_uv_rect.ToString(), b->mask_uv_rect.ToString()); |
| 135 EXPECT_EQ(a->filters, b->filters); | 135 EXPECT_EQ(a->filters, b->filters); |
| 136 EXPECT_EQ(a->filter, b->filter); | 136 EXPECT_EQ(a->filter, b->filter); |
| 137 EXPECT_EQ(a->background_filters, b->background_filters); | 137 EXPECT_EQ(a->background_filters, b->background_filters); |
| 138 } | 138 } |
| 139 | 139 |
| 140 void Compare(const SolidColorDrawQuad* a, const SolidColorDrawQuad* b) { | 140 void Compare(const SolidColorDrawQuad* a, const SolidColorDrawQuad* b) { |
| 141 EXPECT_EQ(a->color, b->color); | 141 EXPECT_EQ(a->color, b->color); |
| 142 } | 142 } |
| 143 | 143 |
| 144 void Compare(const StreamVideoDrawQuad* a, const StreamVideoDrawQuad* b) { | 144 void Compare(const StreamVideoDrawQuad* a, const StreamVideoDrawQuad* b) { |
| 145 EXPECT_EQ(a->texture_id, b->texture_id); | 145 EXPECT_EQ(a->resource_id, b->resource_id); |
| 146 EXPECT_EQ(a->matrix, b->matrix); | 146 EXPECT_EQ(a->matrix, b->matrix); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void Compare(const TextureDrawQuad* a, const TextureDrawQuad* b) { | 149 void Compare(const TextureDrawQuad* a, const TextureDrawQuad* b) { |
| 150 EXPECT_EQ(a->resource_id, b->resource_id); | 150 EXPECT_EQ(a->resource_id, b->resource_id); |
| 151 EXPECT_EQ(a->premultiplied_alpha, b->premultiplied_alpha); | 151 EXPECT_EQ(a->premultiplied_alpha, b->premultiplied_alpha); |
| 152 EXPECT_EQ(a->uv_top_left, b->uv_top_left); | 152 EXPECT_EQ(a->uv_top_left, b->uv_top_left); |
| 153 EXPECT_EQ(a->uv_bottom_right, b->uv_bottom_right); | 153 EXPECT_EQ(a->uv_bottom_right, b->uv_bottom_right); |
| 154 EXPECT_EQ(a->vertex_opacity[0], b->vertex_opacity[0]); | 154 EXPECT_EQ(a->vertex_opacity[0], b->vertex_opacity[0]); |
| 155 EXPECT_EQ(a->vertex_opacity[1], b->vertex_opacity[1]); | 155 EXPECT_EQ(a->vertex_opacity[1], b->vertex_opacity[1]); |
| 156 EXPECT_EQ(a->vertex_opacity[2], b->vertex_opacity[2]); | 156 EXPECT_EQ(a->vertex_opacity[2], b->vertex_opacity[2]); |
| 157 EXPECT_EQ(a->vertex_opacity[3], b->vertex_opacity[3]); | 157 EXPECT_EQ(a->vertex_opacity[3], b->vertex_opacity[3]); |
| 158 EXPECT_EQ(a->flipped, b->flipped); | 158 EXPECT_EQ(a->flipped, b->flipped); |
| 159 } | 159 } |
| 160 | 160 |
| 161 void Compare(const TileDrawQuad* a, const TileDrawQuad* b) { | 161 void Compare(const TileDrawQuad* a, const TileDrawQuad* b) { |
| 162 EXPECT_EQ(a->resource_id, b->resource_id); | 162 EXPECT_EQ(a->resource_id, b->resource_id); |
| 163 EXPECT_EQ(a->tex_coord_rect, b->tex_coord_rect); | 163 EXPECT_EQ(a->tex_coord_rect, b->tex_coord_rect); |
| 164 EXPECT_EQ(a->texture_size, b->texture_size); | 164 EXPECT_EQ(a->texture_size, b->texture_size); |
| 165 EXPECT_EQ(a->swizzle_contents, b->swizzle_contents); | 165 EXPECT_EQ(a->swizzle_contents, b->swizzle_contents); |
| 166 } | 166 } |
| 167 | 167 |
| 168 void Compare(const YUVVideoDrawQuad* a, const YUVVideoDrawQuad* b) { | 168 void Compare(const YUVVideoDrawQuad* a, const YUVVideoDrawQuad* b) { |
| 169 EXPECT_EQ(a->tex_scale, b->tex_scale); | 169 EXPECT_EQ(a->tex_scale, b->tex_scale); |
| 170 EXPECT_EQ(a->y_plane.resource_id, b->y_plane.resource_id); | 170 EXPECT_EQ(a->y_plane_resource_id, b->y_plane_resource_id); |
| 171 EXPECT_EQ(a->y_plane.size.ToString(), b->y_plane.size.ToString()); | 171 EXPECT_EQ(a->u_plane_resource_id, b->u_plane_resource_id); |
| 172 EXPECT_EQ(a->y_plane.format, b->y_plane.format); | 172 EXPECT_EQ(a->v_plane_resource_id, b->v_plane_resource_id); |
| 173 EXPECT_EQ(a->u_plane.resource_id, b->u_plane.resource_id); | |
| 174 EXPECT_EQ(a->u_plane.size.ToString(), b->u_plane.size.ToString()); | |
| 175 EXPECT_EQ(a->u_plane.format, b->u_plane.format); | |
| 176 EXPECT_EQ(a->v_plane.resource_id, b->v_plane.resource_id); | |
| 177 EXPECT_EQ(a->v_plane.size.ToString(), b->v_plane.size.ToString()); | |
| 178 EXPECT_EQ(a->v_plane.format, b->v_plane.format); | |
| 179 } | 173 } |
| 180 | 174 |
| 181 void Compare(const TransferableResource& a, const TransferableResource& b) { | 175 void Compare(const TransferableResource& a, const TransferableResource& b) { |
| 182 EXPECT_EQ(a.id, b.id); | 176 EXPECT_EQ(a.id, b.id); |
| 183 EXPECT_EQ(a.sync_point, b.sync_point); | 177 EXPECT_EQ(a.sync_point, b.sync_point); |
| 184 EXPECT_EQ(a.format, b.format); | 178 EXPECT_EQ(a.format, b.format); |
| 185 EXPECT_EQ(a.filter, b.filter); | 179 EXPECT_EQ(a.filter, b.filter); |
| 186 EXPECT_EQ(a.size.ToString(), b.size.ToString()); | 180 EXPECT_EQ(a.size.ToString(), b.size.ToString()); |
| 187 for (size_t i = 0; i < arraysize(a.mailbox.name); ++i) | 181 for (size_t i = 0; i < arraysize(a.mailbox.name); ++i) |
| 188 EXPECT_EQ(a.mailbox.name[i], b.mailbox.name[i]); | 182 EXPECT_EQ(a.mailbox.name[i], b.mailbox.name[i]); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 211 float arbitrary_float3 = 0.9f; | 205 float arbitrary_float3 = 0.9f; |
| 212 float arbitrary_float_array[4] = {3.5f, 6.2f, 9.3f, 12.3f}; | 206 float arbitrary_float_array[4] = {3.5f, 6.2f, 9.3f, 12.3f}; |
| 213 bool arbitrary_bool1 = true; | 207 bool arbitrary_bool1 = true; |
| 214 bool arbitrary_bool2 = false; | 208 bool arbitrary_bool2 = false; |
| 215 bool arbitrary_bool3 = true; | 209 bool arbitrary_bool3 = true; |
| 216 int arbitrary_int = 5; | 210 int arbitrary_int = 5; |
| 217 SkColor arbitrary_color = SkColorSetARGB(25, 36, 47, 58); | 211 SkColor arbitrary_color = SkColorSetARGB(25, 36, 47, 58); |
| 218 IOSurfaceDrawQuad::Orientation arbitrary_orientation = | 212 IOSurfaceDrawQuad::Orientation arbitrary_orientation = |
| 219 IOSurfaceDrawQuad::UNFLIPPED; | 213 IOSurfaceDrawQuad::UNFLIPPED; |
| 220 RenderPass::Id arbitrary_id(10, 14); | 214 RenderPass::Id arbitrary_id(10, 14); |
| 221 ResourceProvider::ResourceId arbitrary_resourceid = 55; | 215 ResourceProvider::ResourceId arbitrary_resourceid1 = 55; |
| 222 | 216 ResourceProvider::ResourceId arbitrary_resourceid2 = 47; |
| 223 VideoLayerImpl::FramePlane arbitrary_plane1; | 217 ResourceProvider::ResourceId arbitrary_resourceid3 = 23; |
| 224 arbitrary_plane1.resource_id = arbitrary_resourceid; | |
| 225 arbitrary_plane1.size = arbitrary_size1; | |
| 226 arbitrary_plane1.format = arbitrary_int; | |
| 227 | |
| 228 VideoLayerImpl::FramePlane arbitrary_plane2; | |
| 229 arbitrary_plane2.resource_id = arbitrary_resourceid; | |
| 230 arbitrary_plane2.size = arbitrary_size2; | |
| 231 arbitrary_plane2.format = arbitrary_int; | |
| 232 | |
| 233 VideoLayerImpl::FramePlane arbitrary_plane3; | |
| 234 arbitrary_plane3.resource_id = arbitrary_resourceid; | |
| 235 arbitrary_plane3.size = arbitrary_size3; | |
| 236 arbitrary_plane3.format = arbitrary_int; | |
| 237 | 218 |
| 238 WebFilterOperations arbitrary_filters1; | 219 WebFilterOperations arbitrary_filters1; |
| 239 arbitrary_filters1.append(WebFilterOperation::createGrayscaleFilter( | 220 arbitrary_filters1.append(WebFilterOperation::createGrayscaleFilter( |
| 240 arbitrary_float1)); | 221 arbitrary_float1)); |
| 241 | 222 |
| 242 WebFilterOperations arbitrary_filters2; | 223 WebFilterOperations arbitrary_filters2; |
| 243 arbitrary_filters2.append(WebFilterOperation::createBrightnessFilter( | 224 arbitrary_filters2.append(WebFilterOperation::createBrightnessFilter( |
| 244 arbitrary_float2)); | 225 arbitrary_float2)); |
| 245 | 226 |
| 246 // TODO(danakj): filter is not serialized. | 227 // TODO(danakj): filter is not serialized. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 debugborder_in->shared_quad_state); | 260 debugborder_in->shared_quad_state); |
| 280 | 261 |
| 281 scoped_ptr<IOSurfaceDrawQuad> iosurface_in = | 262 scoped_ptr<IOSurfaceDrawQuad> iosurface_in = |
| 282 IOSurfaceDrawQuad::Create(); | 263 IOSurfaceDrawQuad::Create(); |
| 283 iosurface_in->SetAll(shared_state1_in.get(), | 264 iosurface_in->SetAll(shared_state1_in.get(), |
| 284 arbitrary_rect2, | 265 arbitrary_rect2, |
| 285 arbitrary_rect3, | 266 arbitrary_rect3, |
| 286 arbitrary_rect1, | 267 arbitrary_rect1, |
| 287 arbitrary_bool1, | 268 arbitrary_bool1, |
| 288 arbitrary_size1, | 269 arbitrary_size1, |
| 289 arbitrary_int, | 270 arbitrary_resourceid3, |
| 290 arbitrary_orientation); | 271 arbitrary_orientation); |
| 291 scoped_ptr<DrawQuad> iosurface_cmp = iosurface_in->Copy( | 272 scoped_ptr<DrawQuad> iosurface_cmp = iosurface_in->Copy( |
| 292 iosurface_in->shared_quad_state); | 273 iosurface_in->shared_quad_state); |
| 293 | 274 |
| 294 scoped_ptr<RenderPassDrawQuad> renderpass_in = | 275 scoped_ptr<RenderPassDrawQuad> renderpass_in = |
| 295 RenderPassDrawQuad::Create(); | 276 RenderPassDrawQuad::Create(); |
| 296 renderpass_in->SetAll(shared_state1_in.get(), | 277 renderpass_in->SetAll(shared_state1_in.get(), |
| 297 arbitrary_rect1, | 278 arbitrary_rect1, |
| 298 arbitrary_rect2, | 279 arbitrary_rect2, |
| 299 arbitrary_rect3, | 280 arbitrary_rect3, |
| 300 arbitrary_bool1, | 281 arbitrary_bool1, |
| 301 arbitrary_id, | 282 arbitrary_id, |
| 302 arbitrary_bool2, | 283 arbitrary_bool2, |
| 303 arbitrary_resourceid, | 284 arbitrary_resourceid2, |
| 304 arbitrary_rect1, | 285 arbitrary_rect1, |
| 305 arbitrary_rectf1, | 286 arbitrary_rectf1, |
| 306 arbitrary_filters1, | 287 arbitrary_filters1, |
| 307 arbitrary_filter, // TODO(piman): not serialized. | 288 arbitrary_filter, // TODO(piman): not serialized. |
| 308 arbitrary_filters2); | 289 arbitrary_filters2); |
| 309 scoped_ptr<RenderPassDrawQuad> renderpass_cmp = renderpass_in->Copy( | 290 scoped_ptr<RenderPassDrawQuad> renderpass_cmp = renderpass_in->Copy( |
| 310 renderpass_in->shared_quad_state, renderpass_in->render_pass_id); | 291 renderpass_in->shared_quad_state, renderpass_in->render_pass_id); |
| 311 | 292 |
| 312 scoped_ptr<SharedQuadState> shared_state2_in = SharedQuadState::Create(); | 293 scoped_ptr<SharedQuadState> shared_state2_in = SharedQuadState::Create(); |
| 313 shared_state2_in->SetAll(arbitrary_matrix, | 294 shared_state2_in->SetAll(arbitrary_matrix, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 338 scoped_ptr<DrawQuad> solidcolor_cmp = solidcolor_in->Copy( | 319 scoped_ptr<DrawQuad> solidcolor_cmp = solidcolor_in->Copy( |
| 339 solidcolor_in->shared_quad_state); | 320 solidcolor_in->shared_quad_state); |
| 340 | 321 |
| 341 scoped_ptr<StreamVideoDrawQuad> streamvideo_in = | 322 scoped_ptr<StreamVideoDrawQuad> streamvideo_in = |
| 342 StreamVideoDrawQuad::Create(); | 323 StreamVideoDrawQuad::Create(); |
| 343 streamvideo_in->SetAll(shared_state1_in.get(), | 324 streamvideo_in->SetAll(shared_state1_in.get(), |
| 344 arbitrary_rect2, | 325 arbitrary_rect2, |
| 345 arbitrary_rect3, | 326 arbitrary_rect3, |
| 346 arbitrary_rect1, | 327 arbitrary_rect1, |
| 347 arbitrary_bool1, | 328 arbitrary_bool1, |
| 348 arbitrary_int, | 329 arbitrary_resourceid2, |
| 349 arbitrary_matrix); | 330 arbitrary_matrix); |
| 350 scoped_ptr<DrawQuad> streamvideo_cmp = streamvideo_in->Copy( | 331 scoped_ptr<DrawQuad> streamvideo_cmp = streamvideo_in->Copy( |
| 351 streamvideo_in->shared_quad_state); | 332 streamvideo_in->shared_quad_state); |
| 352 | 333 |
| 353 scoped_ptr<TextureDrawQuad> texture_in = TextureDrawQuad::Create(); | 334 scoped_ptr<TextureDrawQuad> texture_in = TextureDrawQuad::Create(); |
| 354 texture_in->SetAll(shared_state1_in.get(), | 335 texture_in->SetAll(shared_state1_in.get(), |
| 355 arbitrary_rect2, | 336 arbitrary_rect2, |
| 356 arbitrary_rect3, | 337 arbitrary_rect3, |
| 357 arbitrary_rect1, | 338 arbitrary_rect1, |
| 358 arbitrary_bool1, | 339 arbitrary_bool1, |
| 359 arbitrary_resourceid, | 340 arbitrary_resourceid1, |
| 360 arbitrary_bool2, | 341 arbitrary_bool2, |
| 361 arbitrary_pointf1, | 342 arbitrary_pointf1, |
| 362 arbitrary_pointf2, | 343 arbitrary_pointf2, |
| 363 arbitrary_float_array, | 344 arbitrary_float_array, |
| 364 arbitrary_bool3); | 345 arbitrary_bool3); |
| 365 scoped_ptr<DrawQuad> texture_cmp = texture_in->Copy( | 346 scoped_ptr<DrawQuad> texture_cmp = texture_in->Copy( |
| 366 texture_in->shared_quad_state); | 347 texture_in->shared_quad_state); |
| 367 | 348 |
| 368 scoped_ptr<TileDrawQuad> tile_in = TileDrawQuad::Create(); | 349 scoped_ptr<TileDrawQuad> tile_in = TileDrawQuad::Create(); |
| 369 tile_in->SetAll(shared_state1_in.get(), | 350 tile_in->SetAll(shared_state1_in.get(), |
| 370 arbitrary_rect2, | 351 arbitrary_rect2, |
| 371 arbitrary_rect3, | 352 arbitrary_rect3, |
| 372 arbitrary_rect1, | 353 arbitrary_rect1, |
| 373 arbitrary_bool1, | 354 arbitrary_bool1, |
| 374 arbitrary_resourceid, | 355 arbitrary_resourceid3, |
| 375 arbitrary_rectf1, | 356 arbitrary_rectf1, |
| 376 arbitrary_size1, | 357 arbitrary_size1, |
| 377 arbitrary_bool2); | 358 arbitrary_bool2); |
| 378 scoped_ptr<DrawQuad> tile_cmp = tile_in->Copy( | 359 scoped_ptr<DrawQuad> tile_cmp = tile_in->Copy( |
| 379 tile_in->shared_quad_state); | 360 tile_in->shared_quad_state); |
| 380 | 361 |
| 381 scoped_ptr<YUVVideoDrawQuad> yuvvideo_in = | 362 scoped_ptr<YUVVideoDrawQuad> yuvvideo_in = |
| 382 YUVVideoDrawQuad::Create(); | 363 YUVVideoDrawQuad::Create(); |
| 383 yuvvideo_in->SetAll(shared_state1_in.get(), | 364 yuvvideo_in->SetAll(shared_state1_in.get(), |
| 384 arbitrary_rect1, | 365 arbitrary_rect1, |
| 385 arbitrary_rect2, | 366 arbitrary_rect2, |
| 386 arbitrary_rect3, | 367 arbitrary_rect3, |
| 387 arbitrary_bool1, | 368 arbitrary_bool1, |
| 388 arbitrary_sizef1, | 369 arbitrary_sizef1, |
| 389 arbitrary_plane1, | 370 arbitrary_resourceid1, |
| 390 arbitrary_plane2, | 371 arbitrary_resourceid2, |
| 391 arbitrary_plane3); | 372 arbitrary_resourceid3); |
| 392 scoped_ptr<DrawQuad> yuvvideo_cmp = yuvvideo_in->Copy( | 373 scoped_ptr<DrawQuad> yuvvideo_cmp = yuvvideo_in->Copy( |
| 393 yuvvideo_in->shared_quad_state); | 374 yuvvideo_in->shared_quad_state); |
| 394 | 375 |
| 395 scoped_ptr<RenderPass> pass_in = RenderPass::Create(); | 376 scoped_ptr<RenderPass> pass_in = RenderPass::Create(); |
| 396 pass_in->SetAll(arbitrary_id, | 377 pass_in->SetAll(arbitrary_id, |
| 397 arbitrary_rect1, | 378 arbitrary_rect1, |
| 398 arbitrary_rectf1, | 379 arbitrary_rectf1, |
| 399 arbitrary_matrix, | 380 arbitrary_matrix, |
| 400 arbitrary_bool1, | 381 arbitrary_bool1, |
| 401 arbitrary_bool2); | 382 arbitrary_bool2); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 EXPECT_TRUE(IPC::ParamTraits<DelegatedFrameData>::Read(&msg, | 515 EXPECT_TRUE(IPC::ParamTraits<DelegatedFrameData>::Read(&msg, |
| 535 &iter, &frame_out)); | 516 &iter, &frame_out)); |
| 536 | 517 |
| 537 ASSERT_EQ(2u, frame_out.resource_list.size()); | 518 ASSERT_EQ(2u, frame_out.resource_list.size()); |
| 538 Compare(arbitrary_resource1, frame_out.resource_list[0]); | 519 Compare(arbitrary_resource1, frame_out.resource_list[0]); |
| 539 Compare(arbitrary_resource2, frame_out.resource_list[1]); | 520 Compare(arbitrary_resource2, frame_out.resource_list[1]); |
| 540 } | 521 } |
| 541 | 522 |
| 542 } // namespace | 523 } // namespace |
| 543 } // namespace content | 524 } // namespace content |
| OLD | NEW |