[vlc-commits] macosx/fspanel: optimize image rendering for sliders and background

Felix Paul Kühne git at videolan.org
Mon Jun 25 00:49:01 CEST 2012


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Mon Jun 25 00:48:48 2012 +0200| [77442ae2072b81c5a6ec0e5900a15358adceafe1] | committer: Felix Paul Kühne

macosx/fspanel: optimize image rendering for sliders and background

no user-visible change.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=77442ae2072b81c5a6ec0e5900a15358adceafe1
---

 modules/gui/macosx/fspanel.h |    2 +-
 modules/gui/macosx/fspanel.m |   28 +++++++++++++++++++---------
 2 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/modules/gui/macosx/fspanel.h b/modules/gui/macosx/fspanel.h
index 5461e05..ea06de8 100644
--- a/modules/gui/macosx/fspanel.h
+++ b/modules/gui/macosx/fspanel.h
@@ -71,7 +71,6 @@
 
 - (BOOL)isDisplayed;
 - (void)setVoutWasUpdated: (int)i_screen;
-- (void)adaptWindowSizeToScreen;
 @end
 
 @interface VLCFSPanelView : NSView
@@ -80,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 99376f0..43c4c61 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