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

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

Issue 1051503003: Add R_8 GPU memory buffers format. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix validation problem in StrideInBytes. Deals with GL_RED/GL_LUMINANCE. Created 5 years, 8 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 #include <vector>
reveman 2015/04/01 13:14:33 ?
Daniele Castagna 2015/04/01 21:58:34 std::vector is used in this cc file, the linter wa
reveman 2015/04/01 23:38:55 ok, cool. thanks!
8 9
9 #include "base/logging.h" 10 #include "base/logging.h"
10 #include "ui/gl/gl_image_io_surface.h" 11 #include "ui/gl/gl_image_io_surface.h"
11 12
12 namespace content { 13 namespace content {
13 namespace { 14 namespace {
14 15
15 void AddBooleanValue(CFMutableDictionaryRef dictionary, 16 void AddBooleanValue(CFMutableDictionaryRef dictionary,
16 const CFStringRef key, 17 const CFStringRef key,
17 bool value) { 18 bool value) {
(...skipping 11 matching lines...) Expand all
29 30
30 int32 BytesPerPixel(gfx::GpuMemoryBuffer::Format format) { 31 int32 BytesPerPixel(gfx::GpuMemoryBuffer::Format format) {
31 switch (format) { 32 switch (format) {
32 case gfx::GpuMemoryBuffer::BGRA_8888: 33 case gfx::GpuMemoryBuffer::BGRA_8888:
33 return 4; 34 return 4;
34 case gfx::GpuMemoryBuffer::ATC: 35 case gfx::GpuMemoryBuffer::ATC:
35 case gfx::GpuMemoryBuffer::ATCIA: 36 case gfx::GpuMemoryBuffer::ATCIA:
36 case gfx::GpuMemoryBuffer::DXT1: 37 case gfx::GpuMemoryBuffer::DXT1:
37 case gfx::GpuMemoryBuffer::DXT5: 38 case gfx::GpuMemoryBuffer::DXT5:
38 case gfx::GpuMemoryBuffer::ETC1: 39 case gfx::GpuMemoryBuffer::ETC1:
40 case gfx::GpuMemoryBuffer::R_8:
39 case gfx::GpuMemoryBuffer::RGBA_8888: 41 case gfx::GpuMemoryBuffer::RGBA_8888:
40 case gfx::GpuMemoryBuffer::RGBX_8888: 42 case gfx::GpuMemoryBuffer::RGBX_8888:
41 NOTREACHED(); 43 NOTREACHED();
42 return 0; 44 return 0;
43 } 45 }
44 46
45 NOTREACHED(); 47 NOTREACHED();
46 return 0; 48 return 0;
47 } 49 }
48 50
49 int32 PixelFormat(gfx::GpuMemoryBuffer::Format format) { 51 int32 PixelFormat(gfx::GpuMemoryBuffer::Format format) {
50 switch (format) { 52 switch (format) {
51 case gfx::GpuMemoryBuffer::BGRA_8888: 53 case gfx::GpuMemoryBuffer::BGRA_8888:
52 return 'BGRA'; 54 return 'BGRA';
53 case gfx::GpuMemoryBuffer::ATC: 55 case gfx::GpuMemoryBuffer::ATC:
54 case gfx::GpuMemoryBuffer::ATCIA: 56 case gfx::GpuMemoryBuffer::ATCIA:
55 case gfx::GpuMemoryBuffer::DXT1: 57 case gfx::GpuMemoryBuffer::DXT1:
56 case gfx::GpuMemoryBuffer::DXT5: 58 case gfx::GpuMemoryBuffer::DXT5:
57 case gfx::GpuMemoryBuffer::ETC1: 59 case gfx::GpuMemoryBuffer::ETC1:
60 case gfx::GpuMemoryBuffer::R_8:
58 case gfx::GpuMemoryBuffer::RGBA_8888: 61 case gfx::GpuMemoryBuffer::RGBA_8888:
59 case gfx::GpuMemoryBuffer::RGBX_8888: 62 case gfx::GpuMemoryBuffer::RGBX_8888:
60 NOTREACHED(); 63 NOTREACHED();
61 return 0; 64 return 0;
62 } 65 }
63 66
64 NOTREACHED(); 67 NOTREACHED();
65 return 0; 68 return 0;
66 } 69 }
67 70
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 return scoped_refptr<gfx::GLImage>(); 170 return scoped_refptr<gfx::GLImage>();
168 171
169 scoped_refptr<gfx::GLImageIOSurface> image(new gfx::GLImageIOSurface(size)); 172 scoped_refptr<gfx::GLImageIOSurface> image(new gfx::GLImageIOSurface(size));
170 if (!image->Initialize(it->second.get())) 173 if (!image->Initialize(it->second.get()))
171 return scoped_refptr<gfx::GLImage>(); 174 return scoped_refptr<gfx::GLImage>();
172 175
173 return image; 176 return image;
174 } 177 }
175 178
176 } // namespace content 179 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698