diff --git a/ChangeLog.txt b/ChangeLog.txt index 5074376b2b..a9995c648e 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,15 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2016-01-07 12:16 UTC-0800 Pritpal Bedi (bedipritpal/at/hotmail.com) + * contrib/gtwvg/wvgcore.c + * contrib/gtwvg/wvgcuig.c + ! Fixed ( again ) 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. + 2016-01-05 10:04 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * include/hbapigt.h * src/rtl/gttrm/gttrm.c diff --git a/contrib/gtwvg/wvgcore.c b/contrib/gtwvg/wvgcore.c index 5caea413e0..98887a6ede 100644 --- a/contrib/gtwvg/wvgcore.c +++ b/contrib/gtwvg/wvgcore.c @@ -216,8 +216,16 @@ HB_BOOL hb_wvt_gtRenderPicture( int x, int y, int wd, int ht, IPicture * iPictur if( bDoNotScale ) { - iHt = ( int ) ( ( float ) wd * lHeight / lWidth ); - iWd = ( int ) ( ( float ) iHt * lWidth / lHeight ); + if( lHeight > lWidth ) + { + iWd = min( wd, ( int ) ( ( float ) ht * lWidth / lHeight ) ); + iHt = ( int ) ( ( float ) iWd * lHeight / lWidth ); + } + else + { + iHt = min( ht, ( int ) ( ( float ) wd * lHeight / lWidth ) ); + iWd = ( int ) ( ( float ) iHt * lWidth / lHeight ); + } x += abs( ( iWd - wd ) / 2 ); y += abs( ( iHt - ht ) / 2 ); wd = iWd; @@ -540,12 +548,12 @@ HB_BOOL hb_wvt_DrawImage( HDC hdc, int x, int y, int wd, int ht, LPCTSTR lpImage { if( lHeight > lWidth ) { - iWd = ( int ) ( ( float ) ht * lWidth / lHeight ); + iWd = min( wd, ( int ) ( ( float ) ht * lWidth / lHeight ) ); iHt = ( int ) ( ( float ) iWd * lHeight / lWidth ); } else { - iHt = ( int ) ( ( float ) wd * lHeight / lWidth ); + iHt = min( ht, ( int ) ( ( float ) wd * lHeight / lWidth ) ); iWd = ( int ) ( ( float ) iHt * lWidth / lHeight ); } x += abs( ( iWd - wd ) / 2 ); diff --git a/contrib/gtwvg/wvgcuig.c b/contrib/gtwvg/wvgcuig.c index 1cdb7bc963..abc4c06c40 100644 --- a/contrib/gtwvg/wvgcuig.c +++ b/contrib/gtwvg/wvgcuig.c @@ -1536,12 +1536,12 @@ static void hb_wvg_RenderPicture( PHB_GTWVT pWVT, PHB_GOBJS gObj, int iLeft, int { if( lHeight > lWidth ) { - iWd = ( int ) ( ( float ) ht * lWidth / lHeight ); + iWd = min( wd, ( int ) ( ( float ) ht * lWidth / lHeight ) ); iHt = ( int ) ( ( float ) iWd * lHeight / lWidth ); } else { - iHt = ( int ) ( ( float ) wd * lHeight / lWidth ); + iHt = min( ht, ( int ) ( ( float ) wd * lHeight / lWidth ) ); iWd = ( int ) ( ( float ) iHt * lWidth / lHeight ); } x += abs( ( iWd - wd ) / 2 );