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 #include "ui/gfx/gl/gl_context_cgl.h" | 5 #include "ui/gfx/gl/gl_context_cgl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/gfx/gl/gl_bindings.h" | 8 #include "ui/gfx/gl/gl_bindings.h" |
9 #include "ui/gfx/gl/gl_surface_cgl.h" | 9 #include "ui/gfx/gl/gl_surface_cgl.h" |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 Destroy(); | 57 Destroy(); |
58 return false; | 58 return false; |
59 } | 59 } |
60 | 60 |
61 if (CGLSetCurrentContext( | 61 if (CGLSetCurrentContext( |
62 static_cast<CGLContextObj>(context_)) != kCGLNoError) { | 62 static_cast<CGLContextObj>(context_)) != kCGLNoError) { |
63 LOG(ERROR) << "Unable to make gl context current."; | 63 LOG(ERROR) << "Unable to make gl context current."; |
64 return false; | 64 return false; |
65 } | 65 } |
66 | 66 |
| 67 surface->OnMakeCurrent(); |
67 return true; | 68 return true; |
68 } | 69 } |
69 | 70 |
70 void GLContextCGL::ReleaseCurrent(GLSurface* surface) { | 71 void GLContextCGL::ReleaseCurrent(GLSurface* surface) { |
71 if (!IsCurrent(surface)) | 72 if (!IsCurrent(surface)) |
72 return; | 73 return; |
73 | 74 |
74 CGLSetCurrentContext(NULL); | 75 CGLSetCurrentContext(NULL); |
75 CGLSetPBuffer(static_cast<CGLContextObj>(context_), NULL, 0, 0, 0); | 76 CGLSetPBuffer(static_cast<CGLContextObj>(context_), NULL, 0, 0, 0); |
76 } | 77 } |
(...skipping 22 matching lines...) Expand all Loading... |
99 void* GLContextCGL::GetHandle() { | 100 void* GLContextCGL::GetHandle() { |
100 return context_; | 101 return context_; |
101 } | 102 } |
102 | 103 |
103 void GLContextCGL::SetSwapInterval(int interval) { | 104 void GLContextCGL::SetSwapInterval(int interval) { |
104 DCHECK(IsCurrent(NULL)); | 105 DCHECK(IsCurrent(NULL)); |
105 LOG(WARNING) << "GLContex: GLContextCGL::SetSwapInterval is ignored."; | 106 LOG(WARNING) << "GLContex: GLContextCGL::SetSwapInterval is ignored."; |
106 } | 107 } |
107 | 108 |
108 } // namespace gfx | 109 } // namespace gfx |
OLD | NEW |