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/gl/gl_context_osmesa.h" | 5 #include "ui/gl/gl_context_osmesa.h" |
6 | 6 |
7 #include <GL/osmesa.h> | 7 #include <GL/osmesa.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "ui/gfx/size.h" | 10 #include "ui/gfx/size.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 bool GLContextOSMesa::IsCurrent(GLSurface* surface) { | 91 bool GLContextOSMesa::IsCurrent(GLSurface* surface) { |
92 DCHECK(context_); | 92 DCHECK(context_); |
93 | 93 |
94 bool native_context_is_current = | 94 bool native_context_is_current = |
95 context_ == OSMesaGetCurrentContext(); | 95 context_ == OSMesaGetCurrentContext(); |
96 | 96 |
97 // If our context is current then our notion of which GLContext is | 97 // If our context is current then our notion of which GLContext is |
98 // current must be correct. On the other hand, third-party code | 98 // current must be correct. On the other hand, third-party code |
99 // using OpenGL might change the current context. | 99 // using OpenGL might change the current context. |
100 DCHECK(!native_context_is_current || (GetCurrent() == this)); | 100 DCHECK(!native_context_is_current || (GetRealCurrent() == this)); |
101 | 101 |
102 if (!native_context_is_current) | 102 if (!native_context_is_current) |
103 return false; | 103 return false; |
104 | 104 |
105 if (surface) { | 105 if (surface) { |
106 GLint width; | 106 GLint width; |
107 GLint height; | 107 GLint height; |
108 GLint format; | 108 GLint format; |
109 void* buffer = NULL; | 109 void* buffer = NULL; |
110 OSMesaGetColorBuffer(context_, &width, &height, &format, &buffer); | 110 OSMesaGetColorBuffer(context_, &width, &height, &format, &buffer); |
(...skipping 11 matching lines...) Expand all Loading... |
122 void GLContextOSMesa::SetSwapInterval(int interval) { | 122 void GLContextOSMesa::SetSwapInterval(int interval) { |
123 DCHECK(IsCurrent(NULL)); | 123 DCHECK(IsCurrent(NULL)); |
124 DLOG(INFO) << "GLContextOSMesa::SetSwapInterval is ignored."; | 124 DLOG(INFO) << "GLContextOSMesa::SetSwapInterval is ignored."; |
125 } | 125 } |
126 | 126 |
127 GLContextOSMesa::~GLContextOSMesa() { | 127 GLContextOSMesa::~GLContextOSMesa() { |
128 Destroy(); | 128 Destroy(); |
129 } | 129 } |
130 | 130 |
131 } // namespace gfx | 131 } // namespace gfx |
OLD | NEW |