Huw Davies : gdi32: Explicitly write out the rops for copy_rect_32().
Alexandre Julliard
julliard at winehq.org
Thu Aug 25 10:39:36 CDT 2016
Module: wine
Branch: master
Commit: 4b39c7b944a66425022a00c482e2120870e39c3d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4b39c7b944a66425022a00c482e2120870e39c3d
Author: Huw Davies <huw at codeweavers.com>
Date: Thu Aug 25 09:43:08 2016 +0100
gdi32: Explicitly write out the rops for copy_rect_32().
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/gdi32/dibdrv/primitives.c | 47 ++++++++++++++++++++++++++++++++----------
1 file changed, 36 insertions(+), 11 deletions(-)
diff --git a/dlls/gdi32/dibdrv/primitives.c b/dlls/gdi32/dibdrv/primitives.c
index a1ec500..91cce3f 100644
--- a/dlls/gdi32/dibdrv/primitives.c
+++ b/dlls/gdi32/dibdrv/primitives.c
@@ -108,6 +108,23 @@ static const BYTE pixel_masks_4[2] = {0xf0, 0x0f};
static const BYTE pixel_masks_1[8] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};
static const BYTE edge_masks_1[8] = {0xff, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01};
+#define ROPS_WITHOUT_COPY( _d, _s ) \
+case R2_BLACK: LOOP( (_d) = 0 ) break; \
+case R2_NOTMERGEPEN: LOOP( (_d) = ~((_d) | (_s)) ) break; \
+case R2_MASKNOTPEN: LOOP( (_d) &= ~(_s) ) break; \
+case R2_NOTCOPYPEN: LOOP( (_d) = ~(_s) ) break; \
+case R2_MASKPENNOT: LOOP( (_d) = (~(_d) & (_s)) ) break; \
+case R2_NOT: LOOP( (_d) = ~(_d) ) break; \
+case R2_XORPEN: LOOP( (_d) ^= (_s) ) break; \
+case R2_NOTMASKPEN: LOOP( (_d) = ~((_d) & (_s)) ) break; \
+case R2_MASKPEN: LOOP( (_d) &= (_s) ) break; \
+case R2_NOTXORPEN: LOOP( (_d) = ~((_d) ^ (_s)) ) break; \
+case R2_NOP: break; \
+case R2_MERGENOTPEN: LOOP( (_d) = ((_d) | ~(_s)) ) break; \
+case R2_MERGEPENNOT: LOOP( (_d) = (~(_d) | (_s)) ) break; \
+case R2_MERGEPEN: LOOP( (_d) |= (_s) ) break; \
+case R2_WHITE: LOOP( (_d) = ~0 ) break;
+
static inline void do_rop_32(DWORD *ptr, DWORD and, DWORD xor)
{
*ptr = (*ptr & and) ^ xor;
@@ -1588,13 +1605,17 @@ static inline void copy_rect_bits_32( DWORD *dst_start, const DWORD *src_start,
const DWORD *src;
DWORD *dst;
int x, y;
- struct rop_codes codes;
- get_rop_codes( rop2, &codes );
+#define LOOP( op ) \
+ for (y = 0; y < size->cy; y++, dst_start += dst_stride, src_start += src_stride) \
+ for (x = 0, src = src_start, dst = dst_start; x < size->cx; x++, src++, dst++) \
+ op;
- for (y = 0; y < size->cy; y++, dst_start += dst_stride, src_start += src_stride)
- for (x = 0, src = src_start, dst = dst_start; x < size->cx; x++, src++, dst++)
- do_rop_codes_32( dst, *src, &codes );
+ switch (rop2)
+ {
+ ROPS_WITHOUT_COPY( dst[0], src[0] )
+ }
+#undef LOOP
}
static inline void copy_rect_bits_rev_32( DWORD *dst_start, const DWORD *src_start, const SIZE *size,
@@ -1603,16 +1624,20 @@ static inline void copy_rect_bits_rev_32( DWORD *dst_start, const DWORD *src_sta
const DWORD *src;
DWORD *dst;
int x, y;
- struct rop_codes codes;
-
- get_rop_codes( rop2, &codes );
src_start += size->cx - 1;
dst_start += size->cx - 1;
- for (y = 0; y < size->cy; y++, dst_start += dst_stride, src_start += src_stride)
- for (x = 0, src = src_start, dst = dst_start; x < size->cx; x++, src--, dst--)
- do_rop_codes_32( dst, *src, &codes );
+#define LOOP( op ) \
+ for (y = 0; y < size->cy; y++, dst_start += dst_stride, src_start += src_stride) \
+ for (x = 0, src = src_start, dst = dst_start; x < size->cx; x++, src--, dst--) \
+ op;
+
+ switch (rop2)
+ {
+ ROPS_WITHOUT_COPY( dst[0], src[0] )
+ }
+#undef LOOP
}
static void copy_rect_32(const dib_info *dst, const RECT *rc,
More information about the wine-cvs
mailing list