Commit c819e4bd authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Add a null driver fallback for AlphaBlend, using a new BlendImage driver entry point.

parent 27516bab
...@@ -196,7 +196,10 @@ static DWORD stretch_bits( const BITMAPINFO *src_info, struct bitblt_coords *src ...@@ -196,7 +196,10 @@ static DWORD stretch_bits( const BITMAPINFO *src_info, struct bitblt_coords *src
return err; return err;
} }
/* nulldrv fallback implementation using StretchDIBits */ /***********************************************************************
* null driver fallback implementations
*/
BOOL nulldrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst, BOOL nulldrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
PHYSDEV src_dev, struct bitblt_coords *src, DWORD rop ) PHYSDEV src_dev, struct bitblt_coords *src, DWORD rop )
{ {
...@@ -267,6 +270,46 @@ BOOL nulldrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst, ...@@ -267,6 +270,46 @@ BOOL nulldrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
return !err; return !err;
} }
BOOL nulldrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst,
PHYSDEV src_dev, struct bitblt_coords *src, BLENDFUNCTION func )
{
DC *dc_src, *dc_dst = get_nulldrv_dc( dst_dev );
char src_buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )];
char dst_buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )];
BITMAPINFO *src_info = (BITMAPINFO *)src_buffer;
BITMAPINFO *dst_info = (BITMAPINFO *)dst_buffer;
DWORD err;
struct gdi_image_bits bits;
if (!(dc_src = get_dc_ptr( src_dev->hdc ))) return FALSE;
src_dev = GET_DC_PHYSDEV( dc_src, pGetImage );
err = src_dev->funcs->pGetImage( src_dev, 0, src_info, &bits, src );
release_dc_ptr( dc_src );
if (err) return FALSE;
dst_dev = GET_DC_PHYSDEV( dc_dst, pBlendImage );
memcpy( dst_info, src_info, FIELD_OFFSET( BITMAPINFO, bmiColors[256] ));
err = dst_dev->funcs->pBlendImage( dst_dev, dst_info, &bits, src, dst, func );
if (err == ERROR_BAD_FORMAT)
{
err = convert_bits( src_info, src, dst_info, &bits );
if (!err) err = dst_dev->funcs->pBlendImage( dst_dev, dst_info, &bits, src, dst, func );
}
if (err == ERROR_TRANSFORM_NOT_SUPPORTED &&
((src->width != dst->width) || (src->height != dst->height)))
{
memcpy( src_info, dst_info, FIELD_OFFSET( BITMAPINFO, bmiColors[256] ));
err = stretch_bits( src_info, src, dst_info, dst, &bits, COLORONCOLOR );
if (!err) err = dst_dev->funcs->pBlendImage( dst_dev, dst_info, &bits, src, dst, func );
}
if (bits.free) bits.free( &bits );
return !err;
}
/*********************************************************************** /***********************************************************************
* PatBlt (GDI32.@) * PatBlt (GDI32.@)
*/ */
......
...@@ -506,6 +506,7 @@ const DC_FUNCTIONS dib_driver = ...@@ -506,6 +506,7 @@ const DC_FUNCTIONS dib_driver =
NULL, /* pArc */ NULL, /* pArc */
NULL, /* pArcTo */ NULL, /* pArcTo */
NULL, /* pBeginPath */ NULL, /* pBeginPath */
NULL, /* pBlendImage */
NULL, /* pChoosePixelFormat */ NULL, /* pChoosePixelFormat */
NULL, /* pChord */ NULL, /* pChord */
NULL, /* pCloseFigure */ NULL, /* pCloseFigure */
......
...@@ -190,14 +190,14 @@ static INT nulldrv_AbortDoc( PHYSDEV dev ) ...@@ -190,14 +190,14 @@ static INT nulldrv_AbortDoc( PHYSDEV dev )
return 0; return 0;
} }
static BOOL nulldrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst, static BOOL nulldrv_Arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
PHYSDEV src_dev, struct bitblt_coords *src, BLENDFUNCTION func) INT xstart, INT ystart, INT xend, INT yend )
{ {
return TRUE; return TRUE;
} }
static BOOL nulldrv_Arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom, static DWORD nulldrv_BlendImage( PHYSDEV dev, BITMAPINFO *info, const struct gdi_image_bits *bits,
INT xstart, INT ystart, INT xend, INT yend ) struct bitblt_coords *src, struct bitblt_coords *dst, BLENDFUNCTION func )
{ {
return TRUE; return TRUE;
} }
...@@ -666,6 +666,7 @@ const DC_FUNCTIONS null_driver = ...@@ -666,6 +666,7 @@ const DC_FUNCTIONS null_driver =
nulldrv_Arc, /* pArc */ nulldrv_Arc, /* pArc */
nulldrv_ArcTo, /* pArcTo */ nulldrv_ArcTo, /* pArcTo */
nulldrv_BeginPath, /* pBeginPath */ nulldrv_BeginPath, /* pBeginPath */
nulldrv_BlendImage, /* pBlendImage */
nulldrv_ChoosePixelFormat, /* pChoosePixelFormat */ nulldrv_ChoosePixelFormat, /* pChoosePixelFormat */
nulldrv_Chord, /* pChord */ nulldrv_Chord, /* pChord */
nulldrv_CloseFigure, /* pCloseFigure */ nulldrv_CloseFigure, /* pCloseFigure */
......
...@@ -43,6 +43,7 @@ static const DC_FUNCTIONS EMFDRV_Funcs = ...@@ -43,6 +43,7 @@ static const DC_FUNCTIONS EMFDRV_Funcs =
EMFDRV_Arc, /* pArc */ EMFDRV_Arc, /* pArc */
NULL, /* pArcTo */ NULL, /* pArcTo */
EMFDRV_BeginPath, /* pBeginPath */ EMFDRV_BeginPath, /* pBeginPath */
NULL, /* pBlendImage */
NULL, /* pChoosePixelFormat */ NULL, /* pChoosePixelFormat */
EMFDRV_Chord, /* pChord */ EMFDRV_Chord, /* pChord */
EMFDRV_CloseFigure, /* pCloseFigure */ EMFDRV_CloseFigure, /* pCloseFigure */
......
...@@ -383,6 +383,8 @@ static inline void release_wine_region(HRGN rgn) ...@@ -383,6 +383,8 @@ static inline void release_wine_region(HRGN rgn)
/* null driver entry points */ /* null driver entry points */
extern BOOL nulldrv_AbortPath( PHYSDEV dev ) DECLSPEC_HIDDEN; extern BOOL nulldrv_AbortPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL nulldrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst,
PHYSDEV src_dev, struct bitblt_coords *src, BLENDFUNCTION func) DECLSPEC_HIDDEN;
extern BOOL nulldrv_AngleArc( PHYSDEV dev, INT x, INT y, DWORD radius, FLOAT start, FLOAT sweep ) DECLSPEC_HIDDEN; extern BOOL nulldrv_AngleArc( PHYSDEV dev, INT x, INT y, DWORD radius, FLOAT start, FLOAT sweep ) DECLSPEC_HIDDEN;
extern BOOL nulldrv_ArcTo( PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN; extern BOOL nulldrv_ArcTo( PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN;
extern BOOL nulldrv_BeginPath( PHYSDEV dev ) DECLSPEC_HIDDEN; extern BOOL nulldrv_BeginPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
......
...@@ -88,6 +88,7 @@ static const DC_FUNCTIONS MFDRV_Funcs = ...@@ -88,6 +88,7 @@ static const DC_FUNCTIONS MFDRV_Funcs =
MFDRV_Arc, /* pArc */ MFDRV_Arc, /* pArc */
NULL, /* pArcTo */ NULL, /* pArcTo */
MFDRV_BeginPath, /* pBeginPath */ MFDRV_BeginPath, /* pBeginPath */
NULL, /* pBlendImage */
NULL, /* pChoosePixelFormat */ NULL, /* pChoosePixelFormat */
MFDRV_Chord, /* pChord */ MFDRV_Chord, /* pChord */
MFDRV_CloseFigure, /* pCloseFigure */ MFDRV_CloseFigure, /* pCloseFigure */
......
...@@ -825,6 +825,7 @@ static const struct gdi_dc_funcs psdrv_funcs = ...@@ -825,6 +825,7 @@ static const struct gdi_dc_funcs psdrv_funcs =
PSDRV_Arc, /* pArc */ PSDRV_Arc, /* pArc */
NULL, /* pArcTo */ NULL, /* pArcTo */
NULL, /* pBeginPath */ NULL, /* pBeginPath */
NULL, /* pBlendImage */
NULL, /* pChoosePixelFormat */ NULL, /* pChoosePixelFormat */
PSDRV_Chord, /* pChord */ PSDRV_Chord, /* pChord */
NULL, /* pCloseFigure */ NULL, /* pCloseFigure */
......
...@@ -472,6 +472,7 @@ static const struct gdi_dc_funcs x11drv_funcs = ...@@ -472,6 +472,7 @@ static const struct gdi_dc_funcs x11drv_funcs =
X11DRV_Arc, /* pArc */ X11DRV_Arc, /* pArc */
NULL, /* pArcTo */ NULL, /* pArcTo */
NULL, /* pBeginPath */ NULL, /* pBeginPath */
NULL, /* pBlendImage */
X11DRV_ChoosePixelFormat, /* pChoosePixelFormat */ X11DRV_ChoosePixelFormat, /* pChoosePixelFormat */
X11DRV_Chord, /* pChord */ X11DRV_Chord, /* pChord */
NULL, /* pCloseFigure */ NULL, /* pCloseFigure */
......
...@@ -2598,6 +2598,7 @@ static const struct gdi_dc_funcs xrender_funcs = ...@@ -2598,6 +2598,7 @@ static const struct gdi_dc_funcs xrender_funcs =
NULL, /* pArc */ NULL, /* pArc */
NULL, /* pArcTo */ NULL, /* pArcTo */
NULL, /* pBeginPath */ NULL, /* pBeginPath */
NULL, /* pBlendImage */
NULL, /* pChoosePixelFormat */ NULL, /* pChoosePixelFormat */
NULL, /* pChord */ NULL, /* pChord */
NULL, /* pCloseFigure */ NULL, /* pCloseFigure */
......
...@@ -61,6 +61,7 @@ struct gdi_dc_funcs ...@@ -61,6 +61,7 @@ struct gdi_dc_funcs
BOOL (*pArc)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT); BOOL (*pArc)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
BOOL (*pArcTo)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT); BOOL (*pArcTo)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
BOOL (*pBeginPath)(PHYSDEV); BOOL (*pBeginPath)(PHYSDEV);
DWORD (*pBlendImage)(PHYSDEV,BITMAPINFO*,const struct gdi_image_bits*,struct bitblt_coords*,struct bitblt_coords*,BLENDFUNCTION);
INT (*pChoosePixelFormat)(PHYSDEV,const PIXELFORMATDESCRIPTOR *); INT (*pChoosePixelFormat)(PHYSDEV,const PIXELFORMATDESCRIPTOR *);
BOOL (*pChord)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT); BOOL (*pChord)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
BOOL (*pCloseFigure)(PHYSDEV); BOOL (*pCloseFigure)(PHYSDEV);
...@@ -189,7 +190,7 @@ struct gdi_dc_funcs ...@@ -189,7 +190,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 13 #define WINE_GDI_DRIVER_VERSION 14
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