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 "content/common/gpu/image_transport_surface.h" | |
6 | |
5 #include "base/logging.h" | 7 #include "base/logging.h" |
6 #include "content/common/gpu/image_transport_surface.h" | 8 #include "content/common/gpu/texture_image_transport_surface.h" |
9 #include "ui/gl/gl_surface_egl.h" | |
10 | |
11 gfx::AcceleratedWidget GetNativeWidgetAndroid(int surface_id); | |
piman
2012/07/26 21:33:29
mmh, this is just here to workaround the include D
| |
7 | 12 |
8 // static | 13 // static |
9 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( | 14 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( |
10 GpuChannelManager* manager, | 15 GpuChannelManager* manager, |
11 GpuCommandBufferStub* stub, | 16 GpuCommandBufferStub* stub, |
12 const gfx::GLSurfaceHandle& handle) { | 17 const gfx::GLSurfaceHandle& handle) { |
13 NOTIMPLEMENTED(); | 18 scoped_refptr<gfx::GLSurface> surface; |
14 return NULL; | 19 if (!handle.handle && handle.transport) { |
20 DCHECK(handle.parent_client_id); | |
21 surface = new TextureImageTransportSurface(manager, stub, handle); | |
22 } else if (handle.handle == gfx::kDummyPluginWindow && !handle.transport) { | |
23 ANativeWindow* window = GetNativeWidgetAndroid(stub->surface_id()); | |
24 DCHECK(window); | |
25 surface = new gfx::NativeViewGLSurfaceEGL(false, window); | |
26 if (!surface.get() || !surface->Initialize()) | |
27 return NULL; | |
28 | |
29 surface = new PassThroughImageTransportSurface( | |
30 manager, stub, surface.get(), handle.transport); | |
31 } else { | |
32 NOTIMPLEMENTED(); | |
33 return NULL: | |
34 } | |
35 | |
36 if (surface->Initialize()) | |
37 return surface; | |
38 else { | |
39 LOG(ERROR) << "Failed to initialize ImageTransportSurface"; | |
40 return NULL; | |
41 } | |
15 } | 42 } |
OLD | NEW |