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 UI_GFX_MOJO_BUFFER_TYPES_STRUCT_TRAITS_H_ | 5 #ifndef UI_GFX_MOJO_BUFFER_TYPES_STRUCT_TRAITS_H_ |
6 #define UI_GFX_MOJO_BUFFER_TYPES_STRUCT_TRAITS_H_ | 6 #define UI_GFX_MOJO_BUFFER_TYPES_STRUCT_TRAITS_H_ |
7 | 7 |
8 #include "ui/gfx/buffer_types.h" | 8 #include "ui/gfx/buffer_types.h" |
9 #include "ui/gfx/mojo/buffer_types.mojom.h" | 9 #include "ui/gfx/mojo/buffer_types.mojom.h" |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 case gfx::BufferFormat::BGRA_8888: | 41 case gfx::BufferFormat::BGRA_8888: |
42 return gfx::mojom::BufferFormat::BGRA_8888; | 42 return gfx::mojom::BufferFormat::BGRA_8888; |
43 case gfx::BufferFormat::RGBA_F16: | 43 case gfx::BufferFormat::RGBA_F16: |
44 return gfx::mojom::BufferFormat::RGBA_F16; | 44 return gfx::mojom::BufferFormat::RGBA_F16; |
45 case gfx::BufferFormat::YVU_420: | 45 case gfx::BufferFormat::YVU_420: |
46 return gfx::mojom::BufferFormat::YVU_420; | 46 return gfx::mojom::BufferFormat::YVU_420; |
47 case gfx::BufferFormat::YUV_420_BIPLANAR: | 47 case gfx::BufferFormat::YUV_420_BIPLANAR: |
48 return gfx::mojom::BufferFormat::YUV_420_BIPLANAR; | 48 return gfx::mojom::BufferFormat::YUV_420_BIPLANAR; |
49 case gfx::BufferFormat::UYVY_422: | 49 case gfx::BufferFormat::UYVY_422: |
50 return gfx::mojom::BufferFormat::UYVY_422; | 50 return gfx::mojom::BufferFormat::UYVY_422; |
| 51 case gfx::BufferFormat::YUYV_422: |
| 52 return gfx::mojom::BufferFormat::YUYV_422; |
51 } | 53 } |
52 NOTREACHED(); | 54 NOTREACHED(); |
53 return gfx::mojom::BufferFormat::LAST; | 55 return gfx::mojom::BufferFormat::LAST; |
54 } | 56 } |
55 | 57 |
56 static bool FromMojom(gfx::mojom::BufferFormat input, | 58 static bool FromMojom(gfx::mojom::BufferFormat input, |
57 gfx::BufferFormat* out) { | 59 gfx::BufferFormat* out) { |
58 switch (input) { | 60 switch (input) { |
59 case gfx::mojom::BufferFormat::ATC: | 61 case gfx::mojom::BufferFormat::ATC: |
60 *out = gfx::BufferFormat::ATC; | 62 *out = gfx::BufferFormat::ATC; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 *out = gfx::BufferFormat::RGBA_F16; | 101 *out = gfx::BufferFormat::RGBA_F16; |
100 return true; | 102 return true; |
101 case gfx::mojom::BufferFormat::YVU_420: | 103 case gfx::mojom::BufferFormat::YVU_420: |
102 *out = gfx::BufferFormat::YVU_420; | 104 *out = gfx::BufferFormat::YVU_420; |
103 return true; | 105 return true; |
104 case gfx::mojom::BufferFormat::YUV_420_BIPLANAR: | 106 case gfx::mojom::BufferFormat::YUV_420_BIPLANAR: |
105 *out = gfx::BufferFormat::YUV_420_BIPLANAR; | 107 *out = gfx::BufferFormat::YUV_420_BIPLANAR; |
106 return true; | 108 return true; |
107 case gfx::mojom::BufferFormat::UYVY_422: | 109 case gfx::mojom::BufferFormat::UYVY_422: |
108 *out = gfx::BufferFormat::UYVY_422; | 110 *out = gfx::BufferFormat::UYVY_422; |
| 111 return true; |
| 112 case gfx::mojom::BufferFormat::YUYV_422: |
| 113 *out = gfx::BufferFormat::YUYV_422; |
| 114 return true; |
109 } | 115 } |
110 NOTREACHED(); | 116 NOTREACHED(); |
111 return false; | 117 return false; |
112 } | 118 } |
113 }; | 119 }; |
114 | 120 |
115 template <> | 121 template <> |
116 struct EnumTraits<gfx::mojom::BufferUsage, gfx::BufferUsage> { | 122 struct EnumTraits<gfx::mojom::BufferUsage, gfx::BufferUsage> { |
117 static gfx::mojom::BufferUsage ToMojom(gfx::BufferUsage usage) { | 123 static gfx::mojom::BufferUsage ToMojom(gfx::BufferUsage usage) { |
118 switch (usage) { | 124 switch (usage) { |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 static const gfx::NativePixmapHandle& native_pixmap_handle( | 286 static const gfx::NativePixmapHandle& native_pixmap_handle( |
281 const gfx::GpuMemoryBufferHandle& handle); | 287 const gfx::GpuMemoryBufferHandle& handle); |
282 static mojo::ScopedHandle mach_port(const gfx::GpuMemoryBufferHandle& handle); | 288 static mojo::ScopedHandle mach_port(const gfx::GpuMemoryBufferHandle& handle); |
283 static bool Read(gfx::mojom::GpuMemoryBufferHandleDataView data, | 289 static bool Read(gfx::mojom::GpuMemoryBufferHandleDataView data, |
284 gfx::GpuMemoryBufferHandle* handle); | 290 gfx::GpuMemoryBufferHandle* handle); |
285 }; | 291 }; |
286 | 292 |
287 } // namespace mojo | 293 } // namespace mojo |
288 | 294 |
289 #endif // UI_GFX_MOJO_BUFFER_TYPES_STRUCT_TRAITS_H_ | 295 #endif // UI_GFX_MOJO_BUFFER_TYPES_STRUCT_TRAITS_H_ |
OLD | NEW |