gdi32: Add a function to retrieve the rop codes.

This commit is contained in:
Huw Davies 2011-08-02 14:11:07 +01:00 committed by Alexandre Julliard
parent 4b50743f87
commit 76b0626ff2
2 changed files with 20 additions and 3 deletions

View file

@ -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;

View file

@ -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)