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 "ui/gl/gl_image_native_pixmap.h" | 5 #include "ui/gl/gl_image_native_pixmap.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ui/gfx/buffer_format_util.h" | 9 #include "ui/gfx/buffer_format_util.h" |
10 #include "ui/gl/gl_surface_egl.h" | 10 #include "ui/gl/gl_surface_egl.h" |
11 | 11 |
12 #define FOURCC(a, b, c, d) \ | 12 #define FOURCC(a, b, c, d) \ |
13 ((static_cast<uint32_t>(a)) | (static_cast<uint32_t>(b) << 8) | \ | 13 ((static_cast<uint32_t>(a)) | (static_cast<uint32_t>(b) << 8) | \ |
14 (static_cast<uint32_t>(c) << 16) | (static_cast<uint32_t>(d) << 24)) | 14 (static_cast<uint32_t>(c) << 16) | (static_cast<uint32_t>(d) << 24)) |
15 | 15 |
16 #define DRM_FORMAT_R8 FOURCC('R', '8', ' ', ' ') | 16 #define DRM_FORMAT_R8 FOURCC('R', '8', ' ', ' ') |
17 #define DRM_FORMAT_GR88 FOURCC('G', 'R', '8', '8') | 17 #define DRM_FORMAT_GR88 FOURCC('G', 'R', '8', '8') |
18 #define DRM_FORMAT_RGB565 FOURCC('R', 'G', '1', '6') | 18 #define DRM_FORMAT_RGB565 FOURCC('R', 'G', '1', '6') |
19 #define DRM_FORMAT_ARGB8888 FOURCC('A', 'R', '2', '4') | 19 #define DRM_FORMAT_ARGB8888 FOURCC('A', 'R', '2', '4') |
20 #define DRM_FORMAT_ABGR8888 FOURCC('A', 'B', '2', '4') | 20 #define DRM_FORMAT_ABGR8888 FOURCC('A', 'B', '2', '4') |
21 #define DRM_FORMAT_XRGB8888 FOURCC('X', 'R', '2', '4') | 21 #define DRM_FORMAT_XRGB8888 FOURCC('X', 'R', '2', '4') |
22 #define DRM_FORMAT_XBGR8888 FOURCC('X', 'B', '2', '4') | 22 #define DRM_FORMAT_XBGR8888 FOURCC('X', 'B', '2', '4') |
23 #define DRM_FORMAT_YV12 FOURCC('Y', 'V', '1', '2') | 23 #define DRM_FORMAT_YVU420 FOURCC('Y', 'V', '1', '2') |
24 #define DRM_FORMAT_NV12 FOURCC('N', 'V', '1', '2') | 24 #define DRM_FORMAT_NV12 FOURCC('N', 'V', '1', '2') |
25 | 25 |
26 namespace ui { | 26 namespace ui { |
27 namespace { | 27 namespace { |
28 | 28 |
29 bool ValidInternalFormat(unsigned internalformat, gfx::BufferFormat format) { | 29 bool ValidInternalFormat(unsigned internalformat, gfx::BufferFormat format) { |
30 switch (internalformat) { | 30 switch (internalformat) { |
31 case GL_RGB: | 31 case GL_RGB: |
32 return format == gfx::BufferFormat::BGR_565 || | 32 return format == gfx::BufferFormat::BGR_565 || |
33 format == gfx::BufferFormat::RGBX_8888 || | 33 format == gfx::BufferFormat::RGBX_8888 || |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 return DRM_FORMAT_RGB565; | 85 return DRM_FORMAT_RGB565; |
86 case gfx::BufferFormat::RGBA_8888: | 86 case gfx::BufferFormat::RGBA_8888: |
87 return DRM_FORMAT_ABGR8888; | 87 return DRM_FORMAT_ABGR8888; |
88 case gfx::BufferFormat::RGBX_8888: | 88 case gfx::BufferFormat::RGBX_8888: |
89 return DRM_FORMAT_XBGR8888; | 89 return DRM_FORMAT_XBGR8888; |
90 case gfx::BufferFormat::BGRA_8888: | 90 case gfx::BufferFormat::BGRA_8888: |
91 return DRM_FORMAT_ARGB8888; | 91 return DRM_FORMAT_ARGB8888; |
92 case gfx::BufferFormat::BGRX_8888: | 92 case gfx::BufferFormat::BGRX_8888: |
93 return DRM_FORMAT_XRGB8888; | 93 return DRM_FORMAT_XRGB8888; |
94 case gfx::BufferFormat::YVU_420: | 94 case gfx::BufferFormat::YVU_420: |
95 return DRM_FORMAT_YV12; | 95 return DRM_FORMAT_YVU420; |
96 case gfx::BufferFormat::YUV_420_BIPLANAR: | 96 case gfx::BufferFormat::YUV_420_BIPLANAR: |
97 return DRM_FORMAT_NV12; | 97 return DRM_FORMAT_NV12; |
98 case gfx::BufferFormat::ATC: | 98 case gfx::BufferFormat::ATC: |
99 case gfx::BufferFormat::ATCIA: | 99 case gfx::BufferFormat::ATCIA: |
100 case gfx::BufferFormat::DXT1: | 100 case gfx::BufferFormat::DXT1: |
101 case gfx::BufferFormat::DXT5: | 101 case gfx::BufferFormat::DXT5: |
102 case gfx::BufferFormat::ETC1: | 102 case gfx::BufferFormat::ETC1: |
103 case gfx::BufferFormat::RGBA_4444: | 103 case gfx::BufferFormat::RGBA_4444: |
104 case gfx::BufferFormat::UYVY_422: | 104 case gfx::BufferFormat::UYVY_422: |
105 NOTREACHED(); | 105 NOTREACHED(); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 case gfx::BufferFormat::UYVY_422: | 271 case gfx::BufferFormat::UYVY_422: |
272 NOTREACHED(); | 272 NOTREACHED(); |
273 return GL_NONE; | 273 return GL_NONE; |
274 } | 274 } |
275 | 275 |
276 NOTREACHED(); | 276 NOTREACHED(); |
277 return GL_NONE; | 277 return GL_NONE; |
278 } | 278 } |
279 | 279 |
280 } // namespace ui | 280 } // namespace ui |
OLD | NEW |