From 76b0626ff2d251122c01fb609c2ed9f9b6842e60 Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Tue, 2 Aug 2011 14:11:07 +0100 Subject: [PATCH] gdi32: Add a function to retrieve the rop codes. --- dlls/gdi32/dibdrv/dibdrv.h | 6 ++++++ dlls/gdi32/dibdrv/objects.c | 17 ++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/dlls/gdi32/dibdrv/dibdrv.h b/dlls/gdi32/dibdrv/dibdrv.h index 7889ebb5acb..ee08bbd8fed 100644 --- a/dlls/gdi32/dibdrv/dibdrv.h +++ b/dlls/gdi32/dibdrv/dibdrv.h @@ -56,6 +56,12 @@ extern const primitive_funcs funcs_4 DECLSPEC_HIDDEN; extern const primitive_funcs funcs_1 DECLSPEC_HIDDEN; extern const primitive_funcs funcs_null DECLSPEC_HIDDEN; +struct rop_codes +{ + DWORD a1, a2, x1, x2; +}; + +extern void get_rop_codes(INT rop, struct rop_codes *codes); extern void calc_and_xor_masks(INT rop, DWORD color, DWORD *and, DWORD *xor) DECLSPEC_HIDDEN; extern void update_brush_rop( dibdrv_physdev *pdev, INT rop ) DECLSPEC_HIDDEN; extern void reset_dash_origin(dibdrv_physdev *pdev) DECLSPEC_HIDDEN; diff --git a/dlls/gdi32/dibdrv/objects.c b/dlls/gdi32/dibdrv/objects.c index 70e2904985d..15ce72f6e13 100644 --- a/dlls/gdi32/dibdrv/objects.c +++ b/dlls/gdi32/dibdrv/objects.c @@ -85,11 +85,22 @@ static const DWORD rop2_xor_array[16][2] = #undef ONE #undef ZERO -void calc_and_xor_masks(INT rop, DWORD color, DWORD *and, DWORD *xor) +void get_rop_codes(INT rop, struct rop_codes *codes) { /* NB The ROP2 codes start at one and the arrays are zero-based */ - *and = (color & rop2_and_array[rop-1][0]) ^ rop2_and_array[rop-1][1]; - *xor = (color & rop2_xor_array[rop-1][0]) ^ rop2_xor_array[rop-1][1]; + codes->a1 = rop2_and_array[rop-1][0]; + codes->a2 = rop2_and_array[rop-1][1]; + codes->x1 = rop2_xor_array[rop-1][0]; + codes->x2 = rop2_xor_array[rop-1][1]; +} + +void calc_and_xor_masks(INT rop, DWORD color, DWORD *and, DWORD *xor) +{ + struct rop_codes codes; + get_rop_codes( rop, &codes ); + + *and = (color & codes.a1) ^ codes.a2; + *xor = (color & codes.x1) ^ codes.x2; } static inline RGBQUAD rgbquad_from_colorref(COLORREF c) -- 2.11.4.GIT