Alexandre Julliard : gdi32: Move some common code out of the individual copy_rect functions.
Alexandre Julliard
julliard at winehq.org
Wed Oct 12 14:31:18 CDT 2011
Module: wine
Branch: master
Commit: d1d8b4de0b23d681e599282add580ff09cb7e356
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d1d8b4de0b23d681e599282add580ff09cb7e356
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Oct 12 18:09:31 2011 +0200
gdi32: Move some common code out of the individual copy_rect functions.
---
dlls/gdi32/dibdrv/bitblt.c | 22 +++++++++++
dlls/gdi32/dibdrv/primitives.c | 78 ----------------------------------------
2 files changed, 22 insertions(+), 78 deletions(-)
diff --git a/dlls/gdi32/dibdrv/bitblt.c b/dlls/gdi32/dibdrv/bitblt.c
index 25554bb..beee303 100644
--- a/dlls/gdi32/dibdrv/bitblt.c
+++ b/dlls/gdi32/dibdrv/bitblt.c
@@ -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;
diff --git a/dlls/gdi32/dibdrv/primitives.c b/dlls/gdi32/dibdrv/primitives.c
index 4149878..81e502a 100644
--- a/dlls/gdi32/dibdrv/primitives.c
+++ b/dlls/gdi32/dibdrv/primitives.c
@@ -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);
More information about the wine-cvs
mailing list