Chromium Code Reviews| 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 #ifndef UI_GFX_BUFFER_TYPES_H_ | 5 #ifndef UI_GFX_BUFFER_TYPES_H_ |
| 6 #define UI_GFX_BUFFER_TYPES_H_ | 6 #define UI_GFX_BUFFER_TYPES_H_ |
| 7 | 7 |
| 8 namespace gfx { | 8 namespace gfx { |
| 9 | 9 |
| 10 // The format needs to be taken into account when mapping a buffer into the | 10 // The format needs to be taken into account when mapping a buffer into the |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 LAST = UYVY_422 | 27 LAST = UYVY_422 |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 // The usage mode affects how a buffer can be used. Only buffers created with | 30 // The usage mode affects how a buffer can be used. Only buffers created with |
| 31 // MAP can be mapped into the client's address space and accessed by the CPU. | 31 // MAP can be mapped into the client's address space and accessed by the CPU. |
| 32 // PERSISTENT_MAP adds the additional condition that successive Map() calls | 32 // PERSISTENT_MAP adds the additional condition that successive Map() calls |
| 33 // (with Unmap() calls between) will return a pointer to the same memory | 33 // (with Unmap() calls between) will return a pointer to the same memory |
| 34 // contents. | 34 // contents. |
| 35 enum class BufferUsage { MAP, PERSISTENT_MAP, SCANOUT, LAST = SCANOUT }; | 35 enum class BufferUsage { MAP, PERSISTENT_MAP, SCANOUT, LAST = SCANOUT }; |
| 36 | 36 |
| 37 inline const char* BufferFormatToString(BufferFormat format) { | |
| 38 switch (format) { | |
| 39 case BufferFormat::ATC: return "ATC"; | |
| 40 case BufferFormat::ATCIA: return "ATCIA"; | |
| 41 case BufferFormat::DXT1: return "DXT1"; | |
| 42 case BufferFormat::DXT5: return "DXT5"; | |
| 43 case BufferFormat::ETC1: return "ETC1"; | |
| 44 case BufferFormat::R_8: return "R_8"; | |
| 45 case BufferFormat::RGBA_4444: return "RGBA_4444"; | |
| 46 case BufferFormat::RGBA_8888: return "RGBA_8888"; | |
| 47 case BufferFormat::BGRX_8888: return "BGRX_8888"; | |
| 48 case BufferFormat::BGRA_8888: return "BGRA_8888"; | |
| 49 case BufferFormat::YUV_420: return "YUV_420"; | |
| 50 case BufferFormat::YUV_420_BIPLANAR: return "YUV_420_BIPLANAR"; | |
| 51 case BufferFormat::UYVY_422: return "UYVY_422"; | |
| 52 } | |
| 53 } | |
| 54 | |
| 55 inline const char* BufferUsageToString(BufferUsage usage) { | |
| 56 switch (usage) { | |
| 57 case BufferUsage::MAP: return "MAP"; | |
| 58 case BufferUsage::PERSISTENT_MAP: return "PERSISTENT_MAP"; | |
| 59 case BufferUsage::SCANOUT: return "SCANOUT"; | |
| 60 } | |
| 61 } | |
| 62 | |
|
vignatti (out of this project)
2015/10/26 20:55:49
reveman@ do you think it's worth doing this global
reveman
2015/10/26 21:09:20
I'd keep it local for now and we can move it hear
| |
| 37 } // namespace gfx | 63 } // namespace gfx |
| 38 | 64 |
| 39 #endif // UI_GFX_BUFFER_TYPES_H_ | 65 #endif // UI_GFX_BUFFER_TYPES_H_ |
| OLD | NEW |