[vlc-commits] commit: macosx_vout: Correctly change context after -lockgl. (Pierre d' Herbemont )
git at videolan.org
git at videolan.org
Mon May 3 12:47:21 CEST 2010
vlc | branch: master | Pierre d'Herbemont <pdherbemont at free.fr> | Mon May 3 12:46:15 2010 +0200| [0484b127c762d7519726db78e2017cb762a20c1a] | committer: Pierre d'Herbemont
macosx_vout: Correctly change context after -lockgl.
And don't unlockgl if lockgl wasn't successful.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0484b127c762d7519726db78e2017cb762a20c1a
---
modules/video_output/macosx.m | 29 ++++++++++++++++-------------
1 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
index ff965fd..3394a77 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -419,7 +419,10 @@ static void OpenglSwap(vout_opengl_t *gl)
- (BOOL)lockgl
{
VLCAssertMainThread();
- CGLError err = CGLLockContext([[self openGLContext] CGLContextObj]);
+ NSOpenGLContext *context = [self openGLContext];
+ CGLError err = CGLLockContext([context CGLContextObj]);
+ if (err == kCGLNoError)
+ [context makeCurrentContext];
return err == kCGLNoError;
}
@@ -493,21 +496,21 @@ static void OpenglSwap(vout_opengl_t *gl)
}
}
- [self lockgl];
+ if ([self lockgl]) {
+ glViewport((width - x) / 2, (height - y) / 2, x, y);
- glViewport((width - x) / 2, (height - y) / 2, x, y);
-
- @synchronized(self) {
- // This may be cleared before -drawRect is being called,
- // in this case we'll skip the rendering.
- // This will save us for rendering two frames (or more) for nothing
- // (one by the vout, one (or more) by drawRect)
- _hasPendingReshape = YES;
- }
+ @synchronized(self) {
+ // This may be cleared before -drawRect is being called,
+ // in this case we'll skip the rendering.
+ // This will save us for rendering two frames (or more) for nothing
+ // (one by the vout, one (or more) by drawRect)
+ _hasPendingReshape = YES;
+ }
- [self unlockgl];
+ [self unlockgl];
- [super reshape];
+ [super reshape];
+ }
}
/**
More information about the vlc-commits
mailing list