Commit 4e032474 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Define a structure to make the brush state independent from the physdev.

parent cc9836bd
......@@ -761,11 +761,11 @@ static DWORD execute_rop( dibdrv_physdev *pdev, const RECT *dst_rect, dib_info *
OP_DST(*opcode) == DST ? clipped_rects : NULL, OP_ROP(*opcode) );
break;
case OP_ARGS(PAT,DST):
pdev->brush_rects( pdev, dibs[DST], clipped_rects->count, clipped_rects->rects,
pdev->brush.rects( pdev, &pdev->brush, dibs[DST], clipped_rects->count, clipped_rects->rects,
OP_ROP(*opcode) );
break;
case OP_ARGS(PAT,SRC):
pdev->brush_rects( pdev, dibs[SRC], 1, &rects[SRC], OP_ROP(*opcode) );
pdev->brush.rects( pdev, &pdev->brush, dibs[SRC], 1, &rects[SRC], OP_ROP(*opcode) );
break;
}
}
......
......@@ -308,7 +308,7 @@ static BOOL dibdrv_CreateDC( PHYSDEV *dev, LPCWSTR driver, LPCWSTR device,
if (!pdev) return FALSE;
clear_dib_info(&pdev->dib);
clear_dib_info(&pdev->brush_dib);
clear_dib_info(&pdev->brush.dib);
push_dc_driver( dev, &pdev->dev, &dib_driver );
return TRUE;
}
......@@ -320,7 +320,7 @@ static BOOL dibdrv_DeleteDC( PHYSDEV dev )
{
dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
TRACE("(%p)\n", dev);
free_pattern_brush(pdev);
free_pattern_brush( &pdev->brush );
HeapFree( GetProcessHeap(), 0, pdev );
return TRUE;
}
......@@ -389,7 +389,7 @@ static UINT dibdrv_SetDIBColorTable( PHYSDEV dev, UINT pos, UINT count, const RG
dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
TRACE("(%p, %d, %d, %p)\n", dev, pos, count, colors);
if (pdev->dib.color_table) pdev->brush_rop = -1; /* force re-creating the brush bits */
if (pdev->dib.color_table) pdev->brush.rop = -1; /* force re-creating the brush bits */
return next->funcs->pSetDIBColorTable( next, pos, count, colors );
}
......
......@@ -66,6 +66,22 @@ typedef struct
void *xor;
} rop_mask_bits;
struct dibdrv_physdev;
typedef struct dib_brush
{
UINT style;
UINT hatch;
INT rop; /* rop2 last used to create the brush bits */
COLORREF colorref;
dib_info dib;
void *and_bits;
void *xor_bits;
struct brush_pattern pattern;
BOOL (*rects)(struct dibdrv_physdev *pdev, struct dib_brush *brush, dib_info *dib,
int num, const RECT *rects, INT rop);
} dib_brush;
struct intensity_range
{
BYTE r_min, r_max;
......@@ -77,6 +93,7 @@ typedef struct dibdrv_physdev
{
struct gdi_physdev dev;
dib_info dib;
dib_brush brush;
HRGN clip;
DWORD defer;
......@@ -90,16 +107,6 @@ typedef struct dibdrv_physdev
dash_pos dash_pos;
rop_mask dash_masks[2];
BOOL (* pen_lines)(struct dibdrv_physdev *pdev, int num, POINT *pts, BOOL close, HRGN region);
/* brush */
UINT brush_style;
UINT brush_hatch;
INT brush_rop; /* rop2 last used to create the brush bits */
COLORREF brush_colorref;
dib_info brush_dib;
void *brush_and_bits, *brush_xor_bits;
struct brush_pattern brush_pattern;
BOOL (* brush_rects)(struct dibdrv_physdev *pdev, dib_info *dib, int num, const RECT *rects, INT rop);
} dibdrv_physdev;
#define DEFER_PEN 2
......@@ -223,12 +230,12 @@ extern void reset_dash_origin(dibdrv_physdev *pdev) DECLSPEC_HIDDEN;
extern void init_dib_info_from_bitmapinfo(dib_info *dib, const BITMAPINFO *info, void *bits, enum dib_info_flags flags) DECLSPEC_HIDDEN;
extern BOOL init_dib_info_from_bitmapobj(dib_info *dib, BITMAPOBJ *bmp, enum dib_info_flags flags) DECLSPEC_HIDDEN;
extern void free_dib_info(dib_info *dib) DECLSPEC_HIDDEN;
extern void free_pattern_brush(dibdrv_physdev *pdev) DECLSPEC_HIDDEN;
extern void free_pattern_brush(dib_brush *brush) DECLSPEC_HIDDEN;
extern void copy_dib_color_info(dib_info *dst, const dib_info *src) DECLSPEC_HIDDEN;
extern BOOL convert_dib(dib_info *dst, const dib_info *src) DECLSPEC_HIDDEN;
extern COLORREF make_rgb_colorref( HDC hdc, dib_info *dib, COLORREF color, BOOL *got_pixel, DWORD *pixel ) DECLSPEC_HIDDEN;
extern DWORD get_pixel_color(dibdrv_physdev *pdev, COLORREF color, BOOL mono_fixup) DECLSPEC_HIDDEN;
extern BOOL brush_rect( dibdrv_physdev *pdev, const RECT *rect, HRGN clip, INT rop ) DECLSPEC_HIDDEN;
extern BOOL brush_rect( dibdrv_physdev *pdev, dib_brush *brush, const RECT *rect, HRGN clip, INT rop ) DECLSPEC_HIDDEN;
extern BOOL brush_region( dibdrv_physdev *pdev, HRGN region ) DECLSPEC_HIDDEN;
extern BOOL pen_region( dibdrv_physdev *pdev, HRGN region ) DECLSPEC_HIDDEN;
extern int get_clipped_rects( const dib_info *dib, const RECT *rc, HRGN clip, struct clipped_rects *clip_rects ) DECLSPEC_HIDDEN;
......
......@@ -490,7 +490,7 @@ BOOL dibdrv_PatBlt( PHYSDEV dev, struct bitblt_coords *dst, DWORD rop )
TRACE("(%p, %d, %d, %d, %d, %06x)\n", dev, dst->x, dst->y, dst->width, dst->height, rop);
return brush_rect( pdev, &dst->visrect, pdev->clip, get_rop2_from_rop(rop) );
return brush_rect( pdev, &pdev->brush, &dst->visrect, pdev->clip, get_rop2_from_rop(rop) );
}
/***********************************************************************
......@@ -512,7 +512,7 @@ BOOL dibdrv_PaintRgn( PHYSDEV dev, HRGN rgn )
{
rect = get_device_rect( dev->hdc, region->rects[i].left, region->rects[i].top,
region->rects[i].right, region->rects[i].bottom, FALSE );
brush_rect( pdev, &rect, pdev->clip, GetROP2( dev->hdc ) );
brush_rect( pdev, &pdev->brush, &rect, pdev->clip, GetROP2( dev->hdc ) );
}
release_wine_region( rgn );
......@@ -700,7 +700,7 @@ BOOL dibdrv_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
rect.top += (pdev->pen_width + 1) / 2;
rect.right -= pdev->pen_width / 2;
rect.bottom -= pdev->pen_width / 2;
ret = brush_rect( pdev, &rect, pdev->clip, GetROP2(dev->hdc) );
ret = brush_rect( pdev, &pdev->brush, &rect, pdev->clip, GetROP2(dev->hdc) );
}
return ret;
}
......
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