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 27 matching lines...) Expand all Loading... |
38 return true; | 38 return true; |
39 case BufferFormat::ATC: | 39 case BufferFormat::ATC: |
40 case BufferFormat::ATCIA: | 40 case BufferFormat::ATCIA: |
41 case BufferFormat::DXT1: | 41 case BufferFormat::DXT1: |
42 case BufferFormat::DXT5: | 42 case BufferFormat::DXT5: |
43 case BufferFormat::ETC1: | 43 case BufferFormat::ETC1: |
44 case BufferFormat::RGBA_4444: | 44 case BufferFormat::RGBA_4444: |
45 case BufferFormat::RGBA_8888: | 45 case BufferFormat::RGBA_8888: |
46 case BufferFormat::RGBX_8888: | 46 case BufferFormat::RGBX_8888: |
47 case BufferFormat::YUV_420: | 47 case BufferFormat::YUV_420: |
| 48 case BufferFormat::YUV_420_BIPLANAR: |
48 return false; | 49 return false; |
49 } | 50 } |
50 | 51 |
51 NOTREACHED(); | 52 NOTREACHED(); |
52 return false; | 53 return false; |
53 } | 54 } |
54 | 55 |
55 GLenum TextureFormat(BufferFormat format) { | 56 GLenum TextureFormat(BufferFormat format) { |
56 switch (format) { | 57 switch (format) { |
57 case BufferFormat::R_8: | 58 case BufferFormat::R_8: |
58 return GL_RED; | 59 return GL_RED; |
59 case BufferFormat::BGRA_8888: | 60 case BufferFormat::BGRA_8888: |
60 return GL_RGBA; | 61 return GL_RGBA; |
61 case BufferFormat::ATC: | 62 case BufferFormat::ATC: |
62 case BufferFormat::ATCIA: | 63 case BufferFormat::ATCIA: |
63 case BufferFormat::DXT1: | 64 case BufferFormat::DXT1: |
64 case BufferFormat::DXT5: | 65 case BufferFormat::DXT5: |
65 case BufferFormat::ETC1: | 66 case BufferFormat::ETC1: |
66 case BufferFormat::RGBA_4444: | 67 case BufferFormat::RGBA_4444: |
67 case BufferFormat::RGBA_8888: | 68 case BufferFormat::RGBA_8888: |
68 case BufferFormat::RGBX_8888: | 69 case BufferFormat::RGBX_8888: |
69 case BufferFormat::YUV_420: | 70 case BufferFormat::YUV_420: |
| 71 case BufferFormat::YUV_420_BIPLANAR: |
70 NOTREACHED(); | 72 NOTREACHED(); |
71 return 0; | 73 return 0; |
72 } | 74 } |
73 | 75 |
74 NOTREACHED(); | 76 NOTREACHED(); |
75 return 0; | 77 return 0; |
76 } | 78 } |
77 | 79 |
78 GLenum DataFormat(BufferFormat format) { | 80 GLenum DataFormat(BufferFormat format) { |
79 switch (format) { | 81 switch (format) { |
80 case BufferFormat::R_8: | 82 case BufferFormat::R_8: |
81 return GL_RED; | 83 return GL_RED; |
82 case BufferFormat::BGRA_8888: | 84 case BufferFormat::BGRA_8888: |
83 return GL_BGRA; | 85 return GL_BGRA; |
84 case BufferFormat::ATC: | 86 case BufferFormat::ATC: |
85 case BufferFormat::ATCIA: | 87 case BufferFormat::ATCIA: |
86 case BufferFormat::DXT1: | 88 case BufferFormat::DXT1: |
87 case BufferFormat::DXT5: | 89 case BufferFormat::DXT5: |
88 case BufferFormat::ETC1: | 90 case BufferFormat::ETC1: |
89 case BufferFormat::RGBA_4444: | 91 case BufferFormat::RGBA_4444: |
90 case BufferFormat::RGBA_8888: | 92 case BufferFormat::RGBA_8888: |
91 case BufferFormat::RGBX_8888: | 93 case BufferFormat::RGBX_8888: |
92 case BufferFormat::YUV_420: | 94 case BufferFormat::YUV_420: |
| 95 case BufferFormat::YUV_420_BIPLANAR: |
93 NOTREACHED(); | 96 NOTREACHED(); |
94 return 0; | 97 return 0; |
95 } | 98 } |
96 | 99 |
97 NOTREACHED(); | 100 NOTREACHED(); |
98 return 0; | 101 return 0; |
99 } | 102 } |
100 | 103 |
101 GLenum DataType(BufferFormat format) { | 104 GLenum DataType(BufferFormat format) { |
102 switch (format) { | 105 switch (format) { |
103 case BufferFormat::R_8: | 106 case BufferFormat::R_8: |
104 return GL_UNSIGNED_BYTE; | 107 return GL_UNSIGNED_BYTE; |
105 case BufferFormat::BGRA_8888: | 108 case BufferFormat::BGRA_8888: |
106 return GL_UNSIGNED_INT_8_8_8_8_REV; | 109 return GL_UNSIGNED_INT_8_8_8_8_REV; |
107 case BufferFormat::ATC: | 110 case BufferFormat::ATC: |
108 case BufferFormat::ATCIA: | 111 case BufferFormat::ATCIA: |
109 case BufferFormat::DXT1: | 112 case BufferFormat::DXT1: |
110 case BufferFormat::DXT5: | 113 case BufferFormat::DXT5: |
111 case BufferFormat::ETC1: | 114 case BufferFormat::ETC1: |
112 case BufferFormat::RGBA_4444: | 115 case BufferFormat::RGBA_4444: |
113 case BufferFormat::RGBA_8888: | 116 case BufferFormat::RGBA_8888: |
114 case BufferFormat::RGBX_8888: | 117 case BufferFormat::RGBX_8888: |
115 case BufferFormat::YUV_420: | 118 case BufferFormat::YUV_420: |
| 119 case BufferFormat::YUV_420_BIPLANAR: |
116 NOTREACHED(); | 120 NOTREACHED(); |
117 return 0; | 121 return 0; |
118 } | 122 } |
119 | 123 |
120 NOTREACHED(); | 124 NOTREACHED(); |
121 return 0; | 125 return 0; |
122 } | 126 } |
123 | 127 |
124 } // namespace | 128 } // namespace |
125 | 129 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 // static | 214 // static |
211 void GLImageIOSurface::SetLayerForWidget( | 215 void GLImageIOSurface::SetLayerForWidget( |
212 gfx::AcceleratedWidget widget, CALayer* layer) { | 216 gfx::AcceleratedWidget widget, CALayer* layer) { |
213 if (layer) | 217 if (layer) |
214 g_widget_to_layer_map.Pointer()->insert(std::make_pair(widget, layer)); | 218 g_widget_to_layer_map.Pointer()->insert(std::make_pair(widget, layer)); |
215 else | 219 else |
216 g_widget_to_layer_map.Pointer()->erase(widget); | 220 g_widget_to_layer_map.Pointer()->erase(widget); |
217 } | 221 } |
218 | 222 |
219 } // namespace gfx | 223 } // namespace gfx |
OLD | NEW |