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 17 matching lines...) Expand all Loading... | |
28 return true; | 28 return true; |
29 default: | 29 default: |
30 return false; | 30 return false; |
31 } | 31 } |
32 } | 32 } |
33 | 33 |
34 bool ValidFormat(BufferFormat format) { | 34 bool ValidFormat(BufferFormat format) { |
35 switch (format) { | 35 switch (format) { |
36 case BufferFormat::R_8: | 36 case BufferFormat::R_8: |
37 case BufferFormat::BGRA_8888: | 37 case BufferFormat::BGRA_8888: |
38 case BufferFormat::YUV_420_BIPLANAR: | |
reveman
2015/08/10 22:40:55
GLImage support for this format doesn't exist yet.
Andre
2015/08/11 03:50:46
Done.
| |
38 return true; | 39 return true; |
39 case BufferFormat::ATC: | 40 case BufferFormat::ATC: |
40 case BufferFormat::ATCIA: | 41 case BufferFormat::ATCIA: |
41 case BufferFormat::DXT1: | 42 case BufferFormat::DXT1: |
42 case BufferFormat::DXT5: | 43 case BufferFormat::DXT5: |
43 case BufferFormat::ETC1: | 44 case BufferFormat::ETC1: |
44 case BufferFormat::RGBA_4444: | 45 case BufferFormat::RGBA_4444: |
45 case BufferFormat::RGBA_8888: | 46 case BufferFormat::RGBA_8888: |
46 case BufferFormat::RGBX_8888: | 47 case BufferFormat::RGBX_8888: |
47 case BufferFormat::YUV_420: | 48 case BufferFormat::YUV_420: |
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: |
59 case BufferFormat::YUV_420_BIPLANAR: | |
58 return GL_RED; | 60 return GL_RED; |
59 case BufferFormat::BGRA_8888: | 61 case BufferFormat::BGRA_8888: |
60 return GL_RGBA; | 62 return GL_RGBA; |
61 case BufferFormat::ATC: | 63 case BufferFormat::ATC: |
62 case BufferFormat::ATCIA: | 64 case BufferFormat::ATCIA: |
63 case BufferFormat::DXT1: | 65 case BufferFormat::DXT1: |
64 case BufferFormat::DXT5: | 66 case BufferFormat::DXT5: |
65 case BufferFormat::ETC1: | 67 case BufferFormat::ETC1: |
66 case BufferFormat::RGBA_4444: | 68 case BufferFormat::RGBA_4444: |
67 case BufferFormat::RGBA_8888: | 69 case BufferFormat::RGBA_8888: |
68 case BufferFormat::RGBX_8888: | 70 case BufferFormat::RGBX_8888: |
69 case BufferFormat::YUV_420: | 71 case BufferFormat::YUV_420: |
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: |
83 case BufferFormat::YUV_420_BIPLANAR: | |
81 return GL_RED; | 84 return GL_RED; |
82 case BufferFormat::BGRA_8888: | 85 case BufferFormat::BGRA_8888: |
83 return GL_BGRA; | 86 return GL_BGRA; |
84 case BufferFormat::ATC: | 87 case BufferFormat::ATC: |
85 case BufferFormat::ATCIA: | 88 case BufferFormat::ATCIA: |
86 case BufferFormat::DXT1: | 89 case BufferFormat::DXT1: |
87 case BufferFormat::DXT5: | 90 case BufferFormat::DXT5: |
88 case BufferFormat::ETC1: | 91 case BufferFormat::ETC1: |
89 case BufferFormat::RGBA_4444: | 92 case BufferFormat::RGBA_4444: |
90 case BufferFormat::RGBA_8888: | 93 case BufferFormat::RGBA_8888: |
91 case BufferFormat::RGBX_8888: | 94 case BufferFormat::RGBX_8888: |
92 case BufferFormat::YUV_420: | 95 case BufferFormat::YUV_420: |
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: |
107 case BufferFormat::YUV_420_BIPLANAR: | |
104 return GL_UNSIGNED_BYTE; | 108 return GL_UNSIGNED_BYTE; |
105 case BufferFormat::BGRA_8888: | 109 case BufferFormat::BGRA_8888: |
106 return GL_UNSIGNED_INT_8_8_8_8_REV; | 110 return GL_UNSIGNED_INT_8_8_8_8_REV; |
107 case BufferFormat::ATC: | 111 case BufferFormat::ATC: |
108 case BufferFormat::ATCIA: | 112 case BufferFormat::ATCIA: |
109 case BufferFormat::DXT1: | 113 case BufferFormat::DXT1: |
110 case BufferFormat::DXT5: | 114 case BufferFormat::DXT5: |
111 case BufferFormat::ETC1: | 115 case BufferFormat::ETC1: |
112 case BufferFormat::RGBA_4444: | 116 case BufferFormat::RGBA_4444: |
113 case BufferFormat::RGBA_8888: | 117 case BufferFormat::RGBA_8888: |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
220 // static | 224 // static |
221 void GLImageIOSurface::SetLayerForWidget( | 225 void GLImageIOSurface::SetLayerForWidget( |
222 gfx::AcceleratedWidget widget, CALayer* layer) { | 226 gfx::AcceleratedWidget widget, CALayer* layer) { |
223 if (layer) | 227 if (layer) |
224 g_widget_to_layer_map.Pointer()->insert(std::make_pair(widget, layer)); | 228 g_widget_to_layer_map.Pointer()->insert(std::make_pair(widget, layer)); |
225 else | 229 else |
226 g_widget_to_layer_map.Pointer()->erase(widget); | 230 g_widget_to_layer_map.Pointer()->erase(widget); |
227 } | 231 } |
228 | 232 |
229 } // namespace gfx | 233 } // namespace gfx |
OLD | NEW |