gdi32: Move some common code out of the individual copy_rect functions.

This commit is contained in:
Alexandre Julliard 2011-10-12 18:09:31 +02:00
parent 8f4d50ea4b
commit d1d8b4de0b
2 changed files with 22 additions and 78 deletions

View File

@ -473,6 +473,28 @@ static DWORD copy_rect( dib_info *dst, const RECT *dst_rect, const dib_info *src
RECT clipped_rect;
const WINEREGION *clip_data;
int i, start, end, overlap;
DWORD and = 0, xor = 0;
switch (rop2)
{
case R2_NOT: and = ~0u;
/* fall through */
case R2_WHITE: xor = ~0u;
/* fall through */
case R2_BLACK:
if (clip)
{
clip_data = get_wine_region( clip );
for (i = 0; i < clip_data->numRects; i++)
if (intersect_rect( &clipped_rect, dst_rect, clip_data->rects + i ))
dst->funcs->solid_rects( dst, 1, &clipped_rect, and, xor );
release_wine_region( clip );
}
else dst->funcs->solid_rects( dst, 1, dst_rect, and, xor );
/* fall through */
case R2_NOP:
return ERROR_SUCCESS;
}
origin.x = src_rect->left;
origin.y = src_rect->top;

View File

@ -785,22 +785,9 @@ static void copy_rect_32(const dib_info *dst, const RECT *rc,
const dib_info *src, const POINT *origin, int rop2, int overlap)
{
DWORD *dst_start, *src_start;
DWORD and = 0, xor = 0;
struct rop_codes codes;
int y, dst_stride, src_stride;
switch (rop2)
{
case R2_NOP: return;
case R2_NOT: and = ~0u;
/* fall through */
case R2_WHITE: xor = ~0u;
/* fall through */
case R2_BLACK:
dst->funcs->solid_rects( dst, 1, rc, and, xor );
return;
}
if (overlap & OVERLAP_BELOW)
{
dst_start = get_pixel_ptr_32(dst, rc->left, rc->bottom - 1);
@ -837,22 +824,9 @@ static void copy_rect_24(const dib_info *dst, const RECT *rc,
const dib_info *src, const POINT *origin, int rop2, int overlap)
{
BYTE *dst_start, *src_start;
DWORD and = 0, xor = 0;
int y, dst_stride, src_stride;
struct rop_codes codes;
switch (rop2)
{
case R2_NOP: return;
case R2_NOT: and = ~0u;
/* fall through */
case R2_WHITE: xor = ~0u;
/* fall through */
case R2_BLACK:
dst->funcs->solid_rects( dst, 1, rc, and, xor );
return;
}
if (overlap & OVERLAP_BELOW)
{
dst_start = get_pixel_ptr_24(dst, rc->left, rc->bottom - 1);
@ -889,22 +863,9 @@ static void copy_rect_16(const dib_info *dst, const RECT *rc,
const dib_info *src, const POINT *origin, int rop2, int overlap)
{
WORD *dst_start, *src_start;
DWORD and = 0, xor = 0;
int y, dst_stride, src_stride;
struct rop_codes codes;
switch (rop2)
{
case R2_NOP: return;
case R2_NOT: and = ~0u;
/* fall through */
case R2_WHITE: xor = ~0u;
/* fall through */
case R2_BLACK:
dst->funcs->solid_rects( dst, 1, rc, and, xor );
return;
}
if (overlap & OVERLAP_BELOW)
{
dst_start = get_pixel_ptr_16(dst, rc->left, rc->bottom - 1);
@ -941,22 +902,9 @@ static void copy_rect_8(const dib_info *dst, const RECT *rc,
const dib_info *src, const POINT *origin, int rop2, int overlap)
{
BYTE *dst_start, *src_start;
DWORD and = 0, xor = 0;
int y, dst_stride, src_stride;
struct rop_codes codes;
switch (rop2)
{
case R2_NOP: return;
case R2_NOT: and = ~0u;
/* fall through */
case R2_WHITE: xor = ~0u;
/* fall through */
case R2_BLACK:
dst->funcs->solid_rects( dst, 1, rc, and, xor );
return;
}
if (overlap & OVERLAP_BELOW)
{
dst_start = get_pixel_ptr_8(dst, rc->left, rc->bottom - 1);
@ -993,22 +941,9 @@ static void copy_rect_4(const dib_info *dst, const RECT *rc,
const dib_info *src, const POINT *origin, int rop2, int overlap)
{
BYTE *dst_start, *src_start;
DWORD and = 0, xor = 0;
int y, dst_stride, src_stride;
struct rop_codes codes;
switch (rop2)
{
case R2_NOP: return;
case R2_NOT: and = ~0u;
/* fall through */
case R2_WHITE: xor = ~0u;
/* fall through */
case R2_BLACK:
dst->funcs->solid_rects( dst, 1, rc, and, xor );
return;
}
if (overlap & OVERLAP_BELOW)
{
dst_start = get_pixel_ptr_4(dst, 0, rc->bottom - 1);
@ -1047,22 +982,9 @@ static void copy_rect_1(const dib_info *dst, const RECT *rc,
const dib_info *src, const POINT *origin, int rop2, int overlap)
{
BYTE *dst_start, *src_start;
DWORD and = 0, xor = 0;
int y, dst_stride, src_stride;
struct rop_codes codes;
switch (rop2)
{
case R2_NOP: return;
case R2_NOT: and = ~0u;
/* fall through */
case R2_WHITE: xor = ~0u;
/* fall through */
case R2_BLACK:
dst->funcs->solid_rects( dst, 1, rc, and, xor );
return;
}
if (overlap & OVERLAP_BELOW)
{
dst_start = get_pixel_ptr_1(dst, 0, rc->bottom - 1);