diff --git a/ChangeLog.txt b/ChangeLog.txt index f645d7a761..c57f7593f1 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,15 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2016-01-03 09:24 UTC-0800 Pritpal Bedi (bedipritpal/at/hotmail.com) + * contrib/gtwvg/wvgcore.c + * contrib/gtwvg/wvgcuig.c + ! Fixed Wvt_DrawImage() and Wvg_Image() where images were not + being rendered correctly if the height of image is greater than + width of the image. The behavior is only affected when + is set to be TRUE. Thanks Sergy for reporting and providing + code to debug. + 2015-12-29 20:16 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * include/hbcomp.h * include/hbcompdf.h diff --git a/contrib/gtwvg/wvgcore.c b/contrib/gtwvg/wvgcore.c index ecf4d43d2c..5caea413e0 100644 --- a/contrib/gtwvg/wvgcore.c +++ b/contrib/gtwvg/wvgcore.c @@ -538,8 +538,16 @@ HB_BOOL hb_wvt_DrawImage( HDC hdc, int x, int y, int wd, int ht, LPCTSTR lpImage if( bDoNotScale ) { - iHt = ( int ) ( ( float ) wd * lHeight / lWidth ); - iWd = ( int ) ( ( float ) iHt * lWidth / lHeight ); + if( lHeight > lWidth ) + { + iWd = ( int ) ( ( float ) ht * lWidth / lHeight ); + iHt = ( int ) ( ( float ) iWd * lHeight / lWidth ); + } + else + { + iHt = ( int ) ( ( float ) wd * lHeight / lWidth ); + iWd = ( int ) ( ( float ) iHt * lWidth / lHeight ); + } x += abs( ( iWd - wd ) / 2 ); y += abs( ( iHt - ht ) / 2 ); wd = iWd; diff --git a/contrib/gtwvg/wvgcuig.c b/contrib/gtwvg/wvgcuig.c index 897865294f..1cdb7bc963 100644 --- a/contrib/gtwvg/wvgcuig.c +++ b/contrib/gtwvg/wvgcuig.c @@ -1534,8 +1534,16 @@ static void hb_wvg_RenderPicture( PHB_GTWVT pWVT, PHB_GOBJS gObj, int iLeft, int if( gObj->iData == 1 ) { - iHt = ( int ) ( ( float ) wd * lHeight / lWidth ); - iWd = ( int ) ( ( float ) iHt * lWidth / lHeight ); + if( lHeight > lWidth ) + { + iWd = ( int ) ( ( float ) ht * lWidth / lHeight ); + iHt = ( int ) ( ( float ) iWd * lHeight / lWidth ); + } + else + { + iHt = ( int ) ( ( float ) wd * lHeight / lWidth ); + iWd = ( int ) ( ( float ) iHt * lWidth / lHeight ); + } x += abs( ( iWd - wd ) / 2 ); y += abs( ( iHt - ht ) / 2 ); wd = iWd;