]> git.sesse.net Git - vlc/commitdiff
* skins2/controls/ctrl_image.cpp: Avoid a crash when resizing a Image control
authorOlivier Teulière <ipkiss@videolan.org>
Tue, 15 Aug 2006 20:57:56 +0000 (20:57 +0000)
committerOlivier Teulière <ipkiss@videolan.org>
Tue, 15 Aug 2006 20:57:56 +0000 (20:57 +0000)
   to a very small size, in scaling mode

modules/gui/skins2/controls/ctrl_image.cpp

index 29367a1dab84eb1ecc2b35ee9636cf042520f638..75f8972afc13bbf57ba4f22027e9d83e0e3c8d5b 100644 (file)
@@ -100,17 +100,20 @@ void CtrlImage::draw( OSGraphics &rImage, int xDest, int yDest )
         if( m_resizeMethod == kScale )
         {
             // Use scaling method
-            if( width != m_pImage->getWidth() ||
-                height != m_pImage->getHeight() )
+            if( width > 1 && height > 1 )
             {
-                OSFactory *pOsFactory = OSFactory::instance( getIntf() );
-                // Rescale the image with the actual size of the control
-                ScaledBitmap bmp( getIntf(), m_rBitmap, width, height );
-                SKINS_DELETE( m_pImage );
-                m_pImage = pOsFactory->createOSGraphics( width, height );
-                m_pImage->drawBitmap( bmp, 0, 0 );
+                if( width != m_pImage->getWidth() ||
+                    height != m_pImage->getHeight() )
+                {
+                    OSFactory *pOsFactory = OSFactory::instance( getIntf() );
+                    // Rescale the image with the actual size of the control
+                    ScaledBitmap bmp( getIntf(), m_rBitmap, width, height );
+                    SKINS_DELETE( m_pImage );
+                    m_pImage = pOsFactory->createOSGraphics( width, height );
+                    m_pImage->drawBitmap( bmp, 0, 0 );
+                }
+                rImage.drawGraphics( *m_pImage, 0, 0, xDest, yDest );
             }
-            rImage.drawGraphics( *m_pImage, 0, 0, xDest, yDest );
         }
         else
         {