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

index 92a844f640ea6b0a0e0f3981d17ebbcb090f7ce4..0ac5ac4fbd27d286ba3700cc72a0d291d7f35fd9 100644 (file)
 
 
 AnimBitmap::AnimBitmap( intf_thread_t *pIntf, const GenericBitmap &rBitmap ):
-    SkinObject( pIntf ), m_rBitmap( rBitmap ), m_pImage( NULL ),
-    m_curFrame( 0 ), m_curLoop( 0 ), m_pTimer( NULL ), m_cmdNextFrame( this )
+    SkinObject( pIntf ),
+    m_rBitmap( rBitmap ), m_pImage( rBitmap.getGraphics() ),
+    m_nbFrames( rBitmap.getNbFrames() ), m_frameRate( rBitmap.getFrameRate() ),
+    m_nbLoops( rBitmap.getNbLoops() ), m_curFrame( 0 ), m_curLoop( 0 ),
+    m_pTimer( NULL ), m_cmdNextFrame( this )
 {
-    // Build the graphics
     OSFactory *pOsFactory = OSFactory::instance( pIntf );
-    m_pImage = pOsFactory->createOSGraphics( rBitmap.getWidth(),
-                                             rBitmap.getHeight() );
-    m_pImage->drawBitmap( rBitmap, 0, 0 );
-
-    m_nbFrames = rBitmap.getNbFrames();
-    m_frameRate = rBitmap.getFrameRate();
-    m_nbLoops = rBitmap.getNbLoops();
 
     // Create the timer
     m_pTimer = pOsFactory->createOSTimer( m_cmdNextFrame );
@@ -49,7 +44,6 @@ AnimBitmap::AnimBitmap( intf_thread_t *pIntf, const GenericBitmap &rBitmap ):
 
 AnimBitmap::~AnimBitmap()
 {
-    delete m_pImage;
     delete m_pTimer;
 }
 
index bc005a784f541db23a82061b2bcbb54e3af13fc5..eea3de9cd13a220dc5a0742a7d15f4ce5c2a08a1 100644 (file)
@@ -62,7 +62,7 @@ private:
     /// Bitmap stored
     const GenericBitmap &m_rBitmap;
     /// Graphics to store the bitmap
-    OSGraphics *m_pImage;
+    const OSGraphics * const m_pImage;
     /// Number of frames
     int m_nbFrames;
     /// Frame rate