Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "cc/test/test_image_factory.h" | 5 #include "cc/test/test_image_factory.h" |
| 6 | 6 |
| 7 #include "ui/gl/gl_image_shared_memory.h" | 7 #include "ui/gl/gl_image_shared_memory.h" |
| 8 | 8 |
| 9 namespace cc { | 9 namespace cc { |
| 10 | 10 |
| 11 TestImageFactory::TestImageFactory() { | 11 TestImageFactory::TestImageFactory() { |
| 12 } | 12 } |
| 13 | 13 |
| 14 TestImageFactory::~TestImageFactory() { | 14 TestImageFactory::~TestImageFactory() { |
| 15 } | 15 } |
| 16 | 16 |
| 17 scoped_refptr<gfx::GLImage> TestImageFactory::CreateImageForGpuMemoryBuffer( | 17 scoped_refptr<gfx::GLImage> TestImageFactory::CreateImageForGpuMemoryBuffers( |
| 18 const gfx::GpuMemoryBufferHandle& handle, | 18 const std::vector<gfx::GpuMemoryBufferHandle>& handles, |
| 19 const gfx::Size& size, | 19 const gfx::Size& size, |
| 20 gfx::GpuMemoryBuffer::Format format, | 20 const std::vector<gfx::GpuMemoryBuffer::Format>& formats, |
| 21 unsigned internalformat, | 21 unsigned internalformat, |
| 22 int client_id) { | 22 int client_id) { |
| 23 DCHECK_EQ(handle.type, gfx::SHARED_MEMORY_BUFFER); | 23 // TODO(emircan): See http://crbug.com/439520; support passing multiple |
|
reveman
2015/03/12 19:37:22
You can remove all this and just DCHECK_EQ(handles
emircan
2015/03/12 22:34:26
Done.
| |
| 24 // buffers when new multi-planar formats are added. | |
| 25 if ((handles.size() != 1) || (formats.size() != 1)) { | |
| 26 NOTIMPLEMENTED(); | |
| 27 return scoped_refptr<gfx::GLImageSharedMemory>(); | |
| 28 } | |
| 29 | |
| 30 DCHECK_EQ(handles[0].type, gfx::SHARED_MEMORY_BUFFER); | |
| 24 | 31 |
| 25 scoped_refptr<gfx::GLImageSharedMemory> image( | 32 scoped_refptr<gfx::GLImageSharedMemory> image( |
| 26 new gfx::GLImageSharedMemory(size, internalformat)); | 33 new gfx::GLImageSharedMemory(size, internalformat)); |
| 27 if (!image->Initialize(handle, format)) | 34 if (!image->Initialize(handles[0], formats[0])) |
| 28 return nullptr; | 35 return nullptr; |
| 29 | 36 |
| 30 return image; | 37 return image; |
| 31 } | 38 } |
| 32 | 39 |
| 33 } // namespace cc | 40 } // namespace cc |
| OLD | NEW |