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 <bDoNotScale>
	   is set to be TRUE. Thanks Sergy for reporting and providing
	   code to debug.
This commit is contained in:
Pritpal Bedi
2016-01-07 12:23:52 -08:00
parent c5758d9b83
commit aeb2a15261
3 changed files with 23 additions and 6 deletions

View File

@@ -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 <bDoNotScale>
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

View File

@@ -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 );

View File

@@ -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 );