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/gfx/mac/io_surface.h" | 5 #include "ui/gfx/mac/io_surface.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 return 1; | 34 return 1; |
35 case gfx::BufferFormat::BGRA_8888: | 35 case gfx::BufferFormat::BGRA_8888: |
36 case gfx::BufferFormat::BGRX_8888: | 36 case gfx::BufferFormat::BGRX_8888: |
37 case gfx::BufferFormat::RGBA_8888: | 37 case gfx::BufferFormat::RGBA_8888: |
38 DCHECK_EQ(plane, 0); | 38 DCHECK_EQ(plane, 0); |
39 return 4; | 39 return 4; |
40 case gfx::BufferFormat::YUV_420_BIPLANAR: | 40 case gfx::BufferFormat::YUV_420_BIPLANAR: |
41 static int32_t bytes_per_element[] = {1, 2}; | 41 static int32_t bytes_per_element[] = {1, 2}; |
42 DCHECK_LT(static_cast<size_t>(plane), arraysize(bytes_per_element)); | 42 DCHECK_LT(static_cast<size_t>(plane), arraysize(bytes_per_element)); |
43 return bytes_per_element[plane]; | 43 return bytes_per_element[plane]; |
| 44 case gfx::BufferFormat::RG_88: |
44 case gfx::BufferFormat::UYVY_422: | 45 case gfx::BufferFormat::UYVY_422: |
45 DCHECK_EQ(plane, 0); | 46 DCHECK_EQ(plane, 0); |
46 return 2; | 47 return 2; |
47 case gfx::BufferFormat::ATC: | 48 case gfx::BufferFormat::ATC: |
48 case gfx::BufferFormat::ATCIA: | 49 case gfx::BufferFormat::ATCIA: |
49 case gfx::BufferFormat::DXT1: | 50 case gfx::BufferFormat::DXT1: |
50 case gfx::BufferFormat::DXT5: | 51 case gfx::BufferFormat::DXT5: |
51 case gfx::BufferFormat::ETC1: | 52 case gfx::BufferFormat::ETC1: |
52 case gfx::BufferFormat::BGR_565: | 53 case gfx::BufferFormat::BGR_565: |
53 case gfx::BufferFormat::RGBA_4444: | 54 case gfx::BufferFormat::RGBA_4444: |
(...skipping 12 matching lines...) Expand all Loading... |
66 case gfx::BufferFormat::R_8: | 67 case gfx::BufferFormat::R_8: |
67 return 'L008'; | 68 return 'L008'; |
68 case gfx::BufferFormat::BGRA_8888: | 69 case gfx::BufferFormat::BGRA_8888: |
69 case gfx::BufferFormat::BGRX_8888: | 70 case gfx::BufferFormat::BGRX_8888: |
70 case gfx::BufferFormat::RGBA_8888: | 71 case gfx::BufferFormat::RGBA_8888: |
71 return 'BGRA'; | 72 return 'BGRA'; |
72 case gfx::BufferFormat::YUV_420_BIPLANAR: | 73 case gfx::BufferFormat::YUV_420_BIPLANAR: |
73 return '420v'; | 74 return '420v'; |
74 case gfx::BufferFormat::UYVY_422: | 75 case gfx::BufferFormat::UYVY_422: |
75 return '2vuy'; | 76 return '2vuy'; |
| 77 case gfx::BufferFormat::RG_88: |
76 case gfx::BufferFormat::ATC: | 78 case gfx::BufferFormat::ATC: |
77 case gfx::BufferFormat::ATCIA: | 79 case gfx::BufferFormat::ATCIA: |
78 case gfx::BufferFormat::DXT1: | 80 case gfx::BufferFormat::DXT1: |
79 case gfx::BufferFormat::DXT5: | 81 case gfx::BufferFormat::DXT5: |
80 case gfx::BufferFormat::ETC1: | 82 case gfx::BufferFormat::ETC1: |
81 case gfx::BufferFormat::BGR_565: | 83 case gfx::BufferFormat::BGR_565: |
82 case gfx::BufferFormat::RGBA_4444: | 84 case gfx::BufferFormat::RGBA_4444: |
83 case gfx::BufferFormat::RGBX_8888: | 85 case gfx::BufferFormat::RGBX_8888: |
84 case gfx::BufferFormat::YVU_420: | 86 case gfx::BufferFormat::YVU_420: |
85 NOTREACHED(); | 87 NOTREACHED(); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 // Note that nullptr is an acceptable input to IOSurfaceSetValue. | 191 // Note that nullptr is an acceptable input to IOSurfaceSetValue. |
190 IOSurfaceSetValue(surface, CFSTR("IOSurfaceColorSpace"), color_space_icc); | 192 IOSurfaceSetValue(surface, CFSTR("IOSurfaceColorSpace"), color_space_icc); |
191 } | 193 } |
192 | 194 |
193 UMA_HISTOGRAM_TIMES("GPU.IOSurface.CreateTime", | 195 UMA_HISTOGRAM_TIMES("GPU.IOSurface.CreateTime", |
194 base::TimeTicks::Now() - start_time); | 196 base::TimeTicks::Now() - start_time); |
195 return surface; | 197 return surface; |
196 } | 198 } |
197 | 199 |
198 } // namespace gfx | 200 } // namespace gfx |
OLD | NEW |