• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "ui/gl/gl_egl_api_implementation.h"
6 #include "ui/gl/gl_implementation.h"
7 
8 namespace gfx {
9 
10 RealEGLApi* g_real_egl;
11 
InitializeStaticGLBindingsEGL()12 void InitializeStaticGLBindingsEGL() {
13   g_driver_egl.InitializeStaticBindings();
14   if (!g_real_egl) {
15     g_real_egl = new RealEGLApi();
16   }
17   g_real_egl->Initialize(&g_driver_egl);
18   g_current_egl_context = g_real_egl;
19 }
20 
InitializeDynamicGLBindingsEGL(GLContext * context)21 void InitializeDynamicGLBindingsEGL(GLContext* context) {
22   g_driver_egl.InitializeDynamicBindings(context);
23 }
24 
InitializeDebugGLBindingsEGL()25 void InitializeDebugGLBindingsEGL() {
26   g_driver_egl.InitializeDebugBindings();
27 }
28 
ClearGLBindingsEGL()29 void ClearGLBindingsEGL() {
30   if (g_real_egl) {
31     delete g_real_egl;
32     g_real_egl = NULL;
33   }
34   g_current_egl_context = NULL;
35   g_driver_egl.ClearBindings();
36 }
37 
EGLApi()38 EGLApi::EGLApi() {
39 }
40 
~EGLApi()41 EGLApi::~EGLApi() {
42 }
43 
EGLApiBase()44 EGLApiBase::EGLApiBase()
45     : driver_(NULL) {
46 }
47 
~EGLApiBase()48 EGLApiBase::~EGLApiBase() {
49 }
50 
InitializeBase(DriverEGL * driver)51 void EGLApiBase::InitializeBase(DriverEGL* driver) {
52   driver_ = driver;
53 }
54 
RealEGLApi()55 RealEGLApi::RealEGLApi() {
56 }
57 
~RealEGLApi()58 RealEGLApi::~RealEGLApi() {
59 }
60 
Initialize(DriverEGL * driver)61 void RealEGLApi::Initialize(DriverEGL* driver) {
62   InitializeBase(driver);
63 }
64 
~TraceEGLApi()65 TraceEGLApi::~TraceEGLApi() {
66 }
67 
GetGLWindowSystemBindingInfoEGL(GLWindowSystemBindingInfo * info)68 bool GetGLWindowSystemBindingInfoEGL(GLWindowSystemBindingInfo* info) {
69   EGLDisplay display = eglGetCurrentDisplay();
70   const char* vendor = eglQueryString(display, EGL_VENDOR);
71   const char* version = eglQueryString(display, EGL_VERSION);
72   const char* extensions = eglQueryString(display, EGL_EXTENSIONS);
73   *info = GLWindowSystemBindingInfo();
74   if (vendor)
75     info->vendor = vendor;
76   if (version)
77     info->version = version;
78   if (extensions)
79     info->extensions = extensions;
80   return true;
81 }
82 
83 }  // namespace gfx
84 
85 
86