Commit 0e977dd3 authored by Cyril Deguet's avatar Cyril Deguet

- scaled_bitmap.cpp: fixed an old bug in the bresenham algorithm

  (the right side of enlarged images was not scaled properly)
parent 20bab27a
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* scaled_bitmap.cpp * scaled_bitmap.cpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr> * Olivier Teulire <ipkiss@via.ecp.fr>
...@@ -42,10 +42,10 @@ ScaledBitmap::ScaledBitmap( intf_thread_t *pIntf, const GenericBitmap &rBitmap, ...@@ -42,10 +42,10 @@ ScaledBitmap::ScaledBitmap( intf_thread_t *pIntf, const GenericBitmap &rBitmap,
// Algorithm for horizontal enlargement // Algorithm for horizontal enlargement
if( width > srcWidth ) if( width > srcWidth )
{ {
// Decision variables for Bresenham alogrithm // Decision variables for Bresenham algorithm
int incX1 = 2 * srcWidth; int incX1 = 2 * (srcWidth-1);
int incX2 = incX1 - 2 * width; int incX2 = incX1 - 2 * (width-1);
int dX = incX1 - width; int dX = incX1 - (width-1);
for( int y = 0; y < height; y++ ) for( int y = 0; y < height; y++ )
{ {
...@@ -71,10 +71,10 @@ ScaledBitmap::ScaledBitmap( intf_thread_t *pIntf, const GenericBitmap &rBitmap, ...@@ -71,10 +71,10 @@ ScaledBitmap::ScaledBitmap( intf_thread_t *pIntf, const GenericBitmap &rBitmap,
// Algorithm for horizontal reduction // Algorithm for horizontal reduction
else else
{ {
// Decision variables for Bresenham alogrithm // Decision variables for Bresenham algorithm
int incX1 = 2 * width; int incX1 = 2 * (width-1);
int incX2 = incX1 - 2 * srcWidth; int incX2 = incX1 - 2 * (srcWidth-1);
int dX = incX1 - srcWidth; int dX = incX1 - (srcWidth-1);
for( int y = 0; y < height; y++ ) for( int y = 0; y < height; y++ )
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment