OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This file implements the GLContextWGL and PbufferGLContext classes. | 5 // This file implements the GLContextWGL and PbufferGLContext classes. |
6 | 6 |
7 #include "ui/gfx/gl/gl_context_wgl.h" | 7 #include "ui/gfx/gl/gl_context_wgl.h" |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "ui/gfx/gl/gl_bindings.h" | 10 #include "ui/gfx/gl/gl_bindings.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 bool GLContextWGL::MakeCurrent(GLSurface* surface) { | 75 bool GLContextWGL::MakeCurrent(GLSurface* surface) { |
76 DCHECK(context_); | 76 DCHECK(context_); |
77 if (IsCurrent(surface)) | 77 if (IsCurrent(surface)) |
78 return true; | 78 return true; |
79 | 79 |
80 if (!wglMakeCurrent(static_cast<HDC>(surface->GetHandle()), context_)) { | 80 if (!wglMakeCurrent(static_cast<HDC>(surface->GetHandle()), context_)) { |
81 LOG(ERROR) << "Unable to make gl context current."; | 81 LOG(ERROR) << "Unable to make gl context current."; |
82 return false; | 82 return false; |
83 } | 83 } |
84 | 84 |
| 85 surface->OnMakeCurrent(); |
85 return true; | 86 return true; |
86 } | 87 } |
87 | 88 |
88 void GLContextWGL::ReleaseCurrent(GLSurface* surface) { | 89 void GLContextWGL::ReleaseCurrent(GLSurface* surface) { |
89 if (!IsCurrent(surface)) | 90 if (!IsCurrent(surface)) |
90 return; | 91 return; |
91 | 92 |
92 wglMakeCurrent(NULL, NULL); | 93 wglMakeCurrent(NULL, NULL); |
93 } | 94 } |
94 | 95 |
(...skipping 18 matching lines...) Expand all Loading... |
113 if (HasExtension("WGL_EXT_swap_control") && wglSwapIntervalEXT) { | 114 if (HasExtension("WGL_EXT_swap_control") && wglSwapIntervalEXT) { |
114 wglSwapIntervalEXT(interval); | 115 wglSwapIntervalEXT(interval); |
115 } else { | 116 } else { |
116 LOG(WARNING) << | 117 LOG(WARNING) << |
117 "Could not disable vsync: driver does not " | 118 "Could not disable vsync: driver does not " |
118 "support WGL_EXT_swap_control"; | 119 "support WGL_EXT_swap_control"; |
119 } | 120 } |
120 } | 121 } |
121 | 122 |
122 } // namespace gfx | 123 } // namespace gfx |
OLD | NEW |