}
-static os::thread_specific_ptr<Context>
+Context::~Context()
+{
+ //assert(this != getCurrentContext());
+ if (this != getCurrentContext()) {
+ delete wsContext;
+ }
+}
+
+
+static OS_THREAD_SPECIFIC_PTR(Context)
currentContextPtr;
bool
makeCurrent(trace::Call &call, glws::Drawable *drawable, Context *context)
{
- Context *currentContext = currentContextPtr.release();
+ Context *currentContext = currentContextPtr;
glws::Drawable *currentDrawable = currentContext ? currentContext->drawable : NULL;
if (drawable == currentDrawable && context == currentContext) {
return false;
}
- if (currentContext) {
- currentContext->drawable = NULL;
- }
+ currentContextPtr = context;
if (drawable && context) {
context->drawable = drawable;
- currentContextPtr.reset(context);
if (!context->used) {
initContext();
Context *
getCurrentContext(void) {
- return currentContextPtr.get();
+ return currentContextPtr;
}
return;
}
+ width = std::max(width, currentDrawable->width);
+ height = std::max(height, currentDrawable->height);
+
// Check for bound framebuffer last, as this may have a performance impact.
GLint draw_framebuffer = 0;
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &draw_framebuffer);