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

Unified Diff: gpu/command_buffer/common/gpu_memory_buffer_support.cc

Issue 1849313002: Pull gpu CmdBuf service/client shared GpuMemoryBuffer code to common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 4 years, 8 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 | « gpu/command_buffer/common/gpu_memory_buffer_support.h ('k') | gpu/command_buffer/service/image_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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:
« no previous file with comments | « gpu/command_buffer/common/gpu_memory_buffer_support.h ('k') | gpu/command_buffer/service/image_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698