OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef UI_GFX_GL_GL_SURFACE_ANDROID_H_ | |
6 #define UI_GFX_GL_GL_SURFACE_ANDROID_H_ | |
7 #pragma once | |
8 | |
9 #include "base/memory/ref_counted.h" | |
10 #include "ui/gfx/gl/gl_surface_egl.h" | |
11 | |
12 namespace gfx { | |
13 | |
14 // A view surface. This can be created in the GPU process (default case), or | |
15 // browser process (in-process-gpu), or render process (in-process-webgl). When | |
16 // it is initialized, it always uses a pbuffer EGL surface until the native view | |
17 // is set. The native view is in charge of sharing the GL texture with UI thread | |
18 // in the browser process through SurfaceTexture. | |
19 class AndroidViewSurface : public NativeViewGLSurfaceEGL { | |
20 public: | |
21 AndroidViewSurface(); | |
22 virtual ~AndroidViewSurface(); | |
23 | |
24 // Implement GLSurface. | |
25 virtual bool Initialize() OVERRIDE; | |
26 virtual void Destroy() OVERRIDE; | |
27 virtual bool Resize(const gfx::Size& size) OVERRIDE; | |
28 virtual bool IsOffscreen() OVERRIDE; | |
29 virtual bool SwapBuffers() OVERRIDE; | |
30 virtual gfx::Size GetSize() OVERRIDE; | |
31 virtual EGLSurface GetHandle() OVERRIDE; | |
32 virtual void SetNativeWindow(AndroidNativeWindow* window) OVERRIDE; | |
33 | |
34 private: | |
35 bool CreateWindowSurface(AndroidNativeWindow* window); | |
36 scoped_refptr<PbufferGLSurfaceEGL> pbuffer_surface_; | |
37 AndroidNativeWindow* window_; | |
38 | |
39 DISALLOW_COPY_AND_ASSIGN(AndroidViewSurface); | |
40 }; | |
41 | |
42 } // namespace gfx | |
43 | |
44 #endif /* UI_GFX_GL_GL_SURFACE_ANDROID_H_ */ | |
OLD | NEW |