| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_ozone_native_pixmap.h" | 5 #include "ui/gl/gl_image_ozone_native_pixmap.h" |
| 6 | 6 |
| 7 #define FOURCC(a, b, c, d) \ | 7 #define FOURCC(a, b, c, d) \ |
| 8 ((static_cast<uint32>(a)) | (static_cast<uint32>(b) << 8) | \ | 8 ((static_cast<uint32>(a)) | (static_cast<uint32>(b) << 8) | \ |
| 9 (static_cast<uint32>(c) << 16) | (static_cast<uint32>(d) << 24)) | 9 (static_cast<uint32>(c) << 16) | (static_cast<uint32>(d) << 24)) |
| 10 | 10 |
| 11 #define DRM_FORMAT_ARGB8888 FOURCC('A', 'R', '2', '4') | 11 #define DRM_FORMAT_ARGB8888 FOURCC('A', 'R', '2', '4') |
| 12 #define DRM_FORMAT_ABGR8888 FOURCC('A', 'B', '2', '4') |
| 12 #define DRM_FORMAT_XRGB8888 FOURCC('X', 'R', '2', '4') | 13 #define DRM_FORMAT_XRGB8888 FOURCC('X', 'R', '2', '4') |
| 13 | 14 |
| 14 namespace gfx { | 15 namespace gfx { |
| 15 namespace { | 16 namespace { |
| 16 | 17 |
| 17 bool ValidInternalFormat(unsigned internalformat) { | 18 bool ValidInternalFormat(unsigned internalformat) { |
| 18 switch (internalformat) { | 19 switch (internalformat) { |
| 19 case GL_RGB: | 20 case GL_RGB: |
| 21 case GL_RGBA: |
| 20 case GL_BGRA_EXT: | 22 case GL_BGRA_EXT: |
| 21 return true; | 23 return true; |
| 22 default: | 24 default: |
| 23 return false; | 25 return false; |
| 24 } | 26 } |
| 25 } | 27 } |
| 26 | 28 |
| 27 bool ValidFormat(gfx::BufferFormat format) { | 29 bool ValidFormat(gfx::BufferFormat format) { |
| 28 switch (format) { | 30 switch (format) { |
| 31 case BufferFormat::RGBA_8888: |
| 29 case BufferFormat::BGRA_8888: | 32 case BufferFormat::BGRA_8888: |
| 30 case BufferFormat::BGRX_8888: | 33 case BufferFormat::BGRX_8888: |
| 31 return true; | 34 return true; |
| 32 case BufferFormat::ATC: | 35 case BufferFormat::ATC: |
| 33 case BufferFormat::ATCIA: | 36 case BufferFormat::ATCIA: |
| 34 case BufferFormat::DXT1: | 37 case BufferFormat::DXT1: |
| 35 case BufferFormat::DXT5: | 38 case BufferFormat::DXT5: |
| 36 case BufferFormat::ETC1: | 39 case BufferFormat::ETC1: |
| 37 case BufferFormat::R_8: | 40 case BufferFormat::R_8: |
| 38 case BufferFormat::RGBA_4444: | 41 case BufferFormat::RGBA_4444: |
| 39 case BufferFormat::RGBA_8888: | |
| 40 case BufferFormat::YUV_420: | 42 case BufferFormat::YUV_420: |
| 41 case BufferFormat::YUV_420_BIPLANAR: | 43 case BufferFormat::YUV_420_BIPLANAR: |
| 42 case BufferFormat::UYVY_422: | 44 case BufferFormat::UYVY_422: |
| 43 return false; | 45 return false; |
| 44 } | 46 } |
| 45 | 47 |
| 46 NOTREACHED(); | 48 NOTREACHED(); |
| 47 return false; | 49 return false; |
| 48 } | 50 } |
| 49 | 51 |
| 50 EGLint FourCC(gfx::BufferFormat format) { | 52 EGLint FourCC(gfx::BufferFormat format) { |
| 51 switch (format) { | 53 switch (format) { |
| 54 case BufferFormat::RGBA_8888: |
| 55 return DRM_FORMAT_ABGR8888; |
| 52 case BufferFormat::BGRA_8888: | 56 case BufferFormat::BGRA_8888: |
| 53 return DRM_FORMAT_ARGB8888; | 57 return DRM_FORMAT_ARGB8888; |
| 54 case BufferFormat::BGRX_8888: | 58 case BufferFormat::BGRX_8888: |
| 55 return DRM_FORMAT_XRGB8888; | 59 return DRM_FORMAT_XRGB8888; |
| 56 case BufferFormat::ATC: | 60 case BufferFormat::ATC: |
| 57 case BufferFormat::ATCIA: | 61 case BufferFormat::ATCIA: |
| 58 case BufferFormat::DXT1: | 62 case BufferFormat::DXT1: |
| 59 case BufferFormat::DXT5: | 63 case BufferFormat::DXT5: |
| 60 case BufferFormat::ETC1: | 64 case BufferFormat::ETC1: |
| 61 case BufferFormat::R_8: | 65 case BufferFormat::R_8: |
| 62 case BufferFormat::RGBA_4444: | 66 case BufferFormat::RGBA_4444: |
| 63 case BufferFormat::RGBA_8888: | |
| 64 case BufferFormat::YUV_420: | 67 case BufferFormat::YUV_420: |
| 65 case BufferFormat::YUV_420_BIPLANAR: | 68 case BufferFormat::YUV_420_BIPLANAR: |
| 66 case BufferFormat::UYVY_422: | 69 case BufferFormat::UYVY_422: |
| 67 NOTREACHED(); | 70 NOTREACHED(); |
| 68 return 0; | 71 return 0; |
| 69 } | 72 } |
| 70 | 73 |
| 71 NOTREACHED(); | 74 NOTREACHED(); |
| 72 return 0; | 75 return 0; |
| 73 } | 76 } |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 } | 147 } |
| 145 | 148 |
| 146 void GLImageOzoneNativePixmap::OnMemoryDump( | 149 void GLImageOzoneNativePixmap::OnMemoryDump( |
| 147 base::trace_event::ProcessMemoryDump* pmd, | 150 base::trace_event::ProcessMemoryDump* pmd, |
| 148 uint64_t process_tracing_id, | 151 uint64_t process_tracing_id, |
| 149 const std::string& dump_name) { | 152 const std::string& dump_name) { |
| 150 // TODO(ericrk): Implement GLImage OnMemoryDump. crbug.com/514914 | 153 // TODO(ericrk): Implement GLImage OnMemoryDump. crbug.com/514914 |
| 151 } | 154 } |
| 152 | 155 |
| 153 } // namespace gfx | 156 } // namespace gfx |
| OLD | NEW |