Huw Davies : gdi32: Add a function to retrieve the rop codes.

Alexandre Julliard julliard at winehq.org
Tue Aug 2 14:18:28 CDT 2011


Module: wine
Branch: master
Commit: 76b0626ff2d251122c01fb609c2ed9f9b6842e60
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=76b0626ff2d251122c01fb609c2ed9f9b6842e60

Author: Huw Davies <huw at codeweavers.com>
Date:   Tue Aug  2 14:11:07 2011 +0100

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 7889ebb..ee08bbd 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 70e2904..15ce72f 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)




More information about the wine-cvs mailing list