| 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_TRAITS_H_ | 5 #ifndef UI_GFX_MOJO_BUFFER_TYPES_TRAITS_H_ |
| 6 #define UI_GFX_MOJO_BUFFER_TYPES_TRAITS_H_ | 6 #define UI_GFX_MOJO_BUFFER_TYPES_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::RG_88: |
| 30 return gfx::mojom::BufferFormat::RG_88; |
| 29 case gfx::BufferFormat::BGR_565: | 31 case gfx::BufferFormat::BGR_565: |
| 30 return gfx::mojom::BufferFormat::BGR_565; | 32 return gfx::mojom::BufferFormat::BGR_565; |
| 31 case gfx::BufferFormat::RGBA_4444: | 33 case gfx::BufferFormat::RGBA_4444: |
| 32 return gfx::mojom::BufferFormat::RGBA_4444; | 34 return gfx::mojom::BufferFormat::RGBA_4444; |
| 33 case gfx::BufferFormat::RGBX_8888: | 35 case gfx::BufferFormat::RGBX_8888: |
| 34 return gfx::mojom::BufferFormat::RGBX_8888; | 36 return gfx::mojom::BufferFormat::RGBX_8888; |
| 35 case gfx::BufferFormat::RGBA_8888: | 37 case gfx::BufferFormat::RGBA_8888: |
| 36 return gfx::mojom::BufferFormat::RGBA_8888; | 38 return gfx::mojom::BufferFormat::RGBA_8888; |
| 37 case gfx::BufferFormat::BGRX_8888: | 39 case gfx::BufferFormat::BGRX_8888: |
| 38 return gfx::mojom::BufferFormat::BGRX_8888; | 40 return gfx::mojom::BufferFormat::BGRX_8888; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 63 return true; | 65 return true; |
| 64 case gfx::mojom::BufferFormat::DXT5: | 66 case gfx::mojom::BufferFormat::DXT5: |
| 65 *out = gfx::BufferFormat::DXT5; | 67 *out = gfx::BufferFormat::DXT5; |
| 66 return true; | 68 return true; |
| 67 case gfx::mojom::BufferFormat::ETC1: | 69 case gfx::mojom::BufferFormat::ETC1: |
| 68 *out = gfx::BufferFormat::ETC1; | 70 *out = gfx::BufferFormat::ETC1; |
| 69 return true; | 71 return true; |
| 70 case gfx::mojom::BufferFormat::R_8: | 72 case gfx::mojom::BufferFormat::R_8: |
| 71 *out = gfx::BufferFormat::R_8; | 73 *out = gfx::BufferFormat::R_8; |
| 72 return true; | 74 return true; |
| 75 case gfx::mojom::BufferFormat::RG_88: |
| 76 *out = gfx::BufferFormat::RG_88; |
| 77 return true; |
| 73 case gfx::mojom::BufferFormat::BGR_565: | 78 case gfx::mojom::BufferFormat::BGR_565: |
| 74 *out = gfx::BufferFormat::BGR_565; | 79 *out = gfx::BufferFormat::BGR_565; |
| 75 return true; | 80 return true; |
| 76 case gfx::mojom::BufferFormat::RGBA_4444: | 81 case gfx::mojom::BufferFormat::RGBA_4444: |
| 77 *out = gfx::BufferFormat::RGBA_4444; | 82 *out = gfx::BufferFormat::RGBA_4444; |
| 78 return true; | 83 return true; |
| 79 case gfx::mojom::BufferFormat::RGBX_8888: | 84 case gfx::mojom::BufferFormat::RGBX_8888: |
| 80 *out = gfx::BufferFormat::RGBX_8888; | 85 *out = gfx::BufferFormat::RGBX_8888; |
| 81 return true; | 86 return true; |
| 82 case gfx::mojom::BufferFormat::RGBA_8888: | 87 case gfx::mojom::BufferFormat::RGBA_8888: |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 } | 269 } |
| 265 static const gfx::NativePixmapHandle& native_pixmap_handle( | 270 static const gfx::NativePixmapHandle& native_pixmap_handle( |
| 266 const gfx::GpuMemoryBufferHandle& handle); | 271 const gfx::GpuMemoryBufferHandle& handle); |
| 267 static bool Read(gfx::mojom::GpuMemoryBufferHandleDataView data, | 272 static bool Read(gfx::mojom::GpuMemoryBufferHandleDataView data, |
| 268 gfx::GpuMemoryBufferHandle* handle); | 273 gfx::GpuMemoryBufferHandle* handle); |
| 269 }; | 274 }; |
| 270 | 275 |
| 271 } // namespace mojo | 276 } // namespace mojo |
| 272 | 277 |
| 273 #endif // UI_GFX_MOJO_BUFFER_TYPES_TRAITS_H_ | 278 #endif // UI_GFX_MOJO_BUFFER_TYPES_TRAITS_H_ |
| OLD | NEW |