Akihiro Sagawa : gdi32: Use the helper function to order the points of a rectangle.

Alexandre Julliard julliard at winehq.org
Fri Oct 12 18:00:41 CDT 2018


Module: wine
Branch: master
Commit: bdfbd32e8581465fac823d30a0ee5ea412f06a73
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=bdfbd32e8581465fac823d30a0ee5ea412f06a73

Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date:   Fri Oct 12 00:35:34 2018 +0900

gdi32: Use the helper function to order the points of a rectangle.

Signed-off-by: Akihiro Sagawa <sagawa.aki at gmail.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdi32/bitblt.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/dlls/gdi32/bitblt.c b/dlls/gdi32/bitblt.c
index 0f21283..c8d67cb 100644
--- a/dlls/gdi32/bitblt.c
+++ b/dlls/gdi32/bitblt.c
@@ -40,13 +40,6 @@ static inline BOOL rop_uses_src( DWORD rop )
     return ((rop >> 2) & 0x330000) != (rop & 0x330000);
 }
 
-static inline void swap_ints( int *i, int *j )
-{
-    int tmp = *i;
-    *i = *j;
-    *j = tmp;
-}
-
 BOOL intersect_vis_rectangles( struct bitblt_coords *dst, struct bitblt_coords *src )
 {
     RECT rect;
@@ -70,8 +63,7 @@ BOOL intersect_vis_rectangles( struct bitblt_coords *dst, struct bitblt_coords *
         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 );
+        order_rect( &rect );
 
         /* avoid rounding errors */
         rect.left--;
@@ -88,8 +80,7 @@ BOOL intersect_vis_rectangles( struct bitblt_coords *dst, struct bitblt_coords *
         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 );
+        order_rect( &rect );
 
         /* avoid rounding errors */
         rect.left--;




More information about the wine-cvs mailing list