Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ui / gl / gl_wgl_api_implementation.cc
blob889a53f1b8d1e40761842fe0d3ecc66c184e6ec9
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.
5 #include "ui/gl/gl_wgl_api_implementation.h"
6 #include "ui/gl/gl_implementation.h"
8 namespace gfx {
10 RealWGLApi* g_real_wgl;
12 void InitializeStaticGLBindingsWGL() {
13 g_driver_wgl.InitializeStaticBindings();
14 if (!g_real_wgl) {
15 g_real_wgl = new RealWGLApi();
17 g_real_wgl->Initialize(&g_driver_wgl);
18 g_current_wgl_context = g_real_wgl;
21 void InitializeDynamicGLBindingsWGL(GLContext* context) {
22 g_driver_wgl.InitializeDynamicBindings(context);
25 void InitializeDebugGLBindingsWGL() {
26 g_driver_wgl.InitializeDebugBindings();
29 void ClearGLBindingsWGL() {
30 if (g_real_wgl) {
31 delete g_real_wgl;
32 g_real_wgl = NULL;
34 g_current_wgl_context = NULL;
35 g_driver_wgl.ClearBindings();
38 WGLApi::WGLApi() {
41 WGLApi::~WGLApi() {
44 WGLApiBase::WGLApiBase()
45 : driver_(NULL) {
48 WGLApiBase::~WGLApiBase() {
51 void WGLApiBase::InitializeBase(DriverWGL* driver) {
52 driver_ = driver;
55 RealWGLApi::RealWGLApi() {
58 RealWGLApi::~RealWGLApi() {
61 void RealWGLApi::Initialize(DriverWGL* driver) {
62 InitializeBase(driver);
65 TraceWGLApi::~TraceWGLApi() {
68 bool GetGLWindowSystemBindingInfoWGL(GLWindowSystemBindingInfo* info) {
69 const char* extensions = wglGetExtensionsStringEXT();
70 *info = GLWindowSystemBindingInfo();
71 if (extensions)
72 info->extensions = extensions;
73 return true;
76 } // namespace gfx