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_wgl_api_implementation.h"
6#include "ui/gl/gl_implementation.h"
7
8namespace gfx {
9
10RealWGLApi* g_real_wgl;
11
12void InitializeGLBindingsWGL() {
13  g_driver_wgl.InitializeBindings();
14  if (!g_real_wgl) {
15    g_real_wgl = new RealWGLApi();
16  }
17  g_real_wgl->Initialize(&g_driver_wgl);
18  g_current_wgl_context = g_real_wgl;
19}
20
21void InitializeGLExtensionBindingsWGL(GLContext* context) {
22  g_driver_wgl.InitializeExtensionBindings(context);
23}
24
25void InitializeDebugGLBindingsWGL() {
26  g_driver_wgl.InitializeDebugBindings();
27}
28
29void ClearGLBindingsWGL() {
30  if (g_real_wgl) {
31    delete g_real_wgl;
32    g_real_wgl = NULL;
33  }
34  g_current_wgl_context = NULL;
35  g_driver_wgl.ClearBindings();
36}
37
38WGLApi::WGLApi() {
39}
40
41WGLApi::~WGLApi() {
42}
43
44WGLApiBase::WGLApiBase()
45    : driver_(NULL) {
46}
47
48WGLApiBase::~WGLApiBase() {
49}
50
51void WGLApiBase::InitializeBase(DriverWGL* driver) {
52  driver_ = driver;
53}
54
55RealWGLApi::RealWGLApi() {
56}
57
58RealWGLApi::~RealWGLApi() {
59}
60
61void RealWGLApi::Initialize(DriverWGL* driver) {
62  InitializeBase(driver);
63}
64
65TraceWGLApi::~TraceWGLApi() {
66}
67
68bool GetGLWindowSystemBindingInfoWGL(GLWindowSystemBindingInfo* info) {
69  const char* extensions = wglGetExtensionsStringEXT();
70  *info = GLWindowSystemBindingInfo();
71  if (extensions)
72    info->extensions = extensions;
73  return true;
74}
75
76}  // namespace gfx
77
78
79