OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/gl/gl_image.h" | 5 #include "ui/gl/gl_image.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "ui/gl/gl_image_glx.h" | 8 #include "ui/gl/gl_image_glx.h" |
9 #include "ui/gl/gl_image_shm.h" | 9 #include "ui/gl/gl_image_shm.h" |
10 #include "ui/gl/gl_image_stub.h" | 10 #include "ui/gl/gl_image_stub.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 return NULL; | 28 return NULL; |
29 case kGLImplementationMockGL: | 29 case kGLImplementationMockGL: |
30 return new GLImageStub; | 30 return new GLImageStub; |
31 default: | 31 default: |
32 NOTREACHED(); | 32 NOTREACHED(); |
33 return NULL; | 33 return NULL; |
34 } | 34 } |
35 } | 35 } |
36 | 36 |
37 scoped_refptr<GLImage> GLImage::CreateGLImageForGpuMemoryBuffer( | 37 scoped_refptr<GLImage> GLImage::CreateGLImageForGpuMemoryBuffer( |
38 gfx::GpuMemoryBufferHandle buffer, gfx::Size size) { | 38 gfx::GpuMemoryBufferHandle buffer, |
| 39 gfx::Size size, |
| 40 unsigned internalformat) { |
39 TRACE_EVENT0("gpu", "GLImage::CreateGLImageForGpuMemoryBuffer"); | 41 TRACE_EVENT0("gpu", "GLImage::CreateGLImageForGpuMemoryBuffer"); |
40 switch (GetGLImplementation()) { | 42 switch (GetGLImplementation()) { |
41 case kGLImplementationOSMesaGL: | 43 case kGLImplementationOSMesaGL: |
42 case kGLImplementationDesktopGL: | 44 case kGLImplementationDesktopGL: |
43 case kGLImplementationEGLGLES2: | 45 case kGLImplementationEGLGLES2: |
44 switch (buffer.type) { | 46 switch (buffer.type) { |
45 case SHARED_MEMORY_BUFFER: { | 47 case SHARED_MEMORY_BUFFER: { |
46 scoped_refptr<GLImageShm> image(new GLImageShm(size)); | 48 scoped_refptr<GLImageShm> image( |
| 49 new GLImageShm(size, internalformat)); |
47 if (!image->Initialize(buffer)) | 50 if (!image->Initialize(buffer)) |
48 return NULL; | 51 return NULL; |
49 | 52 |
50 return image; | 53 return image; |
51 } | 54 } |
52 default: | 55 default: |
53 NOTREACHED(); | 56 NOTREACHED(); |
54 return NULL; | 57 return NULL; |
55 } | 58 } |
56 case kGLImplementationMockGL: | 59 case kGLImplementationMockGL: |
57 return new GLImageStub; | 60 return new GLImageStub; |
58 default: | 61 default: |
59 NOTREACHED(); | 62 NOTREACHED(); |
60 return NULL; | 63 return NULL; |
61 } | 64 } |
62 } | 65 } |
63 | 66 |
64 } // namespace gfx | 67 } // namespace gfx |
OLD | NEW |