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_android_native_buffer.h" | 8 #include "ui/gl/gl_image_android_native_buffer.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_image_surface_texture.h" |
11 #include "ui/gl/gl_implementation.h" | 12 #include "ui/gl/gl_implementation.h" |
12 | 13 |
13 namespace gfx { | 14 namespace gfx { |
14 | 15 |
15 scoped_refptr<GLImage> GLImage::CreateGLImage(gfx::PluginWindowHandle window) { | 16 scoped_refptr<GLImage> GLImage::CreateGLImage(gfx::PluginWindowHandle window) { |
16 TRACE_EVENT0("gpu", "GLImage::CreateGLImage"); | 17 TRACE_EVENT0("gpu", "GLImage::CreateGLImage"); |
17 switch (GetGLImplementation()) { | 18 switch (GetGLImplementation()) { |
18 case kGLImplementationEGLGLES2: | 19 case kGLImplementationEGLGLES2: |
19 return NULL; | 20 return NULL; |
20 case kGLImplementationMockGL: | 21 case kGLImplementationMockGL: |
(...skipping 21 matching lines...) Expand all Loading... |
42 return image; | 43 return image; |
43 } | 44 } |
44 case ANDROID_NATIVE_BUFFER: { | 45 case ANDROID_NATIVE_BUFFER: { |
45 scoped_refptr<GLImageAndroidNativeBuffer> image( | 46 scoped_refptr<GLImageAndroidNativeBuffer> image( |
46 new GLImageAndroidNativeBuffer(size)); | 47 new GLImageAndroidNativeBuffer(size)); |
47 if (!image->Initialize(buffer)) | 48 if (!image->Initialize(buffer)) |
48 return NULL; | 49 return NULL; |
49 | 50 |
50 return image; | 51 return image; |
51 } | 52 } |
| 53 case SURFACE_TEXTURE_BUFFER: { |
| 54 scoped_refptr<GLImageSurfaceTexture> image( |
| 55 new GLImageSurfaceTexture(size)); |
| 56 if (!image->Initialize(buffer)) |
| 57 return NULL; |
| 58 |
| 59 return image; |
| 60 } |
52 default: | 61 default: |
53 NOTREACHED(); | 62 NOTREACHED(); |
54 return NULL; | 63 return NULL; |
55 } | 64 } |
56 case kGLImplementationMockGL: | 65 case kGLImplementationMockGL: |
57 return new GLImageStub; | 66 return new GLImageStub; |
58 default: | 67 default: |
59 NOTREACHED(); | 68 NOTREACHED(); |
60 return NULL; | 69 return NULL; |
61 } | 70 } |
62 } | 71 } |
63 | 72 |
64 } // namespace gfx | 73 } // namespace gfx |
OLD | NEW |