Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: ui/gl/gl_context_osmesa.cc

Issue 15928002: GPU: Keep track of the last real context and real surface made current. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make GetRealCurrent protected. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW
« ui/gl/gl_context.cc ('K') | « ui/gl/gl_context_glx.cc ('k') | ui/gl/gl_context_stub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698