Index: gpu/command_buffer/common/gpu_memory_buffer_support.cc |
diff --git a/gpu/command_buffer/service/image_factory.cc b/gpu/command_buffer/common/gpu_memory_buffer_support.cc |
similarity index 85% |
copy from gpu/command_buffer/service/image_factory.cc |
copy to gpu/command_buffer/common/gpu_memory_buffer_support.cc |
index fd06d3f69c16ba4561a6bcc0f3088b495b426013..78c3e48864c30c109166667907bedd9676d55041 100644 |
--- a/gpu/command_buffer/service/image_factory.cc |
+++ b/gpu/command_buffer/common/gpu_memory_buffer_support.cc |
@@ -1,18 +1,22 @@ |
-// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Copyright 2016 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 "gpu/command_buffer/service/image_factory.h" |
+#include "gpu/command_buffer/common/gpu_memory_buffer_support.h" |
+#include <GLES2/gl2.h> |
+#include <GLES2/gl2extchromium.h> |
+ |
+#include "base/logging.h" |
#include "gpu/command_buffer/common/capabilities.h" |
-#include "ui/gl/gl_bindings.h" |
namespace gpu { |
namespace { |
+ |
gfx::BufferFormat BufferFormatForInternalFormat(unsigned internalformat) { |
switch (internalformat) { |
- case GL_RED: |
+ case GL_RED_EXT: |
return gfx::BufferFormat::R_8; |
case GL_RGB: |
return gfx::BufferFormat::BGRX_8888; |
@@ -44,15 +48,7 @@ gfx::BufferFormat BufferFormatForInternalFormat(unsigned internalformat) { |
} // namespace |
-ImageFactory::ImageFactory() { |
-} |
- |
-ImageFactory::~ImageFactory() { |
-} |
- |
-// static |
-gfx::BufferFormat ImageFactory::DefaultBufferFormatForImageFormat( |
- unsigned internalformat) { |
+gfx::BufferFormat DefaultBufferFormatForImageFormat(unsigned internalformat) { |
switch (internalformat) { |
case GL_RGB: |
return gfx::BufferFormat::BGRX_8888; |
@@ -64,8 +60,7 @@ gfx::BufferFormat ImageFactory::DefaultBufferFormatForImageFormat( |
} |
} |
-// static |
-bool ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat( |
+bool IsImageFormatCompatibleWithGpuMemoryBufferFormat( |
unsigned internalformat, |
gfx::BufferFormat format) { |
switch (format) { |
@@ -91,10 +86,8 @@ bool ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat( |
return false; |
} |
-// static |
-bool ImageFactory::IsGpuMemoryBufferFormatSupported( |
- gfx::BufferFormat format, |
- const gpu::Capabilities& capabilities) { |
+bool IsGpuMemoryBufferFormatSupported(gfx::BufferFormat format, |
+ const gpu::Capabilities& capabilities) { |
switch (format) { |
case gfx::BufferFormat::ATC: |
case gfx::BufferFormat::ATCIA: |
@@ -125,10 +118,8 @@ bool ImageFactory::IsGpuMemoryBufferFormatSupported( |
return false; |
} |
-// static |
-bool ImageFactory::IsImageSizeValidForGpuMemoryBufferFormat( |
- const gfx::Size& size, |
- gfx::BufferFormat format) { |
+bool IsImageSizeValidForGpuMemoryBufferFormat(const gfx::Size& size, |
+ gfx::BufferFormat format) { |
switch (format) { |
case gfx::BufferFormat::ATC: |
case gfx::BufferFormat::ATCIA: |