Index: content/common/gpu/client/command_buffer_proxy_impl.cc |
diff --git a/content/common/gpu/client/command_buffer_proxy_impl.cc b/content/common/gpu/client/command_buffer_proxy_impl.cc |
index 13bade3e802c3d86680aae54730db24f6c9aed0f..9acf05a9b314b1c6b4362152804814b1d8354d4e 100644 |
--- a/content/common/gpu/client/command_buffer_proxy_impl.cc |
+++ b/content/common/gpu/client/command_buffer_proxy_impl.cc |
@@ -19,68 +19,11 @@ |
#include "gpu/command_buffer/common/cmd_buffer_common.h" |
#include "gpu/command_buffer/common/command_buffer_shared.h" |
#include "gpu/command_buffer/common/gpu_memory_allocation.h" |
+#include "gpu/command_buffer/service/image_factory.h" |
#include "ui/gfx/size.h" |
#include "ui/gl/gl_bindings.h" |
namespace content { |
-namespace { |
- |
-gfx::GpuMemoryBuffer::Format ImageFormatToGpuMemoryBufferFormat( |
- unsigned internalformat) { |
- switch (internalformat) { |
- case GL_RGB: |
- return gfx::GpuMemoryBuffer::RGBX_8888; |
- case GL_RGBA: |
- return gfx::GpuMemoryBuffer::RGBA_8888; |
- default: |
- NOTREACHED(); |
- return gfx::GpuMemoryBuffer::RGBA_8888; |
- } |
-} |
- |
-gfx::GpuMemoryBuffer::Usage ImageUsageToGpuMemoryBufferUsage(unsigned usage) { |
- switch (usage) { |
- case GL_MAP_CHROMIUM: |
- return gfx::GpuMemoryBuffer::MAP; |
- case GL_SCANOUT_CHROMIUM: |
- return gfx::GpuMemoryBuffer::SCANOUT; |
- default: |
- NOTREACHED(); |
- return gfx::GpuMemoryBuffer::MAP; |
- } |
-} |
- |
-bool IsImageFormatCompatibleWithGpuMemoryBufferFormat( |
- gfx::GpuMemoryBuffer::Format format, |
- unsigned internalformat) { |
- switch (internalformat) { |
- case GL_RGB: |
- switch (format) { |
- case gfx::GpuMemoryBuffer::RGBX_8888: |
- return true; |
- case gfx::GpuMemoryBuffer::RGBA_8888: |
- case gfx::GpuMemoryBuffer::BGRA_8888: |
- return false; |
- } |
- NOTREACHED(); |
- return false; |
- case GL_RGBA: |
- switch (format) { |
- case gfx::GpuMemoryBuffer::RGBX_8888: |
- return false; |
- case gfx::GpuMemoryBuffer::RGBA_8888: |
- case gfx::GpuMemoryBuffer::BGRA_8888: |
- return true; |
- } |
- NOTREACHED(); |
- return false; |
- default: |
- NOTREACHED(); |
- return false; |
- } |
-} |
- |
-} // namespace |
CommandBufferProxyImpl::CommandBufferProxyImpl( |
GpuChannelHost* channel, |
@@ -377,8 +320,8 @@ int32_t CommandBufferProxyImpl::CreateImage(ClientBuffer buffer, |
channel_->ShareGpuMemoryBufferToGpuProcess( |
gpu_memory_buffer->GetHandle()); |
- DCHECK(IsImageFormatCompatibleWithGpuMemoryBufferFormat( |
- gpu_memory_buffer->GetFormat(), internalformat)); |
+ DCHECK(gpu::ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat( |
+ internalformat, gpu_memory_buffer->GetFormat())); |
if (!Send(new GpuCommandBufferMsg_CreateImage(route_id_, |
new_id, |
handle, |
@@ -406,8 +349,8 @@ int32_t CommandBufferProxyImpl::CreateGpuMemoryBufferImage( |
scoped_ptr<gfx::GpuMemoryBuffer> buffer( |
channel_->gpu_memory_buffer_manager()->AllocateGpuMemoryBuffer( |
gfx::Size(width, height), |
- ImageFormatToGpuMemoryBufferFormat(internalformat), |
- ImageUsageToGpuMemoryBufferUsage(usage))); |
+ gpu::ImageFactory::ImageFormatToGpuMemoryBufferFormat(internalformat), |
+ gpu::ImageFactory::ImageUsageToGpuMemoryBufferUsage(usage))); |
if (!buffer) |
return -1; |