| 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
|
|
|