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

Unified Diff: ui/gl/gl_image_memory.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_image_memory.cc
diff --git a/ui/gl/gl_image_memory.cc b/ui/gl/gl_image_memory.cc
index 7cf74c82834efdfc29890982f6e5a7aa3714ddcc..052ecf4886f69b26aa4efc6fac3abfc0a45b6821 100644
--- a/ui/gl/gl_image_memory.cc
+++ b/ui/gl/gl_image_memory.cc
@@ -12,6 +12,7 @@
#include "ui/gfx/buffer_format_util.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_context.h"
+#include "ui/gl/gl_utils.h"
#include "ui/gl/gl_version_info.h"
using gfx::BufferFormat;
@@ -86,39 +87,6 @@ bool IsCompressedFormat(BufferFormat format) {
return false;
}
-GLenum TextureFormat(BufferFormat format) {
- switch (format) {
- case BufferFormat::ATC:
- return GL_ATC_RGB_AMD;
- case BufferFormat::ATCIA:
- return GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD;
- case BufferFormat::DXT1:
- return GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
- case BufferFormat::DXT5:
- return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
- case BufferFormat::ETC1:
- return GL_ETC1_RGB8_OES;
- case BufferFormat::R_8:
- return GL_RED;
- case BufferFormat::RGBA_4444:
- case BufferFormat::RGBA_8888:
- return GL_RGBA;
- case BufferFormat::BGRA_8888:
- return GL_BGRA_EXT;
- case BufferFormat::RGBX_8888:
- case BufferFormat::BGRX_8888:
- return GL_RGB;
- case BufferFormat::YUV_420:
- case BufferFormat::YUV_420_BIPLANAR:
- case BufferFormat::UYVY_422:
- NOTREACHED();
- return 0;
- }
-
- NOTREACHED();
- return 0;
-}
-
GLenum DataFormat(BufferFormat format) {
switch (format) {
case BufferFormat::RGBX_8888:
@@ -134,7 +102,7 @@ GLenum DataFormat(BufferFormat format) {
case BufferFormat::DXT1:
case BufferFormat::DXT5:
case BufferFormat::ETC1:
- return TextureFormat(format);
+ return GetTextureFormatFrom(format);
case BufferFormat::YUV_420:
case BufferFormat::YUV_420_BIPLANAR:
case BufferFormat::UYVY_422:
@@ -357,8 +325,8 @@ bool GLImageMemory::CopyTexImage(unsigned target) {
if (IsCompressedFormat(format_)) {
glCompressedTexImage2D(
- target, 0, TextureFormat(format_), size_.width(), size_.height(), 0,
- static_cast<GLsizei>(BufferSizeForBufferFormat(size_, format_)),
+ target, 0, GetTextureFormatFrom(format_), size_.width(), size_.height(),
+ 0, static_cast<GLsizei>(BufferSizeForBufferFormat(size_, format_)),
memory_);
} else {
GLenum data_format = DataFormat(format_);
@@ -374,7 +342,7 @@ bool GLImageMemory::CopyTexImage(unsigned target) {
if (data_row_length != size_.width())
glPixelStorei(GL_UNPACK_ROW_LENGTH, data_row_length);
- glTexImage2D(target, 0, TextureFormat(format_), size_.width(),
+ glTexImage2D(target, 0, GetTextureFormatFrom(format_), size_.width(),
size_.height(), 0, data_format, data_type,
gles2_data ? gles2_data.get() : memory_);
@@ -443,10 +411,4 @@ bool GLImageMemory::ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
return false;
}
-// static
-unsigned GLImageMemory::GetInternalFormatForTesting(BufferFormat format) {
- DCHECK(ValidFormat(format));
- return TextureFormat(format);
-}
-
} // namespace gl

Powered by Google App Engine
This is Rietveld 408576698