Huw Davies : gdi32: Add a helper to retrieve the bounding rectangle.
Alexandre Julliard
julliard at winehq.org
Tue Oct 11 14:03:39 CDT 2011
Module: wine
Branch: master
Commit: a7b5d8665589059a151da7505bde733a00b3c73f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a7b5d8665589059a151da7505bde733a00b3c73f
Author: Huw Davies <huw at codeweavers.com>
Date: Tue Oct 11 12:49:53 2011 +0100
gdi32: Add a helper to retrieve the bounding rectangle.
---
dlls/gdi32/bitblt.c | 16 ++++++----------
dlls/gdi32/gdi_private.h | 20 ++++++++++++++++++++
2 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/dlls/gdi32/bitblt.c b/dlls/gdi32/bitblt.c
index c595a60..a2a7698 100644
--- a/dlls/gdi32/bitblt.c
+++ b/dlls/gdi32/bitblt.c
@@ -65,12 +65,10 @@ static BOOL get_vis_rectangles( DC *dc_dst, struct bitblt_coords *dst,
dst->height = rect.bottom - rect.top;
if (dst->layout & LAYOUT_RTL && dst->layout & LAYOUT_BITMAPORIENTATIONPRESERVED)
{
- swap_ints( &rect.left, &rect.right );
- dst->x = rect.left;
- dst->width = rect.right - rect.left;
+ dst->x += dst->width;
+ dst->width = -dst->width;
}
- if (rect.left > rect.right) { swap_ints( &rect.left, &rect.right ); rect.left++; rect.right++; }
- if (rect.top > rect.bottom) { swap_ints( &rect.top, &rect.bottom ); rect.top++; rect.bottom++; }
+ get_bounding_rect( &rect, dst->x, dst->y, dst->width, dst->height );
if (get_clip_box( dc_dst, &clip ))
intersect_rect( &dst->visrect, &rect, &clip );
@@ -92,12 +90,10 @@ static BOOL get_vis_rectangles( DC *dc_dst, struct bitblt_coords *dst,
src->height = rect.bottom - rect.top;
if (src->layout & LAYOUT_RTL && src->layout & LAYOUT_BITMAPORIENTATIONPRESERVED)
{
- swap_ints( &rect.left, &rect.right );
- src->x = rect.left;
- src->width = rect.right - rect.left;
+ src->x += src->width;
+ src->width = -src->width;
}
- if (rect.left > rect.right) { swap_ints( &rect.left, &rect.right ); rect.left++; rect.right++; }
- if (rect.top > rect.bottom) { swap_ints( &rect.top, &rect.bottom ); rect.top++; rect.bottom++; }
+ get_bounding_rect( &rect, src->x, src->y, src->width, src->height );
/* source is not clipped */
if (dc_src->header.type == OBJ_MEMDC)
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index b3d027a..6a600a4 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -469,6 +469,26 @@ static inline void offset_rect( RECT *rect, int offset_x, int offset_y )
rect->bottom += offset_y;
}
+static inline void get_bounding_rect( RECT *rect, int x, int y, int width, int height )
+{
+ rect->left = x;
+ rect->right = x + width;
+ rect->top = y;
+ rect->bottom = y + height;
+ if (rect->left > rect->right)
+ {
+ int tmp = rect->left;
+ rect->left = rect->right + 1;
+ rect->right = tmp + 1;
+ }
+ if (rect->top > rect->bottom)
+ {
+ int tmp = rect->top;
+ rect->top = rect->bottom + 1;
+ rect->bottom = tmp + 1;
+ }
+}
+
static inline int get_bitmap_stride( int width, int bpp )
{
return ((width * bpp + 15) >> 3) & ~1;
More information about the wine-cvs
mailing list