]> git.sesse.net Git - vlc/commitdiff
skins2: reuse graphics from generic bitmap cache (radialslider)
authorErwan Tulou <erwan10@videolan.org>
Sat, 6 Apr 2013 00:20:59 +0000 (02:20 +0200)
committerErwan Tulou <erwan10@videolan.org>
Sat, 6 Apr 2013 12:46:51 +0000 (14:46 +0200)
modules/gui/skins2/controls/ctrl_radialslider.cpp
modules/gui/skins2/controls/ctrl_radialslider.hpp

index 14a6e2d274b532e1c7ddb90b772b73c1e0cc477c..e06673a4957b75568bd55d6fb79c655d53bb74a9 100644 (file)
@@ -40,17 +40,11 @@ CtrlRadialSlider::CtrlRadialSlider( intf_thread_t *pIntf,
                                     VarBool *pVisible ):
     CtrlGeneric( pIntf, rHelp, pVisible ), m_fsm( pIntf ), m_numImg( numImg ),
     m_rVariable( rVariable ), m_minAngle( minAngle ), m_maxAngle( maxAngle ),
-    m_position( 0 ), m_cmdUpDown( this ), m_cmdDownUp( this ),
-    m_cmdMove( this )
+    m_position( 0 ),
+    m_width( rBmpSeq.getWidth() ), m_height( rBmpSeq.getHeight() / numImg ),
+    m_pImgSeq( rBmpSeq.getGraphics() ),
+    m_cmdUpDown( this ), m_cmdDownUp( this ), m_cmdMove( this )
 {
-    // Build the images of the sequence
-    m_pImgSeq = OSFactory::instance( getIntf() )->createOSGraphics(
-                                     rBmpSeq.getWidth(), rBmpSeq.getHeight() );
-    m_pImgSeq->drawBitmap( rBmpSeq, 0, 0 );
-
-    m_width = rBmpSeq.getWidth();
-    m_height = rBmpSeq.getHeight() / numImg;
-
     // States
     m_fsm.addState( "up" );
     m_fsm.addState( "down" );
@@ -71,7 +65,6 @@ CtrlRadialSlider::CtrlRadialSlider( intf_thread_t *pIntf,
 CtrlRadialSlider::~CtrlRadialSlider()
 {
     m_rVariable.delObserver( this );
-    delete m_pImgSeq;
 }
 
 
index e17852b0a23aa82bbb689a41c8b985622fe334f0..b7d427b797184b67e323f2277b74187fb263b22b 100644 (file)
@@ -76,9 +76,7 @@ private:
     /// The last received event
     EvtGeneric *m_pEvt;
     /// Sequence of images
-    OSGraphics *m_pImgSeq;
-    /// Last saved position
-    int m_lastPos;
+    const OSGraphics * const m_pImgSeq;
 
     /// Callback objects
     DEFINE_CALLBACK( CtrlRadialSlider, UpDown )