OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/gfx/gl/gl_surface.h" | 5 #include "ui/gfx/gl/gl_surface.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 DVLOG(1) << "Using " | 63 DVLOG(1) << "Using " |
64 << GetGLImplementationName(GetGLImplementation()) | 64 << GetGLImplementationName(GetGLImplementation()) |
65 << " GL implementation."; | 65 << " GL implementation."; |
66 if (CommandLine::ForCurrentProcess()->HasSwitch( | 66 if (CommandLine::ForCurrentProcess()->HasSwitch( |
67 switches::kEnableGPUServiceLogging)) | 67 switches::kEnableGPUServiceLogging)) |
68 InitializeDebugGLBindings(); | 68 InitializeDebugGLBindings(); |
69 } | 69 } |
70 return initialized; | 70 return initialized; |
71 } | 71 } |
72 | 72 |
73 GLSurface::GLSurface() { | 73 GLSurface::GLSurface() {} |
74 } | |
75 | |
76 GLSurface::~GLSurface() { | |
77 if (GetCurrent() == this) | |
78 SetCurrent(NULL); | |
79 } | |
80 | 74 |
81 bool GLSurface::Initialize() | 75 bool GLSurface::Initialize() |
82 { | 76 { |
83 return true; | 77 return true; |
84 } | 78 } |
85 | 79 |
86 bool GLSurface::Resize(const gfx::Size& size) { | 80 bool GLSurface::Resize(const gfx::Size& size) { |
87 NOTIMPLEMENTED(); | 81 NOTIMPLEMENTED(); |
88 return false; | 82 return false; |
89 } | 83 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 121 |
128 unsigned GLSurface::GetFormat() { | 122 unsigned GLSurface::GetFormat() { |
129 NOTIMPLEMENTED(); | 123 NOTIMPLEMENTED(); |
130 return 0; | 124 return 0; |
131 } | 125 } |
132 | 126 |
133 GLSurface* GLSurface::GetCurrent() { | 127 GLSurface* GLSurface::GetCurrent() { |
134 return current_surface_.Pointer()->Get(); | 128 return current_surface_.Pointer()->Get(); |
135 } | 129 } |
136 | 130 |
| 131 GLSurface::~GLSurface() { |
| 132 if (GetCurrent() == this) |
| 133 SetCurrent(NULL); |
| 134 } |
| 135 |
137 void GLSurface::SetCurrent(GLSurface* surface) { | 136 void GLSurface::SetCurrent(GLSurface* surface) { |
138 current_surface_.Pointer()->Set(surface); | 137 current_surface_.Pointer()->Set(surface); |
139 } | 138 } |
140 | 139 |
141 GLSurfaceAdapter::GLSurfaceAdapter(GLSurface* surface) : surface_(surface) { | 140 GLSurfaceAdapter::GLSurfaceAdapter(GLSurface* surface) : surface_(surface) {} |
142 } | |
143 | |
144 GLSurfaceAdapter::~GLSurfaceAdapter() { | |
145 } | |
146 | 141 |
147 bool GLSurfaceAdapter::Initialize() { | 142 bool GLSurfaceAdapter::Initialize() { |
148 return surface_->Initialize(); | 143 return surface_->Initialize(); |
149 } | 144 } |
150 | 145 |
151 void GLSurfaceAdapter::Destroy() { | 146 void GLSurfaceAdapter::Destroy() { |
152 surface_->Destroy(); | 147 surface_->Destroy(); |
153 } | 148 } |
154 | 149 |
155 bool GLSurfaceAdapter::Resize(const gfx::Size& size) { | 150 bool GLSurfaceAdapter::Resize(const gfx::Size& size) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 } | 196 } |
202 | 197 |
203 void* GLSurfaceAdapter::GetConfig() { | 198 void* GLSurfaceAdapter::GetConfig() { |
204 return surface_->GetConfig(); | 199 return surface_->GetConfig(); |
205 } | 200 } |
206 | 201 |
207 unsigned GLSurfaceAdapter::GetFormat() { | 202 unsigned GLSurfaceAdapter::GetFormat() { |
208 return surface_->GetFormat(); | 203 return surface_->GetFormat(); |
209 } | 204 } |
210 | 205 |
| 206 GLSurfaceAdapter::~GLSurfaceAdapter() {} |
| 207 |
211 } // namespace gfx | 208 } // namespace gfx |
OLD | NEW |