]> git.sesse.net Git - vlc/commitdiff
- scaled_bitmap.cpp: fixed an old bug in the bresenham algorithm
authorCyril Deguet <asmax@videolan.org>
Sun, 3 Oct 2004 14:11:12 +0000 (14:11 +0000)
committerCyril Deguet <asmax@videolan.org>
Sun, 3 Oct 2004 14:11:12 +0000 (14:11 +0000)
  (the right side of enlarged images was not scaled properly)

modules/gui/skins2/src/scaled_bitmap.cpp

index 5cd583bcc1181a03a6f4807ca6e87024f26e2b49..199ebceda7c695c176ef8bbc2fac9f90bf0a031d 100644 (file)
@@ -2,7 +2,7 @@
  * scaled_bitmap.cpp
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: scaled_bitmap.cpp,v 1.1 2004/01/03 23:31:34 asmax Exp $
+ * $Id$
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
  *          Olivier Teulière <ipkiss@via.ecp.fr>
@@ -42,10 +42,10 @@ ScaledBitmap::ScaledBitmap( intf_thread_t *pIntf, const GenericBitmap &rBitmap,
     // Algorithm for horizontal enlargement
     if( width > srcWidth )
     {
-        // Decision variables for Bresenham alogrithm
-        int incX1 = 2 * srcWidth;
-        int incX2 = incX1 - 2 * width;
-        int dX = incX1 - width;
+        // 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++ )
         {
@@ -71,10 +71,10 @@ ScaledBitmap::ScaledBitmap( intf_thread_t *pIntf, const GenericBitmap &rBitmap,
     // Algorithm for horizontal reduction
     else
     {
-        // Decision variables for Bresenham alogrithm
-        int incX1 = 2 * width;
-        int incX2 = incX1 - 2 * srcWidth;
-        int dX = incX1 - srcWidth;
+        // 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++ )
         {