Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(561)

Side by Side Diff: content/common/gpu/image_transport_surface_android.cc

Issue 10795058: Add GL surface creation for Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include <android/native_window_jni.h>
12
13 gfx::AcceleratedWidget GetNativeWidgetAndroid(int surface_id);
7 14
8 // static 15 // static
9 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( 16 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface(
10 GpuChannelManager* manager, 17 GpuChannelManager* manager,
11 GpuCommandBufferStub* stub, 18 GpuCommandBufferStub* stub,
12 const gfx::GLSurfaceHandle& handle) { 19 const gfx::GLSurfaceHandle& handle) {
13 NOTIMPLEMENTED(); 20 scoped_refptr<gfx::GLSurface> surface;
14 return NULL; 21 if (!handle.handle && handle.transport) {
22 DCHECK(handle.transport);
apatrick_chromium 2012/07/24 18:34:16 DCHECK is redundant.
no sievers 2012/07/26 21:21:17 Done.
23 DCHECK(handle.parent_client_id);
24 surface = new TextureImageTransportSurface(manager, stub, handle);
25 } else if (handle.handle == gfx::kDummyPluginWindow && !handle.transport) {
26 ANativeWindow* window = GetNativeWidgetAndroid(stub->surface_id());
27 DCHECK(window);
28 surface = new gfx::NativeViewGLSurfaceEGL(false, window);
29 if (!surface.get() || !surface->Initialize())
30 return NULL;
31
32 // Release the extra ref now that we created an EGLSurface holding
33 // a reference to the surface.
34 ANativeWindow_release(window);
35
36 surface = new PassThroughImageTransportSurface(
37 manager, stub, surface.get(), handle.transport);
38 }
39
40 if (surface->Initialize())
41 return surface;
42 else {
43 LOG(ERROR) << "Failed to initialize ImageTransportSurface";
44 return NULL;
45 }
15 } 46 }
OLDNEW
« content/browser/gpu/gpu_surface_tracker.cc ('K') | « content/browser/gpu/gpu_surface_tracker.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698