| 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_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_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) { | 15 scoped_refptr<GLImage> GLImage::CreateGLImage(gfx::PluginWindowHandle window) { |
| 16 TRACE_EVENT0("gpu", "GLImage::CreateGLImage"); | 16 TRACE_EVENT0("gpu", "GLImage::CreateGLImage"); |
| 17 switch (GetGLImplementation()) { | 17 switch (GetGLImplementation()) { |
| 18 case kGLImplementationEGLGLES2: | 18 case kGLImplementationEGLGLES2: |
| (...skipping 15 matching lines...) Expand all Loading... |
| 34 case kGLImplementationEGLGLES2: | 34 case kGLImplementationEGLGLES2: |
| 35 switch (buffer.type) { | 35 switch (buffer.type) { |
| 36 case SHARED_MEMORY_BUFFER: { | 36 case SHARED_MEMORY_BUFFER: { |
| 37 scoped_refptr<GLImageShm> image( | 37 scoped_refptr<GLImageShm> image( |
| 38 new GLImageShm(size, internalformat)); | 38 new GLImageShm(size, internalformat)); |
| 39 if (!image->Initialize(buffer)) | 39 if (!image->Initialize(buffer)) |
| 40 return NULL; | 40 return NULL; |
| 41 | 41 |
| 42 return image; | 42 return image; |
| 43 } | 43 } |
| 44 case EGL_CLIENT_BUFFER: { | 44 case ANDROID_NATIVE_BUFFER: { |
| 45 scoped_refptr<GLImageEGL> image(new GLImageEGL(size)); | 45 scoped_refptr<GLImageAndroidNativeBuffer> image( |
| 46 new GLImageAndroidNativeBuffer(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 } |
| 51 default: | 52 default: |
| 52 NOTREACHED(); | 53 NOTREACHED(); |
| 53 return NULL; | 54 return NULL; |
| 54 } | 55 } |
| 55 case kGLImplementationMockGL: | 56 case kGLImplementationMockGL: |
| 56 return new GLImageStub; | 57 return new GLImageStub; |
| 57 default: | 58 default: |
| 58 NOTREACHED(); | 59 NOTREACHED(); |
| 59 return NULL; | 60 return NULL; |
| 60 } | 61 } |
| 61 } | 62 } |
| 62 | 63 |
| 63 } // namespace gfx | 64 } // namespace gfx |
| OLD | NEW |