]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins2/src/scaled_bitmap.cpp
Merge branch 'base' into master
[vlc] / modules / gui / skins2 / src / scaled_bitmap.cpp
index 199ebceda7c695c176ef8bbc2fac9f90bf0a031d..576c96f12c2ca1598dc4c965e7273635dbc3ee11 100644 (file)
@@ -1,11 +1,11 @@
 /*****************************************************************************
  * scaled_bitmap.cpp
  *****************************************************************************
- * Copyright (C) 2003 VideoLAN
+ * Copyright (C) 2003 the VideoLAN team
  * $Id$
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
- *          Olivier Teulière <ipkiss@via.ecp.fr>
+ *          Olivier Teulière <ipkiss@via.ecp.fr>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 #include "scaled_bitmap.hpp"
@@ -45,10 +45,10 @@ ScaledBitmap::ScaledBitmap( intf_thread_t *pIntf, const GenericBitmap &rBitmap,
         // Decision variables for Bresenham algorithm
         int incX1 = 2 * (srcWidth-1);
         int incX2 = incX1 - 2 * (width-1);
-        int dX = incX1 - (width-1);
 
         for( int y = 0; y < height; y++ )
         {
+            int dX = incX1 - (width-1);
             uint32_t yOffset = ((y * srcHeight) / height) * srcWidth;
             pSrcData = ((uint32_t*)rBitmap.getData()) + yOffset;
 
@@ -74,14 +74,18 @@ ScaledBitmap::ScaledBitmap( intf_thread_t *pIntf, const GenericBitmap &rBitmap,
         // Decision variables for Bresenham algorithm
         int incX1 = 2 * (width-1);
         int incX2 = incX1 - 2 * (srcWidth-1);
-        int dX = incX1 - (srcWidth-1);
 
         for( int y = 0; y < height; y++ )
         {
+            int dX = incX1 - (srcWidth-1);
             uint32_t yOffset = ((y * srcHeight) / height) * srcWidth;
             pSrcData = ((uint32_t*)rBitmap.getData()) + yOffset;
 
-            for( int x = 0; x < width; x++ )
+            if (width == 1)
+            {
+                *(pDestData++) = *pSrcData;
+            }
+            else for( int x = 0; x < width; x++ )
             {
                 *(pDestData++) = *(pSrcData++);