Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / content / common / gpu / client / gpu_memory_buffer_impl.cc
index c469a07..b3cd983 100644 (file)
@@ -8,16 +8,13 @@
 
 namespace content {
 
-GpuMemoryBufferImpl::GpuMemoryBufferImpl(
-    gfx::Size size, unsigned internalformat)
-    : size_(size),
-      internalformat_(internalformat),
-      mapped_(false) {
+GpuMemoryBufferImpl::GpuMemoryBufferImpl(const gfx::Size& size,
+                                         unsigned internalformat)
+    : size_(size), internalformat_(internalformat), mapped_(false) {
   DCHECK(IsFormatValid(internalformat));
 }
 
-GpuMemoryBufferImpl::~GpuMemoryBufferImpl() {
-}
+GpuMemoryBufferImpl::~GpuMemoryBufferImpl() {}
 
 // static
 bool GpuMemoryBufferImpl::IsFormatValid(unsigned internalformat) {
@@ -31,6 +28,17 @@ bool GpuMemoryBufferImpl::IsFormatValid(unsigned internalformat) {
 }
 
 // static
+bool GpuMemoryBufferImpl::IsUsageValid(unsigned usage) {
+  switch (usage) {
+    case GL_IMAGE_MAP_CHROMIUM:
+    case GL_IMAGE_SCANOUT_CHROMIUM:
+      return true;
+    default:
+      return false;
+  }
+}
+
+// static
 size_t GpuMemoryBufferImpl::BytesPerPixel(unsigned internalformat) {
   switch (internalformat) {
     case GL_BGRA8_EXT:
@@ -42,12 +50,6 @@ size_t GpuMemoryBufferImpl::BytesPerPixel(unsigned internalformat) {
   }
 }
 
-bool GpuMemoryBufferImpl::IsMapped() const {
-  return mapped_;
-}
-
-uint32 GpuMemoryBufferImpl::GetStride() const {
-  return size_.width() * BytesPerPixel(internalformat_);
-}
+bool GpuMemoryBufferImpl::IsMapped() const { return mapped_; }
 
 }  // namespace content