Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(630)

Unified Diff: ui/gl/gl_utils.cc

Issue 1484473003: gl, ozone: enable GLImageBindTest unittests Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build fix for win and mac, but cros need crrev.com/1208603002 Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698