winex11: Directly use win32u for GDI functions in xrender.c.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2022-04-12 13:10:16 +02:00 committed by Alexandre Julliard
parent 37f31840b9
commit b01bf347ad
1 changed files with 37 additions and 23 deletions

View File

@ -388,11 +388,11 @@ static void get_xrender_color( struct xrender_physdev *physdev, COLORREF src_col
{
if (src_color & (1 << 24)) /* PALETTEINDEX */
{
HPALETTE pal = GetCurrentObject( physdev->dev.hdc, OBJ_PAL );
HPALETTE pal = NtGdiGetDCObject( physdev->dev.hdc, NTGDI_OBJ_PAL );
PALETTEENTRY pal_ent;
if (!GetPaletteEntries( pal, LOWORD(src_color), 1, &pal_ent ))
GetPaletteEntries( pal, 0, 1, &pal_ent );
if (!get_palette_entries( pal, LOWORD(src_color), 1, &pal_ent ))
get_palette_entries( pal, 0, 1, &pal_ent );
dst_color->red = pal_ent.peRed * 257;
dst_color->green = pal_ent.peGreen * 257;
dst_color->blue = pal_ent.peBlue * 257;
@ -499,20 +499,20 @@ static Picture get_xrender_picture( struct xrender_physdev *dev, HRGN clip_rgn,
if (clip_rect)
{
HRGN rgn = CreateRectRgnIndirect( clip_rect );
if (clip_rgn) CombineRgn( rgn, rgn, clip_rgn, RGN_AND );
if (dev->region) CombineRgn( rgn, rgn, dev->region, RGN_AND );
HRGN rgn = NtGdiCreateRectRgn( clip_rect->left, clip_rect->top, clip_rect->right, clip_rect->bottom );
if (clip_rgn) NtGdiCombineRgn( rgn, rgn, clip_rgn, RGN_AND );
if (dev->region) NtGdiCombineRgn( rgn, rgn, dev->region, RGN_AND );
update_xrender_clipping( dev, rgn );
DeleteObject( rgn );
NtGdiDeleteObjectApp( rgn );
}
else if (clip_rgn)
{
if (dev->region)
{
HRGN rgn = CreateRectRgn( 0, 0, 0, 0 );
CombineRgn( rgn, clip_rgn, dev->region, RGN_AND );
HRGN rgn = NtGdiCreateRectRgn( 0, 0, 0, 0 );
NtGdiCombineRgn( rgn, clip_rgn, dev->region, RGN_AND );
update_xrender_clipping( dev, rgn );
DeleteObject( rgn );
NtGdiDeleteObjectApp( rgn );
}
else update_xrender_clipping( dev, clip_rgn );
}
@ -829,9 +829,10 @@ static HFONT CDECL xrenderdrv_SelectFont( PHYSDEV dev, HFONT hfont, UINT *aa_fla
LFANDSIZE lfsz;
struct xrender_physdev *physdev = get_xrender_dev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSelectFont );
DWORD mode;
HFONT ret;
GetObjectW( hfont, sizeof(lfsz.lf), &lfsz.lf );
NtGdiExtGetObjectW( hfont, sizeof(lfsz.lf), &lfsz.lf );
if (!*aa_flags) *aa_flags = get_xft_aa_flags( &lfsz.lf );
ret = next->funcs->pSelectFont( next, hfont, aa_flags );
@ -859,11 +860,12 @@ static HFONT CDECL xrenderdrv_SelectFont( PHYSDEV dev, HFONT hfont, UINT *aa_fla
lfsz.devsize.cx = X11DRV_XWStoDS( dev->hdc, lfsz.lf.lfWidth );
lfsz.devsize.cy = X11DRV_YWStoDS( dev->hdc, lfsz.lf.lfHeight );
GetTransform( dev->hdc, 0x204, &lfsz.xform );
NtGdiGetTransform( dev->hdc, 0x204, &lfsz.xform );
TRACE("font transform %f %f %f %f\n", lfsz.xform.eM11, lfsz.xform.eM12,
lfsz.xform.eM21, lfsz.xform.eM22);
if (GetGraphicsMode( dev->hdc ) == GM_COMPATIBLE)
NtGdiGetDCDword( dev->hdc, NtGdiGetGraphicsMode, &mode );
if (mode == GM_COMPATIBLE)
{
lfsz.lf.lfOrientation = lfsz.lf.lfEscapement;
if (lfsz.xform.eM11 * lfsz.xform.eM22 < 0)
@ -1038,20 +1040,23 @@ static void UploadGlyph(struct xrender_physdev *physDev, UINT glyph, enum glyph_
static const MAT2 identity = { {0,1},{0,0},{0,0},{0,1} };
if (type == GLYPH_INDEX) ggo_format |= GGO_GLYPH_INDEX;
buflen = GetGlyphOutlineW(physDev->dev.hdc, glyph, ggo_format, &gm, 0, NULL, &identity);
buflen = NtGdiGetGlyphOutline( physDev->dev.hdc, glyph, ggo_format, &gm, 0, NULL, &identity, FALSE );
if(buflen == GDI_ERROR) {
if(format != AA_None) {
format = AA_None;
physDev->aa_flags = GGO_BITMAP;
ggo_format = (ggo_format & GGO_GLYPH_INDEX) | GGO_BITMAP;
buflen = GetGlyphOutlineW(physDev->dev.hdc, glyph, ggo_format, &gm, 0, NULL, &identity);
buflen = NtGdiGetGlyphOutline( physDev->dev.hdc, glyph, ggo_format, &gm, 0, NULL,
&identity, FALSE);
}
if(buflen == GDI_ERROR) {
WARN("GetGlyphOutlineW failed using default glyph\n");
buflen = GetGlyphOutlineW(physDev->dev.hdc, 0, ggo_format, &gm, 0, NULL, &identity);
buflen = NtGdiGetGlyphOutline( physDev->dev.hdc, 0, ggo_format, &gm, 0, NULL,
&identity, FALSE );
if(buflen == GDI_ERROR) {
WARN("GetGlyphOutlineW failed for default glyph trying for space\n");
buflen = GetGlyphOutlineW(physDev->dev.hdc, 0x20, ggo_format, &gm, 0, NULL, &identity);
buflen = NtGdiGetGlyphOutline( physDev->dev.hdc, 0x20, ggo_format, &gm, 0, NULL,
&identity, FALSE );
if(buflen == GDI_ERROR) {
ERR("GetGlyphOutlineW for all attempts unable to upload a glyph\n");
return;
@ -1122,7 +1127,7 @@ static void UploadGlyph(struct xrender_physdev *physDev, UINT glyph, enum glyph_
buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, buflen);
if (buflen)
GetGlyphOutlineW(physDev->dev.hdc, glyph, ggo_format, &gm, buflen, buf, &identity);
NtGdiGetGlyphOutline( physDev->dev.hdc, glyph, ggo_format, &gm, buflen, buf, &identity, FALSE );
else
gm.gmBlackBoxX = gm.gmBlackBoxY = 0; /* empty glyph */
formatEntry->realized[glyph] = TRUE;
@ -1309,6 +1314,7 @@ static BOOL CDECL xrenderdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
gsCacheEntry *entry;
gsCacheEntryFormat *formatEntry;
unsigned int idx;
DWORD text_color;
Picture pict, tile_pict = 0;
XGlyphElt16 *elts;
POINT offset, desired, current;
@ -1317,7 +1323,8 @@ static BOOL CDECL xrenderdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
RECT rect, bounds;
enum glyph_type type = (flags & ETO_GLYPH_INDEX) ? GLYPH_INDEX : GLYPH_WCHAR;
get_xrender_color( physdev, GetTextColor( physdev->dev.hdc ), &col );
NtGdiGetDCDword( physdev->dev.hdc, NtGdiGetTextColor, &text_color );
get_xrender_color( physdev, text_color, &col );
pict = get_xrender_picture( physdev, 0, (flags & ETO_CLIPPED) ? lprect : NULL );
if(flags & ETO_OPAQUE)
@ -1328,7 +1335,11 @@ static BOOL CDECL xrenderdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
/* use the inverse of the text color */
bg.red = bg.green = bg.blue = bg.alpha = ~col.alpha;
else
get_xrender_color( physdev, GetBkColor( physdev->dev.hdc ), &bg );
{
DWORD bg_color;
NtGdiGetDCDword( physdev->dev.hdc, NtGdiGetBkColor, &bg_color );
get_xrender_color( physdev, bg_color, &bg );
}
set_xrender_transformation( pict, 1, 1, 0, 0 );
pXRenderFillRectangle( gdi_display, PictOpSrc, pict, &bg,
@ -1648,10 +1659,13 @@ static void xrender_stretch_blit( struct xrender_physdev *physdev_src, struct xr
/* mono -> color */
if (physdev_src->format == WXR_FORMAT_MONO && physdev_dst->format != WXR_FORMAT_MONO)
{
DWORD text_color, bg_color;
XRenderColor fg, bg;
get_xrender_color( physdev_dst, GetTextColor( physdev_dst->dev.hdc ), &fg );
get_xrender_color( physdev_dst, GetBkColor( physdev_dst->dev.hdc ), &bg );
NtGdiGetDCDword( physdev_dst->dev.hdc, NtGdiGetTextColor, &text_color );
NtGdiGetDCDword( physdev_dst->dev.hdc, NtGdiGetBkColor, &bg_color );
get_xrender_color( physdev_dst, text_color, &fg );
get_xrender_color( physdev_dst, bg_color, &bg );
fg.alpha = bg.alpha = 0;
xrender_mono_blit( src_pict, dst_pict, physdev_dst->format, &fg, &bg,
@ -2057,7 +2071,7 @@ static BOOL CDECL xrenderdrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, U
pt[0].y = v1->y;
pt[1].x = v2->x;
pt[1].y = v2->y;
LPtoDP( dev->hdc, pt, 2 );
lp_to_dp( dev->hdc, pt, 2 );
if (mode == GRADIENT_FILL_RECT_H)
{
gradient.p1.y = gradient.p2.y = 0;