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

Side by Side Diff: android_webview/browser/gl_surface_factory.cc

Issue 22277004: Add gfx::SurfaceFactoryWebview (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: static member var Created 7 years, 4 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
(Empty)
1 // Copyright (c) 2013 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 #include "android_webview/browser/gl_surface_factory.h"
6
7 #include "base/lazy_instance.h"
8 #include "ui/gl/gl_bindings.h"
9 #include "ui/gl/gl_surface.h"
10
11 namespace android_webview {
12
13 unsigned int GLSurfaceFactory::current_fbo_ = 0;
14
15 namespace {
16
17 // This surface is used to represent the underlying surface provided by the App
18 // inside a hardware draw. Note that offscreen contexts will not be using this
19 // GLSurface.
20 class GL_EXPORT AwGLSurface : public gfx::GLSurface {
21 public:
22 // Implement GLSurface.
23 virtual void Destroy() OVERRIDE;
24 virtual bool IsOffscreen() OVERRIDE;
25 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE;
26 virtual bool SwapBuffers() OVERRIDE;
27 virtual gfx::Size GetSize() OVERRIDE;
28 virtual void* GetHandle() OVERRIDE;
29 virtual void* GetDisplay() OVERRIDE;
30
31 protected:
32 virtual ~AwGLSurface();
33 };
34
35 AwGLSurface::~AwGLSurface() {}
36
37 void AwGLSurface::Destroy() {
38 }
39
40 bool AwGLSurface::IsOffscreen() {
41 return false;
42 }
43
44 unsigned int AwGLSurface::GetBackingFrameBufferObject() {
45 return GLSurfaceFactory::GetCurrentFBO();
46 }
47
48 bool AwGLSurface::SwapBuffers() {
49 return true;
50 }
51
52 gfx::Size AwGLSurface::GetSize() {
53 return gfx::Size();
54 }
55
56 void* AwGLSurface::GetHandle() {
57 return NULL;
58 }
59
60 void* AwGLSurface::GetDisplay() {
61 return NULL;
62 }
63
64 base::LazyInstance<GLSurfaceFactory>::Leaky g_gl_surface_factory;
65
66 } // namespace
67
68 // static
69 void GLSurfaceFactory::Install() {
70 DCHECK(!gfx::SurfaceFactoryAndroid::GetInstance());
71 gfx::SurfaceFactoryAndroid::SetInstance(g_gl_surface_factory.Pointer());
72 }
73
74 // static
75 void GLSurfaceFactory::SetCurrentFBO(unsigned int fbo) {
joth 2013/08/06 03:55:41 To make it clear at any moment only one surface ca
76 current_fbo_ = fbo;
77 }
78
79 unsigned int GLSurfaceFactory::GetCurrentFBO() {
80 return current_fbo_;
81 }
82
83 GLSurfaceFactory::GLSurfaceFactory() {}
84
85 GLSurfaceFactory::~GLSurfaceFactory() {}
86
87 scoped_refptr<gfx::GLSurface> GLSurfaceFactory::CreateNonOwnedViewSurface() {
88 return new AwGLSurface;
89 }
90
91 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/browser/gl_surface_factory.h ('k') | android_webview/browser/in_process_view_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698