Kaydet (Commit) 794a1f8e authored tarafından Herbert Dürr's avatar Herbert Dürr Kaydeden (comit) Caolán McNamara

Resolves: #i122796# fix half-pixel offset in StretchAndConvert...

image scaling

(cherry picked from commit ec3d4841)

Change-Id: Idc4bf7acc30c24a788be79c3686155e924afb28c
üst fc67191b
......@@ -391,12 +391,12 @@ BitmapBuffer* StretchAndConvert(
}
// horizontal mapping table
if( nDstDX != nSrcDX )
if( (nDstDX != nSrcDX) && (nDstDX != 0) )
{
const double fFactorX = ( nDstDX > 1 ) ? (double) ( nSrcDX - 1 ) / ( nDstDX - 1 ) : 0.0;
const double fFactorX = (double)nSrcDX / nDstDX;
for( i = 0L; i < nDstDX; i++ )
pMapX[ i ] = nSrcX + FRound( i * fFactorX );
pMapX[ i ] = nSrcX + static_cast<int>( i * fFactorX );
}
else
{
......@@ -405,12 +405,12 @@ BitmapBuffer* StretchAndConvert(
}
// vertical mapping table
if( nDstDY != nSrcDY )
if( (nDstDY != nSrcDY) && (nDstDY != 0) )
{
const double fFactorY = ( nDstDY > 1 ) ? (double) ( nSrcDY - 1 ) / ( nDstDY - 1 ) : 0.0;
const double fFactorY = (double)nSrcDY / nDstDY;
for( i = 0L; i < nDstDY; i++ )
pMapY[ i ] = nSrcY + FRound( i * fFactorY );
pMapY[ i ] = nSrcY + static_cast<int>( i * fFactorY );
}
else
{
......
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