mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 18:35:35 +00:00
[837/906] cocoa: resize OpenGL view size each time the window is resized
Fixes glitches that can appear when the OpenGL view has not been resized after a window resize. https://bugzilla.gnome.org/show_bug.cgi?id=711672
This commit is contained in:
parent
cc0b1f3e05
commit
32265d7e4e
2 changed files with 9 additions and 15 deletions
|
@ -66,7 +66,6 @@ struct _GstGLContextCocoaPrivate
|
|||
|
||||
@interface GstGLNSOpenGLView: NSOpenGLView {
|
||||
GstGLWindowCocoa *m_cocoa;
|
||||
gint m_resizeCount;
|
||||
}
|
||||
- (id) initWithFrame:(GstGLWindowCocoa *)window rect:(NSRect)contentRect
|
||||
pixelFormat:(NSOpenGLPixelFormat *)fmt;
|
||||
|
|
|
@ -449,7 +449,6 @@ gst_gl_window_cocoa_send_message_async (GstGLWindow * window,
|
|||
self = [super initWithFrame: contentRect pixelFormat: fmt];
|
||||
|
||||
m_cocoa = window;
|
||||
m_resizeCount = 0;
|
||||
|
||||
#ifndef GNUSTEP
|
||||
[self setWantsLayer:NO];
|
||||
|
@ -463,23 +462,19 @@ gst_gl_window_cocoa_send_message_async (GstGLWindow * window,
|
|||
|
||||
window = GST_GL_WINDOW (m_cocoa);
|
||||
|
||||
if (m_resizeCount % 5 == 0) {
|
||||
m_resizeCount = 0;
|
||||
if (window->resize) {
|
||||
if (window->resize) {
|
||||
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
NSRect bounds = [self bounds];
|
||||
AppThreadPerformer* app_thread_performer = [[AppThreadPerformer alloc]
|
||||
initWithSize:m_cocoa callback:window->resize userData:window->resize_data
|
||||
toSize:bounds.size];
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
NSRect bounds = [self bounds];
|
||||
AppThreadPerformer* app_thread_performer = [[AppThreadPerformer alloc]
|
||||
initWithSize:m_cocoa callback:window->resize userData:window->resize_data
|
||||
toSize:bounds.size];
|
||||
|
||||
[app_thread_performer performSelector:@selector(resizeWindow) onThread:m_cocoa->priv->thread
|
||||
withObject:nil waitUntilDone:YES];
|
||||
[app_thread_performer performSelector:@selector(resizeWindow) onThread:m_cocoa->priv->thread
|
||||
withObject:nil waitUntilDone:YES];
|
||||
|
||||
[pool release];
|
||||
}
|
||||
[pool release];
|
||||
}
|
||||
m_resizeCount++;
|
||||
}
|
||||
|
||||
- (void) update {
|
||||
|
|
Loading…
Reference in a new issue