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

Side by Side Diff: content/common/gpu/gpu_memory_buffer_factory_surface_texture.cc

Issue 962723002: Change CHROMIUM_image declarations to support multi planar input. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reveman@ comments. Created 5 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/gpu/gpu_memory_buffer_factory_surface_texture.h" 5 #include "content/common/gpu/gpu_memory_buffer_factory_surface_texture.h"
6 6
7 #include "content/common/android/surface_texture_manager.h" 7 #include "content/common/android/surface_texture_manager.h"
8 #include "ui/gl/android/surface_texture.h" 8 #include "ui/gl/android/surface_texture.h"
9 #include "ui/gl/gl_image_surface_texture.h" 9 #include "ui/gl/gl_image_surface_texture.h"
10 10
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 } 91 }
92 92
93 SurfaceTextureManager::GetInstance()->UnregisterSurfaceTexture(id, client_id); 93 SurfaceTextureManager::GetInstance()->UnregisterSurfaceTexture(id, client_id);
94 } 94 }
95 95
96 gpu::ImageFactory* GpuMemoryBufferFactorySurfaceTexture::AsImageFactory() { 96 gpu::ImageFactory* GpuMemoryBufferFactorySurfaceTexture::AsImageFactory() {
97 return this; 97 return this;
98 } 98 }
99 99
100 scoped_refptr<gfx::GLImage> 100 scoped_refptr<gfx::GLImage>
101 GpuMemoryBufferFactorySurfaceTexture::CreateImageForGpuMemoryBuffer( 101 GpuMemoryBufferFactorySurfaceTexture::CreateImageForGpuMemoryBuffers(
102 const gfx::GpuMemoryBufferHandle& handle, 102 const std::vector<gfx::GpuMemoryBufferHandle>& handles,
103 const gfx::Size& size, 103 const gfx::Size& size,
104 gfx::GpuMemoryBuffer::Format format, 104 const std::vector<gfx::GpuMemoryBuffer::Format>& formats,
105 unsigned internalformat, 105 unsigned internalformat,
106 int client_id) { 106 int client_id) {
107 size_t num_buffers =
108 gpu::ImageFactory::NumberOfPlanesForImageFormat(internalformat);
109 if (num_buffers != 1) {
110 NOTIMPLEMENTED();
111 return scoped_refptr<gfx::GLImage>();
112 }
113 const gfx::GpuMemoryBufferHandle& handle = handles[0];
114
107 base::AutoLock lock(surface_textures_lock_); 115 base::AutoLock lock(surface_textures_lock_);
108 116
109 DCHECK_EQ(handle.type, gfx::SURFACE_TEXTURE_BUFFER); 117 DCHECK_EQ(handle.type, gfx::SURFACE_TEXTURE_BUFFER);
110 118
111 SurfaceTextureMapKey key(handle.id, client_id); 119 SurfaceTextureMapKey key(handle.id, client_id);
112 SurfaceTextureMap::iterator it = surface_textures_.find(key); 120 SurfaceTextureMap::iterator it = surface_textures_.find(key);
113 if (it == surface_textures_.end()) 121 if (it == surface_textures_.end())
114 return scoped_refptr<gfx::GLImage>(); 122 return scoped_refptr<gfx::GLImage>();
115 123
116 scoped_refptr<gfx::GLImageSurfaceTexture> image( 124 scoped_refptr<gfx::GLImageSurfaceTexture> image(
117 new gfx::GLImageSurfaceTexture(size)); 125 new gfx::GLImageSurfaceTexture(size));
118 if (!image->Initialize(it->second.get())) 126 if (!image->Initialize(it->second.get()))
119 return scoped_refptr<gfx::GLImage>(); 127 return scoped_refptr<gfx::GLImage>();
120 128
121 return image; 129 return image;
122 } 130 }
123 131
124 } // namespace content 132 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698