[vlc-commits] commit: skins2: cache scaled image (Erwan Tulou )
git at videolan.org
git at videolan.org
Sun Jan 16 23:05:50 CET 2011
vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Wed Jan 5 18:49:32 2011 +0100| [8c18c69a74cda15c66dbc5896601658f12e3344a] | committer: Erwan Tulou
skins2: cache scaled image
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8c18c69a74cda15c66dbc5896601658f12e3344a
---
modules/gui/skins2/controls/ctrl_tree.cpp | 15 ++++++++++++---
modules/gui/skins2/controls/ctrl_tree.hpp | 2 ++
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/modules/gui/skins2/controls/ctrl_tree.cpp b/modules/gui/skins2/controls/ctrl_tree.cpp
index 508eb41..3c78c31 100644
--- a/modules/gui/skins2/controls/ctrl_tree.cpp
+++ b/modules/gui/skins2/controls/ctrl_tree.cpp
@@ -61,7 +61,8 @@ CtrlTree::CtrlTree( intf_thread_t *pIntf,
m_pOpenBitmap( pOpenBitmap ), m_pClosedBitmap( pClosedBitmap ),
m_fgColor( fgColor ), m_playColor( playColor ), m_bgColor1( bgColor1 ),
m_bgColor2( bgColor2 ), m_selColor( selColor ),
- m_pLastSelected( NULL ), m_pImage( NULL ), m_dontMove( false )
+ m_pLastSelected( NULL ), m_pImage( NULL ), m_dontMove( false ),
+ m_pScaledBitmap( NULL )
{
// Observe the tree and position variables
m_rTree.addObserver( this );
@@ -78,6 +79,7 @@ CtrlTree::~CtrlTree()
{
m_rTree.getPositionVar().delObserver( this );
m_rTree.delObserver( this );
+ delete m_pScaledBitmap;
delete m_pImage;
}
@@ -791,8 +793,15 @@ void CtrlTree::makeImage()
if( m_pBgBitmap )
{
// Draw the background bitmap
- ScaledBitmap bmp( getIntf(), *m_pBgBitmap, width, height );
- m_pImage->drawBitmap( bmp, 0, 0 );
+ if( !m_pScaledBitmap ||
+ m_pScaledBitmap->getWidth() != width ||
+ m_pScaledBitmap->getHeight() != height )
+ {
+ delete m_pScaledBitmap;
+ m_pScaledBitmap =
+ new ScaledBitmap( getIntf(), *m_pBgBitmap, width, height );
+ }
+ m_pImage->drawBitmap( *m_pScaledBitmap, 0, 0 );
for( int yPos = 0; yPos < height; yPos += i_itemHeight )
{
diff --git a/modules/gui/skins2/controls/ctrl_tree.hpp b/modules/gui/skins2/controls/ctrl_tree.hpp
index 44ff222..b3a8200 100644
--- a/modules/gui/skins2/controls/ctrl_tree.hpp
+++ b/modules/gui/skins2/controls/ctrl_tree.hpp
@@ -98,6 +98,8 @@ private:
const GenericBitmap *m_pOpenBitmap;
/// Closed node bitmap
const GenericBitmap *m_pClosedBitmap;
+ /// scaled bitmap
+ GenericBitmap *m_pScaledBitmap;
/// Color of normal test
uint32_t m_fgColor;
/// Color of the playing item
More information about the vlc-commits
mailing list