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_io_surface.h" | 8 #include "ui/gl/gl_image_io_surface.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" |
11 #include "ui/gl/gl_implementation.h" | 11 #include "ui/gl/gl_implementation.h" |
12 | 12 |
13 namespace gfx { | 13 namespace gfx { |
14 | 14 |
15 scoped_refptr<GLImage> GLImage::CreateGLImage(gfx::PluginWindowHandle window) { | |
16 TRACE_EVENT0("gpu", "GLImage::CreateGLImage"); | |
17 switch (GetGLImplementation()) { | |
18 case kGLImplementationOSMesaGL: | |
19 case kGLImplementationDesktopGL: | |
20 case kGLImplementationAppleGL: | |
21 return NULL; | |
22 case kGLImplementationMockGL: | |
23 return new GLImageStub; | |
24 default: | |
25 NOTREACHED(); | |
26 return NULL; | |
27 } | |
28 } | |
29 | |
30 scoped_refptr<GLImage> GLImage::CreateGLImageForGpuMemoryBuffer( | 15 scoped_refptr<GLImage> GLImage::CreateGLImageForGpuMemoryBuffer( |
31 gfx::GpuMemoryBufferHandle buffer, | 16 gfx::GpuMemoryBufferHandle buffer, |
32 gfx::Size size, | 17 gfx::Size size, |
33 unsigned internalformat) { | 18 unsigned internalformat) { |
34 TRACE_EVENT0("gpu", "GLImage::CreateGLImageForGpuMemoryBuffer"); | 19 TRACE_EVENT0("gpu", "GLImage::CreateGLImageForGpuMemoryBuffer"); |
35 switch (GetGLImplementation()) { | 20 switch (GetGLImplementation()) { |
36 case kGLImplementationOSMesaGL: | 21 case kGLImplementationOSMesaGL: |
37 case kGLImplementationDesktopGL: | 22 case kGLImplementationDesktopGL: |
38 case kGLImplementationAppleGL: | 23 case kGLImplementationAppleGL: |
39 switch (buffer.type) { | 24 switch (buffer.type) { |
(...skipping 18 matching lines...) Expand all Loading... |
58 } | 43 } |
59 case kGLImplementationMockGL: | 44 case kGLImplementationMockGL: |
60 return new GLImageStub; | 45 return new GLImageStub; |
61 default: | 46 default: |
62 NOTREACHED(); | 47 NOTREACHED(); |
63 return NULL; | 48 return NULL; |
64 } | 49 } |
65 } | 50 } |
66 | 51 |
67 } // namespace gfx | 52 } // namespace gfx |
OLD | NEW |