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

Unified Diff: content/common/gpu/client/command_buffer_proxy_impl.cc

Issue 659883003: gpu: Move image creation part of GpuMemoryBufferFactory interface to gpu namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move-gpu-memory-buffer-manager-to-gpu
Patch Set: rebase Created 6 years, 2 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
« no previous file with comments | « no previous file | content/common/gpu/gpu_command_buffer_stub.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | content/common/gpu/gpu_command_buffer_stub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698