OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_io_surface.h" | 5 #include "ui/gl/gl_image_io_surface.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 case BufferFormat::UYVY_422: | 43 case BufferFormat::UYVY_422: |
44 case BufferFormat::YUV_420_BIPLANAR: | 44 case BufferFormat::YUV_420_BIPLANAR: |
45 return true; | 45 return true; |
46 case BufferFormat::ATC: | 46 case BufferFormat::ATC: |
47 case BufferFormat::ATCIA: | 47 case BufferFormat::ATCIA: |
48 case BufferFormat::DXT1: | 48 case BufferFormat::DXT1: |
49 case BufferFormat::DXT5: | 49 case BufferFormat::DXT5: |
50 case BufferFormat::ETC1: | 50 case BufferFormat::ETC1: |
51 case BufferFormat::RGBA_4444: | 51 case BufferFormat::RGBA_4444: |
52 case BufferFormat::RGBA_8888: | 52 case BufferFormat::RGBA_8888: |
| 53 case BufferFormat::RGBX_8888: |
53 case BufferFormat::BGRX_8888: | 54 case BufferFormat::BGRX_8888: |
54 case BufferFormat::YUV_420: | 55 case BufferFormat::YUV_420: |
55 return false; | 56 return false; |
56 } | 57 } |
57 | 58 |
58 NOTREACHED(); | 59 NOTREACHED(); |
59 return false; | 60 return false; |
60 } | 61 } |
61 | 62 |
62 GLenum TextureFormat(BufferFormat format) { | 63 GLenum TextureFormat(BufferFormat format) { |
63 switch (format) { | 64 switch (format) { |
64 case BufferFormat::R_8: | 65 case BufferFormat::R_8: |
65 case BufferFormat::YUV_420_BIPLANAR: | 66 case BufferFormat::YUV_420_BIPLANAR: |
66 return GL_RED; | 67 return GL_RED; |
67 case BufferFormat::BGRA_8888: | 68 case BufferFormat::BGRA_8888: |
68 return GL_RGBA; | 69 return GL_RGBA; |
69 case BufferFormat::UYVY_422: | 70 case BufferFormat::UYVY_422: |
70 return GL_RGB; | 71 return GL_RGB; |
71 case BufferFormat::ATC: | 72 case BufferFormat::ATC: |
72 case BufferFormat::ATCIA: | 73 case BufferFormat::ATCIA: |
73 case BufferFormat::DXT1: | 74 case BufferFormat::DXT1: |
74 case BufferFormat::DXT5: | 75 case BufferFormat::DXT5: |
75 case BufferFormat::ETC1: | 76 case BufferFormat::ETC1: |
76 case BufferFormat::RGBA_4444: | 77 case BufferFormat::RGBA_4444: |
77 case BufferFormat::RGBA_8888: | 78 case BufferFormat::RGBA_8888: |
| 79 case BufferFormat::RGBX_8888: |
78 case BufferFormat::BGRX_8888: | 80 case BufferFormat::BGRX_8888: |
79 case BufferFormat::YUV_420: | 81 case BufferFormat::YUV_420: |
80 NOTREACHED(); | 82 NOTREACHED(); |
81 return 0; | 83 return 0; |
82 } | 84 } |
83 | 85 |
84 NOTREACHED(); | 86 NOTREACHED(); |
85 return 0; | 87 return 0; |
86 } | 88 } |
87 | 89 |
88 GLenum DataFormat(BufferFormat format) { | 90 GLenum DataFormat(BufferFormat format) { |
89 switch (format) { | 91 switch (format) { |
90 case BufferFormat::R_8: | 92 case BufferFormat::R_8: |
91 case BufferFormat::YUV_420_BIPLANAR: | 93 case BufferFormat::YUV_420_BIPLANAR: |
92 return GL_RED; | 94 return GL_RED; |
93 case BufferFormat::BGRA_8888: | 95 case BufferFormat::BGRA_8888: |
94 return GL_BGRA; | 96 return GL_BGRA; |
95 case BufferFormat::UYVY_422: | 97 case BufferFormat::UYVY_422: |
96 return GL_YCBCR_422_APPLE; | 98 return GL_YCBCR_422_APPLE; |
97 break; | 99 break; |
98 case BufferFormat::ATC: | 100 case BufferFormat::ATC: |
99 case BufferFormat::ATCIA: | 101 case BufferFormat::ATCIA: |
100 case BufferFormat::DXT1: | 102 case BufferFormat::DXT1: |
101 case BufferFormat::DXT5: | 103 case BufferFormat::DXT5: |
102 case BufferFormat::ETC1: | 104 case BufferFormat::ETC1: |
103 case BufferFormat::RGBA_4444: | 105 case BufferFormat::RGBA_4444: |
104 case BufferFormat::RGBA_8888: | 106 case BufferFormat::RGBA_8888: |
| 107 case BufferFormat::RGBX_8888: |
105 case BufferFormat::BGRX_8888: | 108 case BufferFormat::BGRX_8888: |
106 case BufferFormat::YUV_420: | 109 case BufferFormat::YUV_420: |
107 NOTREACHED(); | 110 NOTREACHED(); |
108 return 0; | 111 return 0; |
109 } | 112 } |
110 | 113 |
111 NOTREACHED(); | 114 NOTREACHED(); |
112 return 0; | 115 return 0; |
113 } | 116 } |
114 | 117 |
115 GLenum DataType(BufferFormat format) { | 118 GLenum DataType(BufferFormat format) { |
116 switch (format) { | 119 switch (format) { |
117 case BufferFormat::R_8: | 120 case BufferFormat::R_8: |
118 case BufferFormat::YUV_420_BIPLANAR: | 121 case BufferFormat::YUV_420_BIPLANAR: |
119 return GL_UNSIGNED_BYTE; | 122 return GL_UNSIGNED_BYTE; |
120 case BufferFormat::BGRA_8888: | 123 case BufferFormat::BGRA_8888: |
121 return GL_UNSIGNED_INT_8_8_8_8_REV; | 124 return GL_UNSIGNED_INT_8_8_8_8_REV; |
122 case BufferFormat::UYVY_422: | 125 case BufferFormat::UYVY_422: |
123 return GL_UNSIGNED_SHORT_8_8_APPLE; | 126 return GL_UNSIGNED_SHORT_8_8_APPLE; |
124 break; | 127 break; |
125 case BufferFormat::ATC: | 128 case BufferFormat::ATC: |
126 case BufferFormat::ATCIA: | 129 case BufferFormat::ATCIA: |
127 case BufferFormat::DXT1: | 130 case BufferFormat::DXT1: |
128 case BufferFormat::DXT5: | 131 case BufferFormat::DXT5: |
129 case BufferFormat::ETC1: | 132 case BufferFormat::ETC1: |
130 case BufferFormat::RGBA_4444: | 133 case BufferFormat::RGBA_4444: |
131 case BufferFormat::RGBA_8888: | 134 case BufferFormat::RGBA_8888: |
| 135 case BufferFormat::RGBX_8888: |
132 case BufferFormat::BGRX_8888: | 136 case BufferFormat::BGRX_8888: |
133 case BufferFormat::YUV_420: | 137 case BufferFormat::YUV_420: |
134 NOTREACHED(); | 138 NOTREACHED(); |
135 return 0; | 139 return 0; |
136 } | 140 } |
137 | 141 |
138 NOTREACHED(); | 142 NOTREACHED(); |
139 return 0; | 143 return 0; |
140 } | 144 } |
141 | 145 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 // static | 258 // static |
255 void GLImageIOSurface::SetLayerForWidget(AcceleratedWidget widget, | 259 void GLImageIOSurface::SetLayerForWidget(AcceleratedWidget widget, |
256 CALayer* layer) { | 260 CALayer* layer) { |
257 if (layer) | 261 if (layer) |
258 g_widget_to_layer_map.Pointer()->insert(std::make_pair(widget, layer)); | 262 g_widget_to_layer_map.Pointer()->insert(std::make_pair(widget, layer)); |
259 else | 263 else |
260 g_widget_to_layer_map.Pointer()->erase(widget); | 264 g_widget_to_layer_map.Pointer()->erase(widget); |
261 } | 265 } |
262 | 266 |
263 } // namespace gfx | 267 } // namespace gfx |
OLD | NEW |