Huw Davies : gdi32: Implement the conversion between two identical bitfield dibs.
Alexandre Julliard
julliard at winehq.org
Wed Jul 13 12:16:33 CDT 2011
Module: wine
Branch: master
Commit: dddc079d4f276303b40afd4a35ad43e17684ece5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=dddc079d4f276303b40afd4a35ad43e17684ece5
Author: Huw Davies <huw at codeweavers.com>
Date: Wed Jul 13 13:04:58 2011 +0100
gdi32: Implement the conversion between two identical bitfield dibs.
---
dlls/gdi32/dibdrv/primitives.c | 37 +++++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/dlls/gdi32/dibdrv/primitives.c b/dlls/gdi32/dibdrv/primitives.c
index 68eb4ae..ebcf830 100644
--- a/dlls/gdi32/dibdrv/primitives.c
+++ b/dlls/gdi32/dibdrv/primitives.c
@@ -719,6 +719,15 @@ static DWORD colorref_to_pixel_null(const dib_info *dib, COLORREF color)
return 0;
}
+static inline BOOL bit_fields_match(const dib_info *d1, const dib_info *d2)
+{
+ assert( d1->bit_count > 8 && d1->bit_count == d2->bit_count );
+
+ return d1->red_mask == d2->red_mask &&
+ d1->green_mask == d2->green_mask &&
+ d1->blue_mask == d2->blue_mask;
+}
+
static BOOL convert_to_8888(dib_info *dst, const dib_info *src, const RECT *src_rect)
{
DWORD *dst_start = dst->bits, *dst_pixel, src_val;
@@ -904,6 +913,20 @@ static BOOL convert_to_32(dib_info *dst, const dib_info *src, const RECT *src_re
src_start += src->stride / 4;
}
}
+ else if(bit_fields_match(src, dst))
+ {
+ if(src->stride > 0 && dst->stride > 0 && src_rect->left == 0 && src_rect->right == src->width)
+ memcpy(dst->bits, src_start, (src_rect->bottom - src_rect->top) * src->stride);
+ else
+ {
+ for(y = src_rect->top; y < src_rect->bottom; y++)
+ {
+ memcpy(dst_start, src_start, (src_rect->right - src_rect->left) * 4);
+ dst_start += dst->stride / 4;
+ src_start += src->stride / 4;
+ }
+ }
+ }
else
{
FIXME("Unsupported conversion: 32 -> 32\n");
@@ -1456,6 +1479,20 @@ static BOOL convert_to_16(dib_info *dst, const dib_info *src, const RECT *src_re
src_start += src->stride / 2;
}
}
+ else if(bit_fields_match(src, dst))
+ {
+ if(src->stride > 0 && dst->stride > 0 && src_rect->left == 0 && src_rect->right == src->width)
+ memcpy(dst->bits, src_start, (src_rect->bottom - src_rect->top) * src->stride);
+ else
+ {
+ for(y = src_rect->top; y < src_rect->bottom; y++)
+ {
+ memcpy(dst_start, src_start, (src_rect->right - src_rect->left) * 2);
+ dst_start += dst->stride / 2;
+ src_start += src->stride / 2;
+ }
+ }
+ }
else
{
FIXME("Unsupported conversion: 16 -> 16\n");
More information about the wine-cvs
mailing list