Alexandre Julliard : gdi32: Avoid rounding errors with visible rectangles in mirroring blits.
Alexandre Julliard
julliard at winehq.org
Fri Sep 23 10:56:52 CDT 2011
Module: wine
Branch: master
Commit: 7029559ed6f4f4282a5204082120df482cea3fcc
URL: http://source.winehq.org/git/wine.git/?a=commit;h=7029559ed6f4f4282a5204082120df482cea3fcc
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri Sep 23 14:17:05 2011 +0200
gdi32: Avoid rounding errors with visible rectangles in mirroring blits.
---
dlls/gdi32/bitblt.c | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/dlls/gdi32/bitblt.c b/dlls/gdi32/bitblt.c
index 294901d..d58cd64 100644
--- a/dlls/gdi32/bitblt.c
+++ b/dlls/gdi32/bitblt.c
@@ -120,10 +120,13 @@ static BOOL get_vis_rectangles( DC *dc_dst, struct bitblt_coords *dst,
else /* stretching */
{
/* map source rectangle into destination coordinates */
- rect.left = dst->x + (src->visrect.left - src->x)*dst->width/src->width;
- rect.top = dst->y + (src->visrect.top - src->y)*dst->height/src->height;
- rect.right = dst->x + (src->visrect.right - src->x)*dst->width/src->width;
- rect.bottom = dst->y + (src->visrect.bottom - src->y)*dst->height/src->height;
+ rect = src->visrect;
+ offset_rect( &rect, -min( src->x, src->x + src->width + 1),
+ -min( src->y, src->y + src->height + 1) );
+ rect.left = dst->x + rect.left * dst->width / abs(src->width);
+ rect.top = dst->y + rect.top * dst->height / abs(src->height);
+ rect.right = dst->x + rect.right * dst->width / abs(src->width);
+ rect.bottom = dst->y + rect.bottom * dst->height / abs(src->height);
if (rect.left > rect.right) swap_ints( &rect.left, &rect.right );
if (rect.top > rect.bottom) swap_ints( &rect.top, &rect.bottom );
@@ -135,10 +138,13 @@ static BOOL get_vis_rectangles( DC *dc_dst, struct bitblt_coords *dst,
if (!intersect_rect( &dst->visrect, &rect, &dst->visrect )) return FALSE;
/* map destination rectangle back to source coordinates */
- rect.left = src->x + (dst->visrect.left - dst->x)*src->width/dst->width;
- rect.top = src->y + (dst->visrect.top - dst->y)*src->height/dst->height;
- rect.right = src->x + (dst->visrect.right - dst->x)*src->width/dst->width;
- rect.bottom = src->y + (dst->visrect.bottom - dst->y)*src->height/dst->height;
+ rect = dst->visrect;
+ offset_rect( &rect, -min( dst->x, dst->x + dst->width + 1),
+ -min( dst->y, dst->y + dst->height + 1) );
+ rect.left = src->x + rect.left * src->width / abs(dst->width);
+ rect.top = src->y + rect.top * src->height / abs(dst->height);
+ rect.right = src->x + rect.right * src->width / abs(dst->width);
+ rect.bottom = src->y + rect.bottom * src->height / abs(dst->height);
if (rect.left > rect.right) swap_ints( &rect.left, &rect.right );
if (rect.top > rect.bottom) swap_ints( &rect.top, &rect.bottom );
More information about the wine-cvs
mailing list