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 |
11 namespace mojo { | 11 namespace mojo { |
12 | 12 |
13 template <> | 13 template <> |
14 struct EnumTraits<gfx::mojom::BufferFormat, gfx::BufferFormat> { | 14 struct EnumTraits<gfx::mojom::BufferFormat, gfx::BufferFormat> { |
15 static gfx::mojom::BufferFormat ToMojom(gfx::BufferFormat format) { | 15 static gfx::mojom::BufferFormat ToMojom(gfx::BufferFormat format) { |
16 switch (format) { | 16 switch (format) { |
17 case gfx::BufferFormat::ATC: | 17 case gfx::BufferFormat::ATC: |
18 return gfx::mojom::BufferFormat::ATC; | 18 return gfx::mojom::BufferFormat::ATC; |
19 case gfx::BufferFormat::ATCIA: | 19 case gfx::BufferFormat::ATCIA: |
20 return gfx::mojom::BufferFormat::ATCIA; | 20 return gfx::mojom::BufferFormat::ATCIA; |
21 case gfx::BufferFormat::DXT1: | 21 case gfx::BufferFormat::DXT1: |
22 return gfx::mojom::BufferFormat::DXT1; | 22 return gfx::mojom::BufferFormat::DXT1; |
23 case gfx::BufferFormat::DXT5: | 23 case gfx::BufferFormat::DXT5: |
24 return gfx::mojom::BufferFormat::DXT5; | 24 return gfx::mojom::BufferFormat::DXT5; |
25 case gfx::BufferFormat::ETC1: | 25 case gfx::BufferFormat::ETC1: |
26 return gfx::mojom::BufferFormat::ETC1; | 26 return gfx::mojom::BufferFormat::ETC1; |
27 case gfx::BufferFormat::R_8: | 27 case gfx::BufferFormat::R_8: |
28 return gfx::mojom::BufferFormat::R_8; | 28 return gfx::mojom::BufferFormat::R_8; |
| 29 case gfx::BufferFormat::R_16: |
| 30 return gfx::mojom::BufferFormat::R_16; |
29 case gfx::BufferFormat::RG_88: | 31 case gfx::BufferFormat::RG_88: |
30 return gfx::mojom::BufferFormat::RG_88; | 32 return gfx::mojom::BufferFormat::RG_88; |
31 case gfx::BufferFormat::BGR_565: | 33 case gfx::BufferFormat::BGR_565: |
32 return gfx::mojom::BufferFormat::BGR_565; | 34 return gfx::mojom::BufferFormat::BGR_565; |
33 case gfx::BufferFormat::RGBA_4444: | 35 case gfx::BufferFormat::RGBA_4444: |
34 return gfx::mojom::BufferFormat::RGBA_4444; | 36 return gfx::mojom::BufferFormat::RGBA_4444; |
35 case gfx::BufferFormat::RGBX_8888: | 37 case gfx::BufferFormat::RGBX_8888: |
36 return gfx::mojom::BufferFormat::RGBX_8888; | 38 return gfx::mojom::BufferFormat::RGBX_8888; |
37 case gfx::BufferFormat::RGBA_8888: | 39 case gfx::BufferFormat::RGBA_8888: |
38 return gfx::mojom::BufferFormat::RGBA_8888; | 40 return gfx::mojom::BufferFormat::RGBA_8888; |
(...skipping 28 matching lines...) Expand all Loading... |
67 return true; | 69 return true; |
68 case gfx::mojom::BufferFormat::DXT5: | 70 case gfx::mojom::BufferFormat::DXT5: |
69 *out = gfx::BufferFormat::DXT5; | 71 *out = gfx::BufferFormat::DXT5; |
70 return true; | 72 return true; |
71 case gfx::mojom::BufferFormat::ETC1: | 73 case gfx::mojom::BufferFormat::ETC1: |
72 *out = gfx::BufferFormat::ETC1; | 74 *out = gfx::BufferFormat::ETC1; |
73 return true; | 75 return true; |
74 case gfx::mojom::BufferFormat::R_8: | 76 case gfx::mojom::BufferFormat::R_8: |
75 *out = gfx::BufferFormat::R_8; | 77 *out = gfx::BufferFormat::R_8; |
76 return true; | 78 return true; |
| 79 case gfx::mojom::BufferFormat::R_16: |
| 80 *out = gfx::BufferFormat::R_16; |
| 81 return true; |
77 case gfx::mojom::BufferFormat::RG_88: | 82 case gfx::mojom::BufferFormat::RG_88: |
78 *out = gfx::BufferFormat::RG_88; | 83 *out = gfx::BufferFormat::RG_88; |
79 return true; | 84 return true; |
80 case gfx::mojom::BufferFormat::BGR_565: | 85 case gfx::mojom::BufferFormat::BGR_565: |
81 *out = gfx::BufferFormat::BGR_565; | 86 *out = gfx::BufferFormat::BGR_565; |
82 return true; | 87 return true; |
83 case gfx::mojom::BufferFormat::RGBA_4444: | 88 case gfx::mojom::BufferFormat::RGBA_4444: |
84 *out = gfx::BufferFormat::RGBA_4444; | 89 *out = gfx::BufferFormat::RGBA_4444; |
85 return true; | 90 return true; |
86 case gfx::mojom::BufferFormat::RGBX_8888: | 91 case gfx::mojom::BufferFormat::RGBX_8888: |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 static const gfx::NativePixmapHandle& native_pixmap_handle( | 285 static const gfx::NativePixmapHandle& native_pixmap_handle( |
281 const gfx::GpuMemoryBufferHandle& handle); | 286 const gfx::GpuMemoryBufferHandle& handle); |
282 static mojo::ScopedHandle mach_port(const gfx::GpuMemoryBufferHandle& handle); | 287 static mojo::ScopedHandle mach_port(const gfx::GpuMemoryBufferHandle& handle); |
283 static bool Read(gfx::mojom::GpuMemoryBufferHandleDataView data, | 288 static bool Read(gfx::mojom::GpuMemoryBufferHandleDataView data, |
284 gfx::GpuMemoryBufferHandle* handle); | 289 gfx::GpuMemoryBufferHandle* handle); |
285 }; | 290 }; |
286 | 291 |
287 } // namespace mojo | 292 } // namespace mojo |
288 | 293 |
289 #endif // UI_GFX_MOJO_BUFFER_TYPES_STRUCT_TRAITS_H_ | 294 #endif // UI_GFX_MOJO_BUFFER_TYPES_STRUCT_TRAITS_H_ |
OLD | NEW |