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 #include "cc/ipc/quads_struct_traits.h" | 5 #include "cc/ipc/quads_struct_traits.h" |
6 #include "ui/gfx/mojo/transform_struct_traits.h" | 6 #include "ui/gfx/mojo/transform_struct_traits.h" |
7 | 7 |
8 namespace mojo { | 8 namespace mojo { |
9 | 9 |
10 cc::DrawQuad* AllocateAndConstruct( | 10 cc::DrawQuad* AllocateAndConstruct( |
(...skipping 26 matching lines...) Expand all Loading... |
37 quad->material = cc::DrawQuad::TEXTURE_CONTENT; | 37 quad->material = cc::DrawQuad::TEXTURE_CONTENT; |
38 return quad; | 38 return quad; |
39 case cc::mojom::DrawQuadState::DataView::Tag::TILE_QUAD_STATE: | 39 case cc::mojom::DrawQuadState::DataView::Tag::TILE_QUAD_STATE: |
40 quad = list->AllocateAndConstruct<cc::TileDrawQuad>(); | 40 quad = list->AllocateAndConstruct<cc::TileDrawQuad>(); |
41 quad->material = cc::DrawQuad::TILED_CONTENT; | 41 quad->material = cc::DrawQuad::TILED_CONTENT; |
42 return quad; | 42 return quad; |
43 case cc::mojom::DrawQuadState::DataView::Tag::YUV_VIDEO_QUAD_STATE: | 43 case cc::mojom::DrawQuadState::DataView::Tag::YUV_VIDEO_QUAD_STATE: |
44 quad = list->AllocateAndConstruct<cc::YUVVideoDrawQuad>(); | 44 quad = list->AllocateAndConstruct<cc::YUVVideoDrawQuad>(); |
45 quad->material = cc::DrawQuad::YUV_VIDEO_CONTENT; | 45 quad->material = cc::DrawQuad::YUV_VIDEO_CONTENT; |
46 return quad; | 46 return quad; |
| 47 case cc::mojom::DrawQuadState::DataView::Tag::Y_VIDEO_QUAD_STATE: |
| 48 quad = list->AllocateAndConstruct<cc::YVideoDrawQuad>(); |
| 49 quad->material = cc::DrawQuad::Y_VIDEO_CONTENT; |
| 50 return quad; |
47 } | 51 } |
48 NOTREACHED(); | 52 NOTREACHED(); |
49 return nullptr; | 53 return nullptr; |
50 } | 54 } |
51 | 55 |
52 // static | 56 // static |
53 bool StructTraits<cc::mojom::DebugBorderQuadState, cc::DrawQuad>::Read( | 57 bool StructTraits<cc::mojom::DebugBorderQuadState, cc::DrawQuad>::Read( |
54 cc::mojom::DebugBorderQuadStateDataView data, | 58 cc::mojom::DebugBorderQuadStateDataView data, |
55 cc::DrawQuad* out) { | 59 cc::DrawQuad* out) { |
56 cc::DebugBorderDrawQuad* quad = static_cast<cc::DebugBorderDrawQuad*>(out); | 60 cc::DebugBorderDrawQuad* quad = static_cast<cc::DebugBorderDrawQuad*>(out); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 quad->resource_multiplier = data.resource_multiplier(); | 215 quad->resource_multiplier = data.resource_multiplier(); |
212 quad->bits_per_channel = data.bits_per_channel(); | 216 quad->bits_per_channel = data.bits_per_channel(); |
213 if (quad->bits_per_channel < cc::YUVVideoDrawQuad::kMinBitsPerChannel || | 217 if (quad->bits_per_channel < cc::YUVVideoDrawQuad::kMinBitsPerChannel || |
214 quad->bits_per_channel > cc::YUVVideoDrawQuad::kMaxBitsPerChannel) { | 218 quad->bits_per_channel > cc::YUVVideoDrawQuad::kMaxBitsPerChannel) { |
215 return false; | 219 return false; |
216 } | 220 } |
217 return true; | 221 return true; |
218 } | 222 } |
219 | 223 |
220 // static | 224 // static |
| 225 bool StructTraits<cc::mojom::YVideoQuadState, cc::DrawQuad>::Read( |
| 226 cc::mojom::YVideoQuadStateDataView data, |
| 227 cc::DrawQuad* out) { |
| 228 cc::YVideoDrawQuad* quad = static_cast<cc::YVideoDrawQuad*>(out); |
| 229 quad->resources.ids[cc::YVideoDrawQuad::kResourceIdIndex] = |
| 230 data.resource_id(); |
| 231 quad->resources.count = 1; |
| 232 if (!data.ReadUvTopLeft(&quad->uv_top_left) || |
| 233 !data.ReadUvBottomRight(&quad->uv_bottom_right)) { |
| 234 return false; |
| 235 } |
| 236 return true; |
| 237 } |
| 238 |
| 239 // static |
221 bool StructTraits<cc::mojom::DrawQuad, cc::DrawQuad>::Read( | 240 bool StructTraits<cc::mojom::DrawQuad, cc::DrawQuad>::Read( |
222 cc::mojom::DrawQuadDataView data, | 241 cc::mojom::DrawQuadDataView data, |
223 cc::DrawQuad* out) { | 242 cc::DrawQuad* out) { |
224 if (!data.ReadRect(&out->rect) || !data.ReadOpaqueRect(&out->opaque_rect) || | 243 if (!data.ReadRect(&out->rect) || !data.ReadOpaqueRect(&out->opaque_rect) || |
225 !data.ReadVisibleRect(&out->visible_rect)) { | 244 !data.ReadVisibleRect(&out->visible_rect)) { |
226 return false; | 245 return false; |
227 } | 246 } |
228 out->needs_blending = data.needs_blending(); | 247 out->needs_blending = data.needs_blending(); |
229 return data.ReadDrawQuadState(out); | 248 return data.ReadDrawQuadState(out); |
230 } | 249 } |
231 | 250 |
232 } // namespace mojo | 251 } // namespace mojo |
OLD | NEW |