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 13 matching lines...) Expand all Loading... |
24 int32 value) { | 24 int32 value) { |
25 base::ScopedCFTypeRef<CFNumberRef> number( | 25 base::ScopedCFTypeRef<CFNumberRef> number( |
26 CFNumberCreate(NULL, kCFNumberSInt32Type, &value)); | 26 CFNumberCreate(NULL, kCFNumberSInt32Type, &value)); |
27 CFDictionaryAddValue(dictionary, key, number.get()); | 27 CFDictionaryAddValue(dictionary, key, number.get()); |
28 } | 28 } |
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: |
| 35 case gfx::GpuMemoryBuffer::ATCIA: |
| 36 case gfx::GpuMemoryBuffer::DXT1: |
| 37 case gfx::GpuMemoryBuffer::DXT5: |
| 38 case gfx::GpuMemoryBuffer::ETC1: |
34 case gfx::GpuMemoryBuffer::RGBA_8888: | 39 case gfx::GpuMemoryBuffer::RGBA_8888: |
35 case gfx::GpuMemoryBuffer::RGBX_8888: | 40 case gfx::GpuMemoryBuffer::RGBX_8888: |
36 NOTREACHED(); | 41 NOTREACHED(); |
37 return 0; | 42 return 0; |
38 } | 43 } |
39 | 44 |
40 NOTREACHED(); | 45 NOTREACHED(); |
41 return 0; | 46 return 0; |
42 } | 47 } |
43 | 48 |
44 int32 PixelFormat(gfx::GpuMemoryBuffer::Format format) { | 49 int32 PixelFormat(gfx::GpuMemoryBuffer::Format format) { |
45 switch (format) { | 50 switch (format) { |
46 case gfx::GpuMemoryBuffer::BGRA_8888: | 51 case gfx::GpuMemoryBuffer::BGRA_8888: |
47 return 'BGRA'; | 52 return 'BGRA'; |
| 53 case gfx::GpuMemoryBuffer::ATC: |
| 54 case gfx::GpuMemoryBuffer::ATCIA: |
| 55 case gfx::GpuMemoryBuffer::DXT1: |
| 56 case gfx::GpuMemoryBuffer::DXT5: |
| 57 case gfx::GpuMemoryBuffer::ETC1: |
48 case gfx::GpuMemoryBuffer::RGBA_8888: | 58 case gfx::GpuMemoryBuffer::RGBA_8888: |
49 case gfx::GpuMemoryBuffer::RGBX_8888: | 59 case gfx::GpuMemoryBuffer::RGBX_8888: |
50 NOTREACHED(); | 60 NOTREACHED(); |
51 return 0; | 61 return 0; |
52 } | 62 } |
53 | 63 |
54 NOTREACHED(); | 64 NOTREACHED(); |
55 return 0; | 65 return 0; |
56 } | 66 } |
57 | 67 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 return scoped_refptr<gfx::GLImage>(); | 167 return scoped_refptr<gfx::GLImage>(); |
158 | 168 |
159 scoped_refptr<gfx::GLImageIOSurface> image(new gfx::GLImageIOSurface(size)); | 169 scoped_refptr<gfx::GLImageIOSurface> image(new gfx::GLImageIOSurface(size)); |
160 if (!image->Initialize(it->second.get())) | 170 if (!image->Initialize(it->second.get())) |
161 return scoped_refptr<gfx::GLImage>(); | 171 return scoped_refptr<gfx::GLImage>(); |
162 | 172 |
163 return image; | 173 return image; |
164 } | 174 } |
165 | 175 |
166 } // namespace content | 176 } // namespace content |
OLD | NEW |