[vlc-commits] macosx/fspanel: optimize image rendering for sliders and background
Felix Paul Kühne
git at videolan.org
Wed Jun 27 17:10:09 CEST 2012
vlc/vlc-2.0 | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Mon Jun 25 00:48:48 2012 +0200| [b89922682e75695e4a56980ef80fb2731c114608] | committer: Felix Paul Kühne
macosx/fspanel: optimize image rendering for sliders and background
no user-visible change.
(cherry picked from commit 77442ae2072b81c5a6ec0e5900a15358adceafe1)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=b89922682e75695e4a56980ef80fb2731c114608
---
modules/gui/macosx/fspanel.h | 1 +
modules/gui/macosx/fspanel.m | 28 +++++++++++++++++++---------
2 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/modules/gui/macosx/fspanel.h b/modules/gui/macosx/fspanel.h
index c34be11..b6c32db 100644
--- a/modules/gui/macosx/fspanel.h
+++ b/modules/gui/macosx/fspanel.h
@@ -79,6 +79,7 @@
NSButton *o_prev, *o_next, *o_bwd, *o_fwd, *o_play, *o_fullscreen;
NSTextField *o_streamTitle_txt, *o_streamPosition_txt;
NSSlider *o_fs_timeSlider, *o_fs_volumeSlider;
+ NSImage *o_background_img, *o_vol_sld_img, *o_vol_mute_img, *o_vol_max_img, *o_time_sld_img;
}
- (id)initWithFrame: (NSRect)frameRect;
- (void)drawRect: (NSRect)rect;
diff --git a/modules/gui/macosx/fspanel.m b/modules/gui/macosx/fspanel.m
index c38ae26..b707092 100644
--- a/modules/gui/macosx/fspanel.m
+++ b/modules/gui/macosx/fspanel.m
@@ -472,11 +472,22 @@
s_rc.size.width = 65;
addTextfield( VLCTimeField, o_streamPosition_txt, NSRightTextAlignment, systemFontOfSize, whiteColor );
+ o_background_img = [[NSImage imageNamed:@"fs_background"] retain];
+ o_vol_sld_img = [[NSImage imageNamed:@"fs_volume_slider_bar"] retain];
+ o_vol_mute_img = [[NSImage imageNamed:@"fs_volume_mute"] retain];
+ o_vol_max_img = [[NSImage imageNamed:@"fs_volume_max"] retain];
+ o_time_sld_img = [[NSImage imageNamed:@"fs_time_slider"] retain];
+
return view;
}
- (void)dealloc
{
+ [o_background_img release];
+ [o_vol_sld_img release];
+ [o_vol_mute_img release];
+ [o_vol_max_img release];
+ [o_time_sld_img release];
[o_fs_timeSlider release];
[o_fs_volumeSlider release];
[o_prev release];
@@ -576,26 +587,25 @@
}
#define addImage(image, _x, _y, mode, _width) \
- img = [NSImage imageNamed:image]; \
- image_rect.size = [img size]; \
+ image_rect.size = [image size]; \
image_rect.origin.x = 0; \
image_rect.origin.y = 0; \
frame.origin.x = _x; \
frame.origin.y = _y; \
- frame.size = [img size]; \
+ frame.size = [image size]; \
if( _width ) frame.size.width = _width; \
- [img drawInRect:frame fromRect:image_rect operation:mode fraction:1];
+ [image drawInRect:frame fromRect:image_rect operation:mode fraction:1];
- (void)drawRect:(NSRect)rect
{
NSRect frame = [self frame];
NSRect image_rect;
NSImage *img;
- addImage( @"fs_background", 0, 0, NSCompositeCopy, 0 );
- addImage( @"fs_volume_slider_bar", 26, 23, NSCompositeSourceOver, 0 );
- addImage( @"fs_volume_mute", 16, 18, NSCompositeSourceOver, 0 );
- addImage( @"fs_volume_max", 124, 18, NSCompositeSourceOver, 0 );
- addImage( @"fs_time_slider", 15, 53, NSCompositeSourceOver, 0);
+ addImage( o_background_img, 0, 0, NSCompositeCopy, 0 );
+ addImage( o_vol_sld_img, 26, 23, NSCompositeSourceOver, 0 );
+ addImage( o_vol_mute_img, 16, 18, NSCompositeSourceOver, 0 );
+ addImage( o_vol_max_img, 124, 18, NSCompositeSourceOver, 0 );
+ addImage( o_time_sld_img, 15, 53, NSCompositeSourceOver, 0);
}
@end
More information about the vlc-commits
mailing list