[vlc-commits] vout_macosx: added HiDPI support
Felix Paul Kühne
git at videolan.org
Tue Jun 12 19:05:34 CEST 2012
vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Tue Jun 12 18:50:48 2012 +0200| [af3a690427169763749987475727b0e37a6b6211] | committer: Felix Paul Kühne
vout_macosx: added HiDPI support
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=af3a690427169763749987475727b0e37a6b6211
---
modules/video_output/macosx.m | 32 ++++++++++++++++++++++++++++----
1 file changed, 28 insertions(+), 4 deletions(-)
diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
index 4cc86c7..0fe6041 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -389,7 +389,12 @@ static int Control (vout_display_t *vd, int query, va_list ap)
if (!config_GetInt(vd, "macosx-video-autoresize"))
{
- NSRect bounds = [sys->glView bounds];
+ NSRect bounds;
+ /* on HiDPI displays, the point bounds don't equal the actual pixel based bounds */
+ if ([sys->glView respondsToSelector:@selector(convertRectToBacking:)])
+ bounds = [sys->glView convertRectToBacking:[sys->glView bounds]];
+ else
+ bounds = [sys->glView bounds];
cfg_tmp.display.width = bounds.size.width;
cfg_tmp.display.height = bounds.size.height;
}
@@ -506,6 +511,10 @@ static void OpenglSwap (vlc_gl_t *gl)
if (!self)
return nil;
+ /* enable HiDPI support on OS X 10.7 and later */
+ if ([self respondsToSelector:@selector(setWantsBestResolutionOpenGLSurface:)])
+ [self setWantsBestResolutionOpenGLSurface:YES];
+
/* Swap buffers only during the vertical retrace of the monitor.
http://developer.apple.com/documentation/GraphicsImaging/
Conceptual/OpenGL/chap5/chapter_5_section_44.html */
@@ -522,7 +531,13 @@ static void OpenglSwap (vlc_gl_t *gl)
- (void)setFrameToBoundsOfView:(NSValue *)value
{
NSView *parentView = [value pointerValue];
- [self setFrame:[parentView bounds]];
+ NSRect frame;
+ /* on HiDPI displays, the point bounds don't equal the actual pixel based bounds */
+ if ([parentView respondsToSelector:@selector(convertRectToBacking:)])
+ frame = [parentView convertRectToBacking:[parentView bounds]];
+ else
+ frame = [parentView bounds];
+ [self setFrame:frame];
}
/**
@@ -618,7 +633,12 @@ static void OpenglSwap (vlc_gl_t *gl)
{
VLCAssertMainThread();
- NSRect bounds = [self bounds];
+ NSRect bounds;
+ /* on HiDPI displays, the point bounds don't equal the actual pixel based bounds */
+ if ([self respondsToSelector:@selector(convertRectToBacking:)])
+ bounds = [self convertRectToBacking:[self bounds]];
+ else
+ bounds = [self bounds];
vout_display_place_t place;
@synchronized(self) {
@@ -752,7 +772,11 @@ static void OpenglSwap (vlc_gl_t *gl)
NSRect s_rect;
BOOL b_inside;
- s_rect = [self bounds];
+ /* on HiDPI displays, the point bounds don't equal the actual pixel based bounds */
+ if ([self respondsToSelector:@selector(convertRectToBacking:)])
+ s_rect = [self convertRectToBacking:[self bounds]];
+ else
+ s_rect = [self bounds];
ml = [self convertPoint: [o_event locationInWindow] fromView: nil];
b_inside = [self mouse: ml inRect: s_rect];
More information about the vlc-commits
mailing list