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

Side by Side Diff: content/common/gpu/gpu_memory_buffer_factory_io_surface.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_io_surface.h" 5 #include "content/common/gpu/gpu_memory_buffer_factory_io_surface.h"
6 6
7 #include <CoreFoundation/CoreFoundation.h> 7 #include <CoreFoundation/CoreFoundation.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ui/gl/gl_image_io_surface.h" 10 #include "ui/gl/gl_image_io_surface.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 IOSurfaceMap::iterator it = io_surfaces_.find(key); 145 IOSurfaceMap::iterator it = io_surfaces_.find(key);
146 if (it != io_surfaces_.end()) 146 if (it != io_surfaces_.end())
147 io_surfaces_.erase(it); 147 io_surfaces_.erase(it);
148 } 148 }
149 149
150 gpu::ImageFactory* GpuMemoryBufferFactoryIOSurface::AsImageFactory() { 150 gpu::ImageFactory* GpuMemoryBufferFactoryIOSurface::AsImageFactory() {
151 return this; 151 return this;
152 } 152 }
153 153
154 scoped_refptr<gfx::GLImage> 154 scoped_refptr<gfx::GLImage>
155 GpuMemoryBufferFactoryIOSurface::CreateImageForGpuMemoryBuffer( 155 GpuMemoryBufferFactoryIOSurface::CreateImageForGpuMemoryBuffers(
156 const gfx::GpuMemoryBufferHandle& handle, 156 const std::vector<gfx::GpuMemoryBufferHandle>& handles,
157 const gfx::Size& size, 157 const gfx::Size& size,
158 gfx::GpuMemoryBuffer::Format format, 158 const std::vector<gfx::GpuMemoryBuffer::Format>& formats,
159 unsigned internalformat, 159 unsigned internalformat,
160 int client_id) { 160 int client_id) {
161 size_t num_buffers =
162 gpu::ImageFactory::NumberOfPlanesForImageFormat(internalformat);
163 if (num_buffers != 1) {
164 NOTIMPLEMENTED();
165 return scoped_refptr<gfx::GLImage>();
166 }
167 const gfx::GpuMemoryBufferHandle& handle = handles[0];
168
161 base::AutoLock lock(io_surfaces_lock_); 169 base::AutoLock lock(io_surfaces_lock_);
162 170
163 DCHECK_EQ(handle.type, gfx::IO_SURFACE_BUFFER); 171 DCHECK_EQ(handle.type, gfx::IO_SURFACE_BUFFER);
164 IOSurfaceMapKey key(handle.id, client_id); 172 IOSurfaceMapKey key(handle.id, client_id);
165 IOSurfaceMap::iterator it = io_surfaces_.find(key); 173 IOSurfaceMap::iterator it = io_surfaces_.find(key);
166 if (it == io_surfaces_.end()) 174 if (it == io_surfaces_.end())
167 return scoped_refptr<gfx::GLImage>(); 175 return scoped_refptr<gfx::GLImage>();
168 176
169 scoped_refptr<gfx::GLImageIOSurface> image(new gfx::GLImageIOSurface(size)); 177 scoped_refptr<gfx::GLImageIOSurface> image(new gfx::GLImageIOSurface(size));
170 if (!image->Initialize(it->second.get())) 178 if (!image->Initialize(it->second.get()))
171 return scoped_refptr<gfx::GLImage>(); 179 return scoped_refptr<gfx::GLImage>();
172 180
173 return image; 181 return image;
174 } 182 }
175 183
176 } // namespace content 184 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698