Commit d1d8b4de authored by Alexandre Julliard's avatar Alexandre Julliard

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

parent 8f4d50ea
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment