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_egl.h" | 8 #include "ui/gl/gl_image_egl.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 20 matching lines...) Expand all Loading... |
41 | 42 |
42 return image; | 43 return image; |
43 } | 44 } |
44 case EGL_CLIENT_BUFFER: { | 45 case EGL_CLIENT_BUFFER: { |
45 scoped_refptr<GLImageEGL> image(new GLImageEGL(size)); | 46 scoped_refptr<GLImageEGL> image(new GLImageEGL(size)); |
46 if (!image->Initialize(buffer)) | 47 if (!image->Initialize(buffer)) |
47 return NULL; | 48 return NULL; |
48 | 49 |
49 return image; | 50 return image; |
50 } | 51 } |
| 52 case SURFACE_TEXTURE_BUFFER: { |
| 53 scoped_refptr<GLImageSurfaceTexture> image( |
| 54 new GLImageSurfaceTexture(size)); |
| 55 if (!image->Initialize(buffer)) |
| 56 return NULL; |
| 57 |
| 58 return image; |
| 59 } |
51 default: | 60 default: |
52 NOTREACHED(); | 61 NOTREACHED(); |
53 return NULL; | 62 return NULL; |
54 } | 63 } |
55 case kGLImplementationMockGL: | 64 case kGLImplementationMockGL: |
56 return new GLImageStub; | 65 return new GLImageStub; |
57 default: | 66 default: |
58 NOTREACHED(); | 67 NOTREACHED(); |
59 return NULL; | 68 return NULL; |
60 } | 69 } |
61 } | 70 } |
62 | 71 |
63 } // namespace gfx | 72 } // namespace gfx |
OLD | NEW |