OLD | NEW |
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 #ifndef CC_IPC_QUADS_STRUCT_TRAITS_H_ | 5 #ifndef CC_IPC_QUADS_STRUCT_TRAITS_H_ |
6 #define CC_IPC_QUADS_STRUCT_TRAITS_H_ | 6 #define CC_IPC_QUADS_STRUCT_TRAITS_H_ |
7 | 7 |
8 #include "cc/ipc/filter_operation_struct_traits.h" | 8 #include "cc/ipc/filter_operation_struct_traits.h" |
9 #include "cc/ipc/filter_operations_struct_traits.h" | 9 #include "cc/ipc/filter_operations_struct_traits.h" |
10 #include "cc/ipc/quads.mojom.h" | 10 #include "cc/ipc/quads.mojom.h" |
11 #include "cc/ipc/render_pass_id_struct_traits.h" | 11 #include "cc/ipc/render_pass_id_struct_traits.h" |
12 #include "cc/ipc/surface_id_struct_traits.h" | 12 #include "cc/ipc/surface_id_struct_traits.h" |
13 #include "cc/quads/debug_border_draw_quad.h" | 13 #include "cc/quads/debug_border_draw_quad.h" |
14 #include "cc/quads/picture_draw_quad.h" | 14 #include "cc/quads/picture_draw_quad.h" |
15 #include "cc/quads/render_pass_draw_quad.h" | 15 #include "cc/quads/render_pass_draw_quad.h" |
16 #include "cc/quads/solid_color_draw_quad.h" | 16 #include "cc/quads/solid_color_draw_quad.h" |
17 #include "cc/quads/stream_video_draw_quad.h" | 17 #include "cc/quads/stream_video_draw_quad.h" |
18 #include "cc/quads/surface_draw_quad.h" | 18 #include "cc/quads/surface_draw_quad.h" |
19 #include "cc/quads/texture_draw_quad.h" | 19 #include "cc/quads/texture_draw_quad.h" |
20 #include "cc/quads/tile_draw_quad.h" | 20 #include "cc/quads/tile_draw_quad.h" |
| 21 #include "cc/quads/y_video_draw_quad.h" |
21 #include "cc/quads/yuv_video_draw_quad.h" | 22 #include "cc/quads/yuv_video_draw_quad.h" |
22 #include "ui/gfx/geometry/mojo/geometry_struct_traits.h" | 23 #include "ui/gfx/geometry/mojo/geometry_struct_traits.h" |
23 | 24 |
24 namespace mojo { | 25 namespace mojo { |
25 | 26 |
26 template <> | 27 template <> |
27 struct EnumTraits<cc::mojom::Material, cc::DrawQuad::Material> { | 28 struct EnumTraits<cc::mojom::Material, cc::DrawQuad::Material> { |
28 static cc::mojom::Material ToMojom(cc::DrawQuad::Material material); | 29 static cc::mojom::Material ToMojom(cc::DrawQuad::Material material); |
29 static bool FromMojom(cc::mojom::Material input, cc::DrawQuad::Material* out); | 30 static bool FromMojom(cc::mojom::Material input, cc::DrawQuad::Material* out); |
30 }; | 31 }; |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 const cc::YUVVideoDrawQuad* quad = | 385 const cc::YUVVideoDrawQuad* quad = |
385 cc::YUVVideoDrawQuad::MaterialCast(&input); | 386 cc::YUVVideoDrawQuad::MaterialCast(&input); |
386 return quad->resource_multiplier; | 387 return quad->resource_multiplier; |
387 } | 388 } |
388 | 389 |
389 static bool Read(cc::mojom::YUVVideoQuadStateDataView data, | 390 static bool Read(cc::mojom::YUVVideoQuadStateDataView data, |
390 cc::DrawQuad* out); | 391 cc::DrawQuad* out); |
391 }; | 392 }; |
392 | 393 |
393 template <> | 394 template <> |
| 395 struct StructTraits<cc::mojom::YVideoQuadState, cc::DrawQuad> { |
| 396 static bool IsNull(const cc::DrawQuad& input) { |
| 397 return input.material != cc::DrawQuad::Y_VIDEO_CONTENT; |
| 398 } |
| 399 |
| 400 static void SetToNull(cc::DrawQuad* output) { |
| 401 // There is nothing to deserialize here if the DrawQuad is not a |
| 402 // YVideoContentDrawQuad. If it is, then this should not be called. |
| 403 DCHECK_NE(cc::DrawQuad::Y_VIDEO_CONTENT, output->material); |
| 404 } |
| 405 |
| 406 static uint32_t resource_id(const cc::DrawQuad& input) { |
| 407 const cc::YVideoDrawQuad* quad = cc::YVideoDrawQuad::MaterialCast(&input); |
| 408 return quad->resource_id(); |
| 409 } |
| 410 |
| 411 static const gfx::PointF& uv_top_left(const cc::DrawQuad& input) { |
| 412 const cc::YVideoDrawQuad* quad = cc::YVideoDrawQuad::MaterialCast(&input); |
| 413 return quad->uv_top_left; |
| 414 } |
| 415 |
| 416 static const gfx::PointF& uv_bottom_right(const cc::DrawQuad& input) { |
| 417 const cc::YVideoDrawQuad* quad = cc::YVideoDrawQuad::MaterialCast(&input); |
| 418 return quad->uv_bottom_right; |
| 419 } |
| 420 |
| 421 static bool Read(cc::mojom::YVideoQuadStateDataView data, cc::DrawQuad* out); |
| 422 }; |
| 423 |
| 424 template <> |
394 struct StructTraits<cc::mojom::DrawQuad, cc::DrawQuad> { | 425 struct StructTraits<cc::mojom::DrawQuad, cc::DrawQuad> { |
395 static cc::DrawQuad::Material material(const cc::DrawQuad& quad) { | 426 static cc::DrawQuad::Material material(const cc::DrawQuad& quad) { |
396 return quad.material; | 427 return quad.material; |
397 } | 428 } |
398 | 429 |
399 static const gfx::Rect& rect(const cc::DrawQuad& quad) { return quad.rect; } | 430 static const gfx::Rect& rect(const cc::DrawQuad& quad) { return quad.rect; } |
400 | 431 |
401 static const gfx::Rect& opaque_rect(const cc::DrawQuad& quad) { | 432 static const gfx::Rect& opaque_rect(const cc::DrawQuad& quad) { |
402 return quad.opaque_rect; | 433 return quad.opaque_rect; |
403 } | 434 } |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 void* context); | 513 void* context); |
483 static QuadListArray quads(const cc::QuadList& quad_list) { | 514 static QuadListArray quads(const cc::QuadList& quad_list) { |
484 return {quad_list.size(), const_cast<cc::QuadList*>(&quad_list)}; | 515 return {quad_list.size(), const_cast<cc::QuadList*>(&quad_list)}; |
485 } | 516 } |
486 static bool Read(cc::mojom::QuadListDataView data, cc::QuadList* out); | 517 static bool Read(cc::mojom::QuadListDataView data, cc::QuadList* out); |
487 }; | 518 }; |
488 | 519 |
489 } // namespace mojo | 520 } // namespace mojo |
490 | 521 |
491 #endif // CC_IPC_QUADS_STRUCT_TRAITS_H_ | 522 #endif // CC_IPC_QUADS_STRUCT_TRAITS_H_ |
OLD | NEW |