[vlc-commits] skins2: reuse graphics from generic bitmap cache (animbitmap)

Erwan Tulou git at videolan.org
Sat Apr 6 14:50:10 CEST 2013


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Sat Apr  6 02:21:41 2013 +0200| [b44827004cb5c4cd4792ccf8ca96662f88e942b9] | committer: Erwan Tulou

skins2: reuse graphics from generic bitmap cache (animbitmap)

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

 modules/gui/skins2/src/anim_bitmap.cpp |   16 +++++-----------
 modules/gui/skins2/src/anim_bitmap.hpp |    2 +-
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/modules/gui/skins2/src/anim_bitmap.cpp b/modules/gui/skins2/src/anim_bitmap.cpp
index 92a844f..0ac5ac4 100644
--- a/modules/gui/skins2/src/anim_bitmap.cpp
+++ b/modules/gui/skins2/src/anim_bitmap.cpp
@@ -29,18 +29,13 @@
 
 
 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;
 }
 
diff --git a/modules/gui/skins2/src/anim_bitmap.hpp b/modules/gui/skins2/src/anim_bitmap.hpp
index bc005a7..eea3de9 100644
--- a/modules/gui/skins2/src/anim_bitmap.hpp
+++ b/modules/gui/skins2/src/anim_bitmap.hpp
@@ -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



More information about the vlc-commits mailing list