Commit 3a11be1d authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

winex11: Directly use win32u for GDI functions in more places.

parent b01bf347
......@@ -246,7 +246,7 @@ HBRUSH CDECL X11DRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, const struct brush_
return hbrush;
}
if (!GetObjectA( hbrush, sizeof(logbrush), &logbrush )) return 0;
if (!NtGdiExtGetObjectW( hbrush, sizeof(logbrush), &logbrush )) return 0;
TRACE("hdc=%p hbrush=%p\n", dev->hdc, hbrush);
......@@ -257,7 +257,7 @@ HBRUSH CDECL X11DRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, const struct brush_
}
physDev->brush.style = logbrush.lbStyle;
if (hbrush == GetStockObject( DC_BRUSH ))
logbrush.lbColor = GetDCBrushColor( dev->hdc );
NtGdiGetDCDword( dev->hdc, NtGdiGetDCBrushColor, &logbrush.lbColor );
switch(logbrush.lbStyle)
{
......@@ -289,7 +289,7 @@ COLORREF CDECL X11DRV_SetDCBrushColor( PHYSDEV dev, COLORREF crColor )
{
X11DRV_PDEVICE *physDev = get_x11drv_dev( dev );
if (GetCurrentObject(dev->hdc, OBJ_BRUSH) == GetStockObject( DC_BRUSH ))
if (NtGdiGetDCObject( dev->hdc, NTGDI_OBJ_BRUSH ) == GetStockObject( DC_BRUSH ))
BRUSH_SelectSolidBrush( physDev, crColor );
return crColor;
......
......@@ -937,8 +937,8 @@ static BOOL X11DRV_Expose( HWND hwnd, XEvent *xev )
{
surface_region = expose_surface( data->surface, &rect );
if (!surface_region) flags = 0;
else OffsetRgn( surface_region, data->whole_rect.left - data->client_rect.left,
data->whole_rect.top - data->client_rect.top );
else NtGdiOffsetRgn( surface_region, data->whole_rect.left - data->client_rect.left,
data->whole_rect.top - data->client_rect.top );
if (data->vis.visualid != default_visual.visualid)
data->surface->funcs->flush( data->surface );
......
......@@ -135,7 +135,7 @@ void add_device_bounds( X11DRV_PDEVICE *dev, const RECT *rect )
RECT rc;
if (!dev->bounds) return;
if (dev->region && GetRgnBox( dev->region, &rc ))
if (dev->region && NtGdiGetRgnBox( dev->region, &rc ))
{
if (IntersectRect( &rc, &rc, rect )) add_bounds_rect( dev->bounds, &rc );
}
......@@ -266,21 +266,24 @@ static INT CDECL X11DRV_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOI
if (event.type == NoExpose) break;
if (event.type == GraphicsExpose)
{
DWORD layout;
RECT rect;
rect.left = event.xgraphicsexpose.x - physDev->dc_rect.left;
rect.top = event.xgraphicsexpose.y - physDev->dc_rect.top;
rect.right = rect.left + event.xgraphicsexpose.width;
rect.bottom = rect.top + event.xgraphicsexpose.height;
if (GetLayout( dev->hdc ) & LAYOUT_RTL)
if (NtGdiGetDCDword( dev->hdc, NtGdiGetLayout, &layout ) &&
(layout & LAYOUT_RTL))
mirror_rect( &physDev->dc_rect, &rect );
TRACE( "got %s count %d\n", wine_dbgstr_rect(&rect),
event.xgraphicsexpose.count );
if (!tmp) tmp = CreateRectRgnIndirect( &rect );
else SetRectRgn( tmp, rect.left, rect.top, rect.right, rect.bottom );
if (hrgn) CombineRgn( hrgn, hrgn, tmp, RGN_OR );
if (!tmp) tmp = NtGdiCreateRectRgn( rect.left, rect.top,
rect.right, rect.bottom );
else NtGdiSetRectRgn( tmp, rect.left, rect.top, rect.right, rect.bottom );
if (hrgn) NtGdiCombineRgn( hrgn, hrgn, tmp, RGN_OR );
else
{
hrgn = tmp;
......@@ -294,7 +297,7 @@ static INT CDECL X11DRV_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOI
break;
}
}
if (tmp) DeleteObject( tmp );
if (tmp) NtGdiDeleteObjectApp( tmp );
}
*(HRGN *)out_data = hrgn;
return TRUE;
......
......@@ -735,7 +735,7 @@ static XcursorImage *create_xcursor_frame( HDC hdc, const ICONINFOEXW *iinfo, HA
/* draw the cursor frame to a temporary buffer then copy it into the XcursorImage */
memset( color_bits, 0x00, color_size );
SelectObject( hdc, hbmColor );
NtGdiSelectBitmap( hdc, hbmColor );
if (!DrawIconEx( hdc, 0, 0, icon, width, height, istep, NULL, DI_NORMAL ))
{
TRACE("Could not draw frame %d (walk past end of frames).\n", istep);
......@@ -754,7 +754,7 @@ static XcursorImage *create_xcursor_frame( HDC hdc, const ICONINFOEXW *iinfo, HA
/* draw the cursor mask to a temporary buffer */
memset( mask_bits, 0xFF, mask_size );
SelectObject( hdc, hbmMask );
NtGdiSelectBitmap( hdc, hbmMask );
if (!DrawIconEx( hdc, 0, 0, icon, width, height, istep, NULL, DI_MASK ))
{
ERR("Failed to draw frame mask %d.\n", istep);
......@@ -807,7 +807,7 @@ static Cursor create_xcursor_cursor( HDC hdc, const ICONINFOEXW *iinfo, HANDLE i
info->bmiHeader.biBitCount = 32;
color_size = width * height * 4;
info->bmiHeader.biSizeImage = color_size;
hbmColor = CreateDIBSection( hdc, info, DIB_RGB_COLORS, (VOID **) &color_bits, NULL, 0);
hbmColor = NtGdiCreateDIBSection( hdc, NULL, 0, info, DIB_RGB_COLORS, 0, 0, 0, (void **)&color_bits );
if (!hbmColor)
{
ERR("Failed to create DIB section for cursor color data!\n");
......@@ -825,7 +825,7 @@ static Cursor create_xcursor_cursor( HDC hdc, const ICONINFOEXW *iinfo, HANDLE i
mask_size = ((width + 31) / 32 * 4) * height; /* width_bytes * height */
info->bmiHeader.biSizeImage = mask_size;
hbmMask = CreateDIBSection( hdc, info, DIB_RGB_COLORS, (VOID **) &mask_bits, NULL, 0);
hbmMask = NtGdiCreateDIBSection( hdc, NULL, 0, info, DIB_RGB_COLORS, 0, 0, 0, (void **)&mask_bits );
if (!hbmMask)
{
ERR("Failed to create DIB section for cursor mask data!\n");
......@@ -860,8 +860,8 @@ cleanup:
HeapFree( GetProcessHeap(), 0, imgs );
}
/* Cleanup all of the resources used to obtain the frame data */
if (hbmColor) DeleteObject( hbmColor );
if (hbmMask) DeleteObject( hbmMask );
if (hbmColor) NtGdiDeleteObjectApp( hbmColor );
if (hbmMask) NtGdiDeleteObjectApp( hbmMask );
HeapFree( GetProcessHeap(), 0, info );
return cursor;
}
......@@ -1164,7 +1164,8 @@ static Cursor create_xlib_monochrome_cursor( HDC hdc, const ICONINFOEXW *icon, i
info->bmiHeader.biClrImportant = 0;
if (!(mask_bits = HeapAlloc( GetProcessHeap(), 0, info->bmiHeader.biSizeImage ))) goto done;
if (!GetDIBits( hdc, icon->hbmMask, 0, height * 2, mask_bits, info, DIB_RGB_COLORS )) goto done;
if (!NtGdiGetDIBitsInternal( hdc, icon->hbmMask, 0, height * 2, mask_bits, info,
DIB_RGB_COLORS, 0, 0 )) goto done;
vis.depth = 1;
bits.ptr = mask_bits;
......@@ -1243,7 +1244,7 @@ static Cursor create_xlib_load_mono_cursor( HDC hdc, HANDLE handle, int width, i
{
if (!info.hbmColor)
{
GetObjectW( info.hbmMask, sizeof(bm), &bm );
NtGdiExtGetObjectW( info.hbmMask, sizeof(bm), &bm );
bm.bmHeight = max( 1, bm.bmHeight / 2 );
/* make sure hotspot is valid */
if (info.xHotspot >= bm.bmWidth || info.yHotspot >= bm.bmHeight)
......@@ -1253,8 +1254,8 @@ static Cursor create_xlib_load_mono_cursor( HDC hdc, HANDLE handle, int width, i
}
cursor = create_xlib_monochrome_cursor( hdc, &info, bm.bmWidth, bm.bmHeight );
}
else DeleteObject( info.hbmColor );
DeleteObject( info.hbmMask );
else NtGdiDeleteObjectApp( info.hbmColor );
NtGdiDeleteObjectApp( info.hbmMask );
}
DestroyCursor( mono );
return cursor;
......@@ -1294,13 +1295,14 @@ static Cursor create_xlib_color_cursor( HDC hdc, const ICONINFOEXW *icon, int wi
info->bmiHeader.biClrImportant = 0;
if (!(mask_bits = HeapAlloc( GetProcessHeap(), 0, info->bmiHeader.biSizeImage ))) goto done;
if (!GetDIBits( hdc, icon->hbmMask, 0, height, mask_bits, info, DIB_RGB_COLORS )) goto done;
if (!NtGdiGetDIBitsInternal( hdc, icon->hbmMask, 0, height, mask_bits, info,
DIB_RGB_COLORS, 0, 0 )) goto done;
info->bmiHeader.biBitCount = 32;
info->bmiHeader.biSizeImage = width * height * 4;
if (!(color_bits = HeapAlloc( GetProcessHeap(), 0, info->bmiHeader.biSizeImage ))) goto done;
if (!(xor_bits = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, width_bytes * height ))) goto done;
GetDIBits( hdc, icon->hbmColor, 0, height, color_bits, info, DIB_RGB_COLORS );
NtGdiGetDIBitsInternal( hdc, icon->hbmColor, 0, height, color_bits, info, DIB_RGB_COLORS, 0, 0 );
/* compute fg/bg color and xor bitmap based on average of the color values */
......@@ -1412,12 +1414,12 @@ static Cursor create_cursor( HANDLE handle )
if (use_system_cursors && (cursor = create_xcursor_system_cursor( &info )))
{
DeleteObject( info.hbmColor );
DeleteObject( info.hbmMask );
NtGdiDeleteObjectApp( info.hbmColor );
NtGdiDeleteObjectApp( info.hbmMask );
return cursor;
}
GetObjectW( info.hbmMask, sizeof(bm), &bm );
NtGdiExtGetObjectW( info.hbmMask, sizeof(bm), &bm );
if (!info.hbmColor) bm.bmHeight = max( 1, bm.bmHeight / 2 );
/* make sure hotspot is valid */
......@@ -1427,7 +1429,7 @@ static Cursor create_cursor( HANDLE handle )
info.yHotspot = bm.bmHeight / 2;
}
hdc = CreateCompatibleDC( 0 );
hdc = NtGdiCreateCompatibleDC( 0 );
if (info.hbmColor)
{
......@@ -1437,15 +1439,15 @@ static Cursor create_cursor( HANDLE handle )
#endif
if (!cursor) cursor = create_xlib_load_mono_cursor( hdc, handle, bm.bmWidth, bm.bmHeight );
if (!cursor) cursor = create_xlib_color_cursor( hdc, &info, bm.bmWidth, bm.bmHeight );
DeleteObject( info.hbmColor );
NtGdiDeleteObjectApp( info.hbmColor );
}
else
{
cursor = create_xlib_monochrome_cursor( hdc, &info, bm.bmWidth, bm.bmHeight );
}
DeleteObject( info.hbmMask );
DeleteDC( hdc );
NtGdiDeleteObjectApp( info.hbmMask );
NtGdiDeleteObjectApp( hdc );
return cursor;
}
......
......@@ -1963,7 +1963,8 @@ static void wglFinish(void)
}
pglFinish();
if (escape.gl_drawable) ExtEscape( ctx->hdc, X11DRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL );
if (escape.gl_drawable)
NtGdiExtEscape( ctx->hdc, NULL, 0, X11DRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL );
}
static void wglFlush(void)
......@@ -1989,7 +1990,8 @@ static void wglFlush(void)
}
pglFlush();
if (escape.gl_drawable) ExtEscape( ctx->hdc, X11DRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL );
if (escape.gl_drawable)
NtGdiExtEscape( ctx->hdc, NULL, 0, X11DRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL );
}
static const GLubyte *wglGetString(GLenum name)
......@@ -2325,12 +2327,12 @@ static HDC X11DRV_wglGetPbufferDCARB( struct wgl_pbuffer *object )
struct gl_drawable *gl, *prev;
HDC hdc;
hdc = CreateDCA( "DISPLAY", NULL, NULL, NULL );
hdc = NtGdiOpenDCW( NULL, NULL, NULL, 0, TRUE, NULL, NULL, NULL );
if (!hdc) return 0;
if (!(gl = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*gl) )))
{
DeleteDC( hdc );
NtGdiDeleteObjectApp( hdc );
return 0;
}
gl->type = DC_GL_PBUFFER;
......@@ -2348,7 +2350,7 @@ static HDC X11DRV_wglGetPbufferDCARB( struct wgl_pbuffer *object )
escape.drawable = object->drawable;
escape.mode = IncludeInferiors;
SetRect( &escape.dc_rect, 0, 0, object->width, object->height );
ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL );
NtGdiExtEscape( hdc, NULL, 0, X11DRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL );
TRACE( "(%p)->(%p)\n", object, hdc );
return hdc;
......@@ -2465,7 +2467,7 @@ static int X11DRV_wglReleasePbufferDCARB( struct wgl_pbuffer *object, HDC hdc )
LeaveCriticalSection( &context_section );
return hdc && DeleteDC(hdc);
return hdc && NtGdiDeleteObjectApp(hdc);
}
/**
......@@ -3372,7 +3374,8 @@ static BOOL WINAPI glxdrv_wglSwapBuffers( HDC hdc )
release_gl_drawable( gl );
if (escape.gl_drawable) ExtEscape( ctx->hdc, X11DRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL );
if (escape.gl_drawable)
NtGdiExtEscape( ctx->hdc, NULL, 0, X11DRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL );
return TRUE;
}
......
......@@ -70,17 +70,17 @@ HPEN CDECL X11DRV_SelectPen( PHYSDEV dev, HPEN hpen, const struct brush_pattern
int i;
EXTLOGPEN *elp = NULL;
if (!GetObjectW( hpen, sizeof(logpen), &logpen ))
if (!NtGdiExtGetObjectW( hpen, sizeof(logpen), &logpen ))
{
/* must be an extended pen */
INT size = GetObjectW( hpen, 0, NULL );
INT size = NtGdiExtGetObjectW( hpen, 0, NULL );
if (!size) return 0;
physDev->pen.ext = 1;
elp = HeapAlloc( GetProcessHeap(), 0, size );
GetObjectW( hpen, size, elp );
NtGdiExtGetObjectW( hpen, size, elp );
logpen.lopnStyle = elp->elpPenStyle;
logpen.lopnWidth.x = elp->elpWidth;
logpen.lopnWidth.y = 0;
......@@ -103,7 +103,7 @@ HPEN CDECL X11DRV_SelectPen( PHYSDEV dev, HPEN hpen, const struct brush_pattern
if (physDev->pen.width == 1) physDev->pen.width = 0; /* Faster */
if (hpen == GetStockObject( DC_PEN ))
logpen.lopnColor = GetDCPenColor( dev->hdc );
NtGdiGetDCDword( dev->hdc, NtGdiGetDCPenColor, &logpen.lopnColor );
physDev->pen.pixel = X11DRV_PALETTE_ToPhysical( physDev, logpen.lopnColor );
switch(logpen.lopnStyle & PS_STYLE_MASK)
{
......@@ -158,7 +158,7 @@ COLORREF CDECL X11DRV_SetDCPenColor( PHYSDEV dev, COLORREF crColor )
{
X11DRV_PDEVICE *physDev = get_x11drv_dev( dev );
if (GetCurrentObject(dev->hdc, OBJ_PEN) == GetStockObject( DC_PEN ))
if (NtGdiGetDCObject( dev->hdc, NTGDI_OBJ_PEN ) == GetStockObject( DC_PEN ))
physDev->pen.pixel = X11DRV_PALETTE_ToPhysical( physDev, crColor );
return crColor;
......
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