| 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 "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 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 int32 BytesPerPixel(gfx::GpuMemoryBuffer::Format format) { | 30 int32 BytesPerPixel(gfx::GpuMemoryBuffer::Format format) { |
| 31 switch (format) { | 31 switch (format) { |
| 32 case gfx::GpuMemoryBuffer::BGRA_8888: | 32 case gfx::GpuMemoryBuffer::BGRA_8888: |
| 33 return 4; | 33 return 4; |
| 34 case gfx::GpuMemoryBuffer::ATC: | 34 case gfx::GpuMemoryBuffer::ATC: |
| 35 case gfx::GpuMemoryBuffer::ATCIA: | 35 case gfx::GpuMemoryBuffer::ATCIA: |
| 36 case gfx::GpuMemoryBuffer::DXT1: | 36 case gfx::GpuMemoryBuffer::DXT1: |
| 37 case gfx::GpuMemoryBuffer::DXT5: | 37 case gfx::GpuMemoryBuffer::DXT5: |
| 38 case gfx::GpuMemoryBuffer::ETC1: | 38 case gfx::GpuMemoryBuffer::ETC1: |
| 39 case gfx::GpuMemoryBuffer::R_8: |
| 39 case gfx::GpuMemoryBuffer::RGBA_8888: | 40 case gfx::GpuMemoryBuffer::RGBA_8888: |
| 40 case gfx::GpuMemoryBuffer::RGBX_8888: | 41 case gfx::GpuMemoryBuffer::RGBX_8888: |
| 41 case gfx::GpuMemoryBuffer::YUV_420: | 42 case gfx::GpuMemoryBuffer::YUV_420: |
| 42 NOTREACHED(); | 43 NOTREACHED(); |
| 43 return 0; | 44 return 0; |
| 44 } | 45 } |
| 45 | 46 |
| 46 NOTREACHED(); | 47 NOTREACHED(); |
| 47 return 0; | 48 return 0; |
| 48 } | 49 } |
| 49 | 50 |
| 50 int32 PixelFormat(gfx::GpuMemoryBuffer::Format format) { | 51 int32 PixelFormat(gfx::GpuMemoryBuffer::Format format) { |
| 51 switch (format) { | 52 switch (format) { |
| 52 case gfx::GpuMemoryBuffer::BGRA_8888: | 53 case gfx::GpuMemoryBuffer::BGRA_8888: |
| 53 return 'BGRA'; | 54 return 'BGRA'; |
| 54 case gfx::GpuMemoryBuffer::ATC: | 55 case gfx::GpuMemoryBuffer::ATC: |
| 55 case gfx::GpuMemoryBuffer::ATCIA: | 56 case gfx::GpuMemoryBuffer::ATCIA: |
| 56 case gfx::GpuMemoryBuffer::DXT1: | 57 case gfx::GpuMemoryBuffer::DXT1: |
| 57 case gfx::GpuMemoryBuffer::DXT5: | 58 case gfx::GpuMemoryBuffer::DXT5: |
| 58 case gfx::GpuMemoryBuffer::ETC1: | 59 case gfx::GpuMemoryBuffer::ETC1: |
| 60 case gfx::GpuMemoryBuffer::R_8: |
| 59 case gfx::GpuMemoryBuffer::RGBA_8888: | 61 case gfx::GpuMemoryBuffer::RGBA_8888: |
| 60 case gfx::GpuMemoryBuffer::RGBX_8888: | 62 case gfx::GpuMemoryBuffer::RGBX_8888: |
| 61 case gfx::GpuMemoryBuffer::YUV_420: | 63 case gfx::GpuMemoryBuffer::YUV_420: |
| 62 NOTREACHED(); | 64 NOTREACHED(); |
| 63 return 0; | 65 return 0; |
| 64 } | 66 } |
| 65 | 67 |
| 66 NOTREACHED(); | 68 NOTREACHED(); |
| 67 return 0; | 69 return 0; |
| 68 } | 70 } |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 return scoped_refptr<gfx::GLImage>(); | 171 return scoped_refptr<gfx::GLImage>(); |
| 170 | 172 |
| 171 scoped_refptr<gfx::GLImageIOSurface> image(new gfx::GLImageIOSurface(size)); | 173 scoped_refptr<gfx::GLImageIOSurface> image(new gfx::GLImageIOSurface(size)); |
| 172 if (!image->Initialize(it->second.get())) | 174 if (!image->Initialize(it->second.get())) |
| 173 return scoped_refptr<gfx::GLImage>(); | 175 return scoped_refptr<gfx::GLImage>(); |
| 174 | 176 |
| 175 return image; | 177 return image; |
| 176 } | 178 } |
| 177 | 179 |
| 178 } // namespace content | 180 } // namespace content |
| OLD | NEW |