Commit f85bb352 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Pass a brush_pattern structure to the SelectBrush entry point.

parent a1fdd585
...@@ -494,26 +494,21 @@ static HGDIOBJ BRUSH_SelectObject( HGDIOBJ handle, HDC hdc ) ...@@ -494,26 +494,21 @@ static HGDIOBJ BRUSH_SelectObject( HGDIOBJ handle, HDC hdc )
if ((brush = GDI_GetObjPtr( handle, OBJ_BRUSH ))) if ((brush = GDI_GetObjPtr( handle, OBJ_BRUSH )))
{ {
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSelectBrush ); PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSelectBrush );
HBITMAP bitmap = brush->pattern.bitmap; struct brush_pattern *pattern = &brush->pattern;
BITMAPINFO *info;
void *bits;
UINT usage;
if (bitmap && !brush->pattern.info) if (pattern->bitmap && !pattern->info)
{ {
BITMAPOBJ *bmp = GDI_GetObjPtr( bitmap, OBJ_BITMAP ); BITMAPOBJ *bmp = GDI_GetObjPtr( pattern->bitmap, OBJ_BITMAP );
/* fetch the bitmap bits if we are selecting into a different type of DC */ /* fetch the bitmap bits if we are selecting into a different type of DC */
if (bmp && bmp->funcs != physdev->funcs) store_bitmap_bits( &brush->pattern, bmp ); if (bmp && bmp->funcs != physdev->funcs) store_bitmap_bits( pattern, bmp );
GDI_ReleaseObj( bitmap ); GDI_ReleaseObj( pattern->bitmap );
} }
else if (!pattern->info) pattern = NULL;
info = brush->pattern.info;
bits = brush->pattern.bits.ptr;
usage = brush->pattern.usage;
GDI_inc_ref_count( handle ); GDI_inc_ref_count( handle );
GDI_ReleaseObj( handle ); GDI_ReleaseObj( handle );
if (!physdev->funcs->pSelectBrush( physdev, handle, bitmap, info, bits, usage )) if (!physdev->funcs->pSelectBrush( physdev, handle, pattern ))
{ {
GDI_dec_ref_count( handle ); GDI_dec_ref_count( handle );
} }
......
...@@ -98,10 +98,7 @@ typedef struct dibdrv_physdev ...@@ -98,10 +98,7 @@ typedef struct dibdrv_physdev
COLORREF brush_colorref; COLORREF brush_colorref;
dib_info brush_dib; dib_info brush_dib;
void *brush_and_bits, *brush_xor_bits; void *brush_and_bits, *brush_xor_bits;
const BITMAPINFO *brush_pattern_info; struct brush_pattern brush_pattern;
void *brush_pattern_bits;
UINT brush_pattern_usage;
HBITMAP brush_pattern_bitmap;
BOOL (* brush_rects)(struct dibdrv_physdev *pdev, dib_info *dib, int num, const RECT *rects, INT rop); BOOL (* brush_rects)(struct dibdrv_physdev *pdev, dib_info *dib, int num, const RECT *rects, INT rop);
} dibdrv_physdev; } dibdrv_physdev;
...@@ -131,8 +128,7 @@ extern DWORD dibdrv_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAP ...@@ -131,8 +128,7 @@ extern DWORD dibdrv_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAP
const struct gdi_image_bits *bits, struct bitblt_coords *src, const struct gdi_image_bits *bits, struct bitblt_coords *src,
struct bitblt_coords *dst, DWORD rop ) DECLSPEC_HIDDEN; struct bitblt_coords *dst, DWORD rop ) DECLSPEC_HIDDEN;
extern BOOL dibdrv_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN; extern BOOL dibdrv_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN;
extern HBRUSH dibdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush, HBITMAP bitmap, extern HBRUSH dibdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush, const struct brush_pattern *pattern ) DECLSPEC_HIDDEN;
const BITMAPINFO *info, void *bits, UINT usage ) DECLSPEC_HIDDEN;
extern HPEN dibdrv_SelectPen( PHYSDEV dev, HPEN hpen ) DECLSPEC_HIDDEN; extern HPEN dibdrv_SelectPen( PHYSDEV dev, HPEN hpen ) DECLSPEC_HIDDEN;
extern COLORREF dibdrv_SetDCBrushColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN; extern COLORREF dibdrv_SetDCBrushColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern COLORREF dibdrv_SetDCPenColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN; extern COLORREF dibdrv_SetDCPenColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
......
...@@ -1799,26 +1799,26 @@ static BOOL select_pattern_brush( dibdrv_physdev *pdev, BOOL *needs_reselect ) ...@@ -1799,26 +1799,26 @@ static BOOL select_pattern_brush( dibdrv_physdev *pdev, BOOL *needs_reselect )
RECT rect; RECT rect;
dib_info pattern; dib_info pattern;
if (!pdev->brush_pattern_info) if (!pdev->brush_pattern.info)
{ {
BITMAPOBJ *bmp = GDI_GetObjPtr( pdev->brush_pattern_bitmap, OBJ_BITMAP ); BITMAPOBJ *bmp = GDI_GetObjPtr( pdev->brush_pattern.bitmap, OBJ_BITMAP );
BOOL ret; BOOL ret;
if (!bmp) return FALSE; if (!bmp) return FALSE;
ret = init_dib_info_from_bitmapobj( &pattern, bmp, 0 ); ret = init_dib_info_from_bitmapobj( &pattern, bmp, 0 );
GDI_ReleaseObj( pdev->brush_pattern_bitmap ); GDI_ReleaseObj( pdev->brush_pattern.bitmap );
if (!ret) return FALSE; if (!ret) return FALSE;
} }
else if (pdev->brush_pattern_info->bmiHeader.biClrUsed && pdev->brush_pattern_usage == DIB_PAL_COLORS) else if (pdev->brush_pattern.info->bmiHeader.biClrUsed && pdev->brush_pattern.usage == DIB_PAL_COLORS)
{ {
copy_bitmapinfo( info, pdev->brush_pattern_info ); copy_bitmapinfo( info, pdev->brush_pattern.info );
fill_color_table_from_pal_colors( info, pdev->dev.hdc ); fill_color_table_from_pal_colors( info, pdev->dev.hdc );
init_dib_info_from_bitmapinfo( &pattern, info, pdev->brush_pattern_bits, 0 ); init_dib_info_from_bitmapinfo( &pattern, info, pdev->brush_pattern.bits.ptr, 0 );
*needs_reselect = TRUE; *needs_reselect = TRUE;
} }
else else
{ {
init_dib_info_from_bitmapinfo( &pattern, pdev->brush_pattern_info, pdev->brush_pattern_bits, 0 ); init_dib_info_from_bitmapinfo( &pattern, pdev->brush_pattern.info, pdev->brush_pattern.bits.ptr, 0 );
} }
if (pattern.bit_count == 1 && !pattern.color_table) if (pattern.bit_count == 1 && !pattern.color_table)
...@@ -1930,8 +1930,7 @@ static BOOL null_brush(dibdrv_physdev *pdev, dib_info *dib, int num, const RECT ...@@ -1930,8 +1930,7 @@ static BOOL null_brush(dibdrv_physdev *pdev, dib_info *dib, int num, const RECT
/*********************************************************************** /***********************************************************************
* dibdrv_SelectBrush * dibdrv_SelectBrush
*/ */
HBRUSH dibdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush, HBITMAP bitmap, HBRUSH dibdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush, const struct brush_pattern *pattern )
const BITMAPINFO *info, void *bits, UINT usage )
{ {
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSelectBrush ); PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSelectBrush );
dibdrv_physdev *pdev = get_dibdrv_pdev(dev); dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
...@@ -1941,17 +1940,14 @@ HBRUSH dibdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush, HBITMAP bitmap, ...@@ -1941,17 +1940,14 @@ HBRUSH dibdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush, HBITMAP bitmap,
free_pattern_brush( pdev ); free_pattern_brush( pdev );
if (bitmap || info) /* pattern brush */ if (pattern) /* pattern brush */
{ {
pdev->brush_rects = pattern_brush; pdev->brush_rects = pattern_brush;
pdev->brush_style = BS_DIBPATTERN; pdev->brush_style = BS_DIBPATTERN;
pdev->brush_pattern_info = info; pdev->brush_pattern = *pattern;
pdev->brush_pattern_bits = bits;
pdev->brush_pattern_usage = usage;
pdev->brush_pattern_bitmap = bitmap;
/* brush is actually selected only when it's used */ /* brush is actually selected only when it's used */
return next->funcs->pSelectBrush( next, hbrush, bitmap, info, bits, usage ); return next->funcs->pSelectBrush( next, hbrush, pattern );
} }
GetObjectW( hbrush, sizeof(logbrush), &logbrush ); GetObjectW( hbrush, sizeof(logbrush), &logbrush );
...@@ -1983,7 +1979,7 @@ HBRUSH dibdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush, HBITMAP bitmap, ...@@ -1983,7 +1979,7 @@ HBRUSH dibdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush, HBITMAP bitmap,
return 0; return 0;
} }
return next->funcs->pSelectBrush( next, hbrush, bitmap, info, bits, usage ); return next->funcs->pSelectBrush( next, hbrush, pattern );
} }
/*********************************************************************** /***********************************************************************
......
...@@ -526,8 +526,7 @@ static HBITMAP nulldrv_SelectBitmap( PHYSDEV dev, HBITMAP bitmap ) ...@@ -526,8 +526,7 @@ static HBITMAP nulldrv_SelectBitmap( PHYSDEV dev, HBITMAP bitmap )
return bitmap; return bitmap;
} }
static HBRUSH nulldrv_SelectBrush( PHYSDEV dev, HBRUSH brush, HBITMAP bitmap, static HBRUSH nulldrv_SelectBrush( PHYSDEV dev, HBRUSH brush, const struct brush_pattern *pattern )
const BITMAPINFO *info, void *bits, UINT usage )
{ {
return brush; return brush;
} }
......
...@@ -108,8 +108,7 @@ extern BOOL EMFDRV_ScaleViewportExtEx( PHYSDEV dev, INT xNum, INT xDenom, ...@@ -108,8 +108,7 @@ extern BOOL EMFDRV_ScaleViewportExtEx( PHYSDEV dev, INT xNum, INT xDenom,
extern BOOL EMFDRV_ScaleWindowExtEx( PHYSDEV dev, INT xNum, INT xDenom, extern BOOL EMFDRV_ScaleWindowExtEx( PHYSDEV dev, INT xNum, INT xDenom,
INT yNum, INT yDenom, SIZE *size ) DECLSPEC_HIDDEN; INT yNum, INT yDenom, SIZE *size ) DECLSPEC_HIDDEN;
extern HBITMAP EMFDRV_SelectBitmap( PHYSDEV dev, HBITMAP handle ) DECLSPEC_HIDDEN; extern HBITMAP EMFDRV_SelectBitmap( PHYSDEV dev, HBITMAP handle ) DECLSPEC_HIDDEN;
extern HBRUSH EMFDRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, HBITMAP bitmap, extern HBRUSH EMFDRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, const struct brush_pattern *pattern ) DECLSPEC_HIDDEN;
const BITMAPINFO *info, void *bits, UINT usage ) DECLSPEC_HIDDEN;
extern BOOL EMFDRV_SelectClipPath( PHYSDEV dev, INT iMode ) DECLSPEC_HIDDEN; extern BOOL EMFDRV_SelectClipPath( PHYSDEV dev, INT iMode ) DECLSPEC_HIDDEN;
extern HFONT EMFDRV_SelectFont( PHYSDEV dev, HFONT handle ) DECLSPEC_HIDDEN; extern HFONT EMFDRV_SelectFont( PHYSDEV dev, HFONT handle ) DECLSPEC_HIDDEN;
extern HPEN EMFDRV_SelectPen( PHYSDEV dev, HPEN handle ) DECLSPEC_HIDDEN; extern HPEN EMFDRV_SelectPen( PHYSDEV dev, HPEN handle ) DECLSPEC_HIDDEN;
......
...@@ -198,8 +198,7 @@ DWORD EMFDRV_CreateBrushIndirect( PHYSDEV dev, HBRUSH hBrush ) ...@@ -198,8 +198,7 @@ DWORD EMFDRV_CreateBrushIndirect( PHYSDEV dev, HBRUSH hBrush )
/*********************************************************************** /***********************************************************************
* EMFDRV_SelectBrush * EMFDRV_SelectBrush
*/ */
HBRUSH EMFDRV_SelectBrush( PHYSDEV dev, HBRUSH hBrush, HBITMAP bitmap, HBRUSH EMFDRV_SelectBrush( PHYSDEV dev, HBRUSH hBrush, const struct brush_pattern *pattern )
const BITMAPINFO *info, void *bits, UINT usage )
{ {
EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE*)dev; EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE*)dev;
EMRSELECTOBJECT emr; EMRSELECTOBJECT emr;
......
...@@ -182,14 +182,6 @@ typedef struct tagBITMAPOBJ ...@@ -182,14 +182,6 @@ typedef struct tagBITMAPOBJ
RGBQUAD *color_table; /* DIB color table if <= 8bpp (always 1 << bpp in size) */ RGBQUAD *color_table; /* DIB color table if <= 8bpp (always 1 << bpp in size) */
} BITMAPOBJ; } BITMAPOBJ;
struct brush_pattern
{
HBITMAP bitmap; /* bitmap handle for DDB patterns */
BITMAPINFO *info; /* DIB info */
struct gdi_image_bits bits; /* DIB bits */
UINT usage; /* color usage for DIB info */
};
/* bidi.c */ /* bidi.c */
/* Wine_GCPW Flags */ /* Wine_GCPW Flags */
......
...@@ -103,8 +103,7 @@ extern INT MFDRV_SaveDC( PHYSDEV dev ) DECLSPEC_HIDDEN; ...@@ -103,8 +103,7 @@ extern INT MFDRV_SaveDC( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL MFDRV_ScaleViewportExtEx( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, INT yDenom, SIZE *size ) DECLSPEC_HIDDEN; extern BOOL MFDRV_ScaleViewportExtEx( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, INT yDenom, SIZE *size ) DECLSPEC_HIDDEN;
extern BOOL MFDRV_ScaleWindowExtEx( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, INT yDenom, SIZE *size ) DECLSPEC_HIDDEN; extern BOOL MFDRV_ScaleWindowExtEx( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, INT yDenom, SIZE *size ) DECLSPEC_HIDDEN;
extern HBITMAP MFDRV_SelectBitmap( PHYSDEV dev, HBITMAP handle ) DECLSPEC_HIDDEN; extern HBITMAP MFDRV_SelectBitmap( PHYSDEV dev, HBITMAP handle ) DECLSPEC_HIDDEN;
extern HBRUSH MFDRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, HBITMAP bitmap, extern HBRUSH MFDRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, const struct brush_pattern *pattern ) DECLSPEC_HIDDEN;
const BITMAPINFO *info, void *bits, UINT usage ) DECLSPEC_HIDDEN;
extern BOOL MFDRV_SelectClipPath( PHYSDEV dev, INT iMode ) DECLSPEC_HIDDEN; extern BOOL MFDRV_SelectClipPath( PHYSDEV dev, INT iMode ) DECLSPEC_HIDDEN;
extern HFONT MFDRV_SelectFont( PHYSDEV dev, HFONT handle ) DECLSPEC_HIDDEN; extern HFONT MFDRV_SelectFont( PHYSDEV dev, HFONT handle ) DECLSPEC_HIDDEN;
extern HPEN MFDRV_SelectPen( PHYSDEV dev, HPEN handle ) DECLSPEC_HIDDEN; extern HPEN MFDRV_SelectPen( PHYSDEV dev, HPEN handle ) DECLSPEC_HIDDEN;
......
...@@ -229,8 +229,7 @@ done: ...@@ -229,8 +229,7 @@ done:
/*********************************************************************** /***********************************************************************
* MFDRV_SelectBrush * MFDRV_SelectBrush
*/ */
HBRUSH MFDRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, HBITMAP bitmap, HBRUSH MFDRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, const struct brush_pattern *pattern )
const BITMAPINFO *info, void *bits, UINT usage )
{ {
INT16 index; INT16 index;
......
...@@ -27,8 +27,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(psdrv); ...@@ -27,8 +27,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
/*********************************************************************** /***********************************************************************
* SelectBrush (WINEPS.@) * SelectBrush (WINEPS.@)
*/ */
HBRUSH PSDRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, HBITMAP bitmap, HBRUSH PSDRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, const struct brush_pattern *pattern )
const BITMAPINFO *info, void *bits, UINT usage )
{ {
PSDRV_PDEVICE *physDev = get_psdrv_dev( dev ); PSDRV_PDEVICE *physDev = get_psdrv_dev( dev );
LOGBRUSH logbrush; LOGBRUSH logbrush;
...@@ -55,9 +54,7 @@ HBRUSH PSDRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, HBITMAP bitmap, ...@@ -55,9 +54,7 @@ HBRUSH PSDRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, HBITMAP bitmap,
case BS_PATTERN: case BS_PATTERN:
case BS_DIBPATTERN: case BS_DIBPATTERN:
physDev->brush.info = info; physDev->brush.pattern = *pattern;
physDev->brush.bits = bits;
physDev->brush.usage = usage;
break; break;
default: default:
...@@ -238,8 +235,8 @@ BOOL PSDRV_Brush(PHYSDEV dev, BOOL EO) ...@@ -238,8 +235,8 @@ BOOL PSDRV_Brush(PHYSDEV dev, BOOL EO)
case BS_DIBPATTERN: case BS_DIBPATTERN:
if(physDev->pi->ppd->LanguageLevel > 1) { if(physDev->pi->ppd->LanguageLevel > 1) {
PSDRV_WriteGSave(dev); PSDRV_WriteGSave(dev);
ret = PSDRV_WriteDIBPatternDict(dev, physDev->brush.info, ret = PSDRV_WriteDIBPatternDict(dev, physDev->brush.pattern.info,
physDev->brush.bits, physDev->brush.usage ); physDev->brush.pattern.bits.ptr, physDev->brush.pattern.usage );
PSDRV_Fill(dev, EO); PSDRV_Fill(dev, EO);
PSDRV_WriteGRestore(dev); PSDRV_WriteGRestore(dev);
} else { } else {
......
...@@ -325,11 +325,9 @@ typedef struct { ...@@ -325,11 +325,9 @@ typedef struct {
} PSFONT; } PSFONT;
typedef struct { typedef struct {
PSCOLOR color; PSCOLOR color;
BOOL set; BOOL set;
const BITMAPINFO *info; struct brush_pattern pattern;
void *bits;
UINT usage;
} PSBRUSH; } PSBRUSH;
#define MAX_DASHLEN 16 #define MAX_DASHLEN 16
...@@ -456,8 +454,7 @@ extern DWORD PSDRV_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO ...@@ -456,8 +454,7 @@ extern DWORD PSDRV_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO
extern BOOL PSDRV_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN; extern BOOL PSDRV_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN;
extern BOOL PSDRV_RoundRect( PHYSDEV dev, INT left, INT top, INT right, extern BOOL PSDRV_RoundRect( PHYSDEV dev, INT left, INT top, INT right,
INT bottom, INT ell_width, INT ell_height ) DECLSPEC_HIDDEN; INT bottom, INT ell_width, INT ell_height ) DECLSPEC_HIDDEN;
extern HBRUSH PSDRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, HBITMAP bitmap, extern HBRUSH PSDRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, const struct brush_pattern *pattern ) DECLSPEC_HIDDEN;
const BITMAPINFO *info, void *bits, UINT usage ) DECLSPEC_HIDDEN;
extern HFONT PSDRV_SelectFont( PHYSDEV dev, HFONT hfont ) DECLSPEC_HIDDEN; extern HFONT PSDRV_SelectFont( PHYSDEV dev, HFONT hfont ) DECLSPEC_HIDDEN;
extern HPEN PSDRV_SelectPen( PHYSDEV dev, HPEN hpen ) DECLSPEC_HIDDEN; extern HPEN PSDRV_SelectPen( PHYSDEV dev, HPEN hpen ) DECLSPEC_HIDDEN;
extern COLORREF PSDRV_SetBkColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN; extern COLORREF PSDRV_SetBkColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
......
...@@ -254,11 +254,12 @@ static void BRUSH_SelectPatternBrush( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, ...@@ -254,11 +254,12 @@ static void BRUSH_SelectPatternBrush( X11DRV_PDEVICE *physDev, HBITMAP hbitmap,
} }
/* create a bitmap appropriate for the given DIB pattern brush */ /* create a bitmap appropriate for the given DIB pattern brush */
HBITMAP create_brush_bitmap( X11DRV_PDEVICE *physDev, const BITMAPINFO *info, void *bits, UINT usage ) HBITMAP create_brush_bitmap( X11DRV_PDEVICE *physDev, const struct brush_pattern *pattern )
{ {
HDC memdc; HDC memdc;
int bpp = screen_bpp; int bpp = screen_bpp;
HBITMAP bitmap; HBITMAP bitmap;
const BITMAPINFO *info = pattern->info;
if (physDev->depth == 1 || info->bmiHeader.biBitCount == 1) bpp = 1; if (physDev->depth == 1 || info->bmiHeader.biBitCount == 1) bpp = 1;
bitmap = CreateBitmap( info->bmiHeader.biWidth, abs(info->bmiHeader.biHeight), 1, bpp, NULL ); bitmap = CreateBitmap( info->bmiHeader.biWidth, abs(info->bmiHeader.biHeight), 1, bpp, NULL );
...@@ -269,7 +270,8 @@ HBITMAP create_brush_bitmap( X11DRV_PDEVICE *physDev, const BITMAPINFO *info, vo ...@@ -269,7 +270,8 @@ HBITMAP create_brush_bitmap( X11DRV_PDEVICE *physDev, const BITMAPINFO *info, vo
SelectObject( memdc, bitmap ); SelectObject( memdc, bitmap );
DeleteDC( memdc ); DeleteDC( memdc );
SetDIBits( physDev->dev.hdc, bitmap, 0, abs(info->bmiHeader.biHeight), bits, info, usage ); SetDIBits( physDev->dev.hdc, bitmap, 0, abs(info->bmiHeader.biHeight),
pattern->bits.ptr, info, pattern->usage );
return bitmap; return bitmap;
} }
...@@ -277,20 +279,20 @@ HBITMAP create_brush_bitmap( X11DRV_PDEVICE *physDev, const BITMAPINFO *info, vo ...@@ -277,20 +279,20 @@ HBITMAP create_brush_bitmap( X11DRV_PDEVICE *physDev, const BITMAPINFO *info, vo
/*********************************************************************** /***********************************************************************
* SelectBrush (X11DRV.@) * SelectBrush (X11DRV.@)
*/ */
HBRUSH X11DRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, HBITMAP bitmap, HBRUSH X11DRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, const struct brush_pattern *pattern )
const BITMAPINFO *info, void *bits, UINT usage )
{ {
X11DRV_PDEVICE *physDev = get_x11drv_dev( dev ); X11DRV_PDEVICE *physDev = get_x11drv_dev( dev );
LOGBRUSH logbrush; LOGBRUSH logbrush;
if (bitmap || info) /* pattern brush */ if (pattern) /* pattern brush */
{ {
X_PHYSBITMAP *physbitmap; X_PHYSBITMAP *physbitmap;
HBITMAP bitmap = pattern->bitmap;
BOOL delete_bitmap = FALSE; BOOL delete_bitmap = FALSE;
if (!bitmap || !(physbitmap = X11DRV_get_phys_bitmap( bitmap ))) if (!bitmap || !(physbitmap = X11DRV_get_phys_bitmap( bitmap )))
{ {
if (!(bitmap = create_brush_bitmap( physDev, info, bits, usage ))) return 0; if (!(bitmap = create_brush_bitmap( physDev, pattern ))) return 0;
physbitmap = X11DRV_get_phys_bitmap( bitmap ); physbitmap = X11DRV_get_phys_bitmap( bitmap );
delete_bitmap = TRUE; delete_bitmap = TRUE;
} }
......
...@@ -222,8 +222,7 @@ extern BOOL X11DRV_Rectangle(PHYSDEV dev, INT left, INT top, INT right, INT bott ...@@ -222,8 +222,7 @@ extern BOOL X11DRV_Rectangle(PHYSDEV dev, INT left, INT top, INT right, INT bott
extern BOOL X11DRV_RoundRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom, extern BOOL X11DRV_RoundRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
INT ell_width, INT ell_height ) DECLSPEC_HIDDEN; INT ell_width, INT ell_height ) DECLSPEC_HIDDEN;
extern HBITMAP X11DRV_SelectBitmap( PHYSDEV dev, HBITMAP hbitmap ) DECLSPEC_HIDDEN; extern HBITMAP X11DRV_SelectBitmap( PHYSDEV dev, HBITMAP hbitmap ) DECLSPEC_HIDDEN;
extern HBRUSH X11DRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, HBITMAP bitmap, extern HBRUSH X11DRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, const struct brush_pattern *pattern ) DECLSPEC_HIDDEN;
const BITMAPINFO *info, void *bits, UINT usage ) DECLSPEC_HIDDEN;
extern HFONT X11DRV_SelectFont( PHYSDEV dev, HFONT hfont ) DECLSPEC_HIDDEN; extern HFONT X11DRV_SelectFont( PHYSDEV dev, HFONT hfont ) DECLSPEC_HIDDEN;
extern HPEN X11DRV_SelectPen( PHYSDEV dev, HPEN hpen ) DECLSPEC_HIDDEN; extern HPEN X11DRV_SelectPen( PHYSDEV dev, HPEN hpen ) DECLSPEC_HIDDEN;
extern COLORREF X11DRV_SetBkColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN; extern COLORREF X11DRV_SetBkColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
...@@ -269,7 +268,7 @@ extern void X11DRV_FONT_Init( int log_pixels_x, int log_pixels_y ) DECLSPEC_HIDD ...@@ -269,7 +268,7 @@ extern void X11DRV_FONT_Init( int log_pixels_x, int log_pixels_y ) DECLSPEC_HIDD
extern void X11DRV_XInput2_Init(void) DECLSPEC_HIDDEN; extern void X11DRV_XInput2_Init(void) DECLSPEC_HIDDEN;
extern int bitmap_info_size( const BITMAPINFO * info, WORD coloruse ) DECLSPEC_HIDDEN; extern int bitmap_info_size( const BITMAPINFO * info, WORD coloruse ) DECLSPEC_HIDDEN;
extern HBITMAP create_brush_bitmap( X11DRV_PDEVICE *physDev, const BITMAPINFO *info, void *bits, UINT usage ) DECLSPEC_HIDDEN; extern HBITMAP create_brush_bitmap( X11DRV_PDEVICE *physDev, const struct brush_pattern *pattern ) DECLSPEC_HIDDEN;
extern XImage *X11DRV_DIB_CreateXImage( int width, int height, int depth ) DECLSPEC_HIDDEN; extern XImage *X11DRV_DIB_CreateXImage( int width, int height, int depth ) DECLSPEC_HIDDEN;
extern void X11DRV_DIB_DestroyXImage( XImage *image ) DECLSPEC_HIDDEN; extern void X11DRV_DIB_DestroyXImage( XImage *image ) DECLSPEC_HIDDEN;
extern HGLOBAL X11DRV_DIB_CreateDIBFromBitmap(HDC hdc, HBITMAP hBmp) DECLSPEC_HIDDEN; extern HGLOBAL X11DRV_DIB_CreateDIBFromBitmap(HDC hdc, HBITMAP hBmp) DECLSPEC_HIDDEN;
......
...@@ -2620,25 +2620,26 @@ fallback: ...@@ -2620,25 +2620,26 @@ fallback:
/*********************************************************************** /***********************************************************************
* xrenderdrv_SelectBrush * xrenderdrv_SelectBrush
*/ */
static HBRUSH xrenderdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush, HBITMAP bitmap, static HBRUSH xrenderdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush, const struct brush_pattern *pattern )
const BITMAPINFO *info, void *bits, UINT usage )
{ {
struct xrender_physdev *physdev = get_xrender_dev( dev ); struct xrender_physdev *physdev = get_xrender_dev( dev );
X_PHYSBITMAP *physbitmap; X_PHYSBITMAP *physbitmap;
enum wxr_format format; enum wxr_format format;
BOOL delete_bitmap = FALSE; BOOL delete_bitmap = FALSE;
BITMAP bm; BITMAP bm;
HBITMAP bitmap;
Pixmap pixmap; Pixmap pixmap;
Picture src_pict, dst_pict; Picture src_pict, dst_pict;
XRenderPictureAttributes pa; XRenderPictureAttributes pa;
if (!X11DRV_XRender_Installed) goto x11drv_fallback; if (!X11DRV_XRender_Installed) goto x11drv_fallback;
if (!bitmap && !info) goto x11drv_fallback; if (!pattern) goto x11drv_fallback;
if (physdev->format == WXR_FORMAT_MONO) goto x11drv_fallback; if (physdev->format == WXR_FORMAT_MONO) goto x11drv_fallback;
bitmap = pattern->bitmap;
if (!bitmap || !(physbitmap = X11DRV_get_phys_bitmap( bitmap ))) if (!bitmap || !(physbitmap = X11DRV_get_phys_bitmap( bitmap )))
{ {
if (!(bitmap = create_brush_bitmap( physdev->x11dev, info, bits, usage ))) return 0; if (!(bitmap = create_brush_bitmap( physdev->x11dev, pattern ))) return 0;
physbitmap = X11DRV_get_phys_bitmap( bitmap ); physbitmap = X11DRV_get_phys_bitmap( bitmap );
delete_bitmap = TRUE; delete_bitmap = TRUE;
} }
...@@ -2676,7 +2677,7 @@ static HBRUSH xrenderdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush, HBITMAP bitmap ...@@ -2676,7 +2677,7 @@ static HBRUSH xrenderdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush, HBITMAP bitmap
x11drv_fallback: x11drv_fallback:
if (delete_bitmap) DeleteObject( bitmap ); if (delete_bitmap) DeleteObject( bitmap );
dev = GET_NEXT_PHYSDEV( dev, pSelectBrush ); dev = GET_NEXT_PHYSDEV( dev, pSelectBrush );
return dev->funcs->pSelectBrush( dev, hbrush, bitmap, info, bits, usage ); return dev->funcs->pSelectBrush( dev, hbrush, pattern );
} }
......
...@@ -52,6 +52,14 @@ struct gdi_image_bits ...@@ -52,6 +52,14 @@ struct gdi_image_bits
void *param; /* extra parameter for callback private use */ void *param; /* extra parameter for callback private use */
}; };
struct brush_pattern
{
HBITMAP bitmap; /* bitmap handle for DDB patterns */
BITMAPINFO *info; /* DIB info */
struct gdi_image_bits bits; /* DIB bits */
UINT usage; /* color usage for DIB info */
};
struct gdi_dc_funcs struct gdi_dc_funcs
{ {
INT (*pAbortDoc)(PHYSDEV); INT (*pAbortDoc)(PHYSDEV);
...@@ -147,7 +155,7 @@ struct gdi_dc_funcs ...@@ -147,7 +155,7 @@ struct gdi_dc_funcs
BOOL (*pScaleViewportExtEx)(PHYSDEV,INT,INT,INT,INT,SIZE*); BOOL (*pScaleViewportExtEx)(PHYSDEV,INT,INT,INT,INT,SIZE*);
BOOL (*pScaleWindowExtEx)(PHYSDEV,INT,INT,INT,INT,SIZE*); BOOL (*pScaleWindowExtEx)(PHYSDEV,INT,INT,INT,INT,SIZE*);
HBITMAP (*pSelectBitmap)(PHYSDEV,HBITMAP); HBITMAP (*pSelectBitmap)(PHYSDEV,HBITMAP);
HBRUSH (*pSelectBrush)(PHYSDEV,HBRUSH,HBITMAP,const BITMAPINFO*,void*,UINT); HBRUSH (*pSelectBrush)(PHYSDEV,HBRUSH,const struct brush_pattern*);
BOOL (*pSelectClipPath)(PHYSDEV,INT); BOOL (*pSelectClipPath)(PHYSDEV,INT);
HFONT (*pSelectFont)(PHYSDEV,HFONT); HFONT (*pSelectFont)(PHYSDEV,HFONT);
HPALETTE (*pSelectPalette)(PHYSDEV,HPALETTE,BOOL); HPALETTE (*pSelectPalette)(PHYSDEV,HPALETTE,BOOL);
...@@ -205,7 +213,7 @@ struct gdi_dc_funcs ...@@ -205,7 +213,7 @@ struct gdi_dc_funcs
}; };
/* increment this when you change the DC function table */ /* increment this when you change the DC function table */
#define WINE_GDI_DRIVER_VERSION 20 #define WINE_GDI_DRIVER_VERSION 21
static inline PHYSDEV get_physdev_entry_point( PHYSDEV dev, size_t offset ) static inline PHYSDEV get_physdev_entry_point( PHYSDEV dev, size_t offset )
{ {
......
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