Index: ui/gl/gl_utils.cc |
diff --git a/ui/gl/gl_utils.cc b/ui/gl/gl_utils.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6e74c363c332a6c7b3096ba543fe8bf94e2b2f20 |
--- /dev/null |
+++ b/ui/gl/gl_utils.cc |
@@ -0,0 +1,44 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "ui/gl/gl_utils.h" |
+ |
+#include "ui/gl/gl_bindings.h" |
+ |
+namespace gl { |
+ |
+GLenum GetTextureFormatFrom(gfx::BufferFormat format) { |
+ switch (format) { |
+ case gfx::BufferFormat::ATC: |
+ return GL_ATC_RGB_AMD; |
+ case gfx::BufferFormat::ATCIA: |
+ return GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD; |
+ case gfx::BufferFormat::DXT1: |
+ return GL_COMPRESSED_RGB_S3TC_DXT1_EXT; |
+ case gfx::BufferFormat::DXT5: |
+ return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; |
+ case gfx::BufferFormat::ETC1: |
+ return GL_ETC1_RGB8_OES; |
+ case gfx::BufferFormat::R_8: |
+ return GL_RED; |
+ case gfx::BufferFormat::RGBA_4444: |
+ case gfx::BufferFormat::RGBA_8888: |
+ return GL_RGBA; |
+ case gfx::BufferFormat::BGRA_8888: |
+ return GL_BGRA_EXT; |
+ case gfx::BufferFormat::RGBX_8888: |
+ case gfx::BufferFormat::BGRX_8888: |
+ return GL_RGB; |
+ case gfx::BufferFormat::YUV_420: |
+ case gfx::BufferFormat::YUV_420_BIPLANAR: |
+ case gfx::BufferFormat::UYVY_422: |
+ NOTREACHED(); |
+ return 0; |
+ } |
+ |
+ NOTREACHED(); |
+ return 0; |
+} |
+ |
+} // namespace ui |