/*********************************************************************** * Pie (GDI32.@) */ BOOL WINAPI Pie( HDC hdc, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend ) { BOOL ret; PHYSDEV physdev; DC * dc = get_dc_ptr( hdc ); if (!dc) return FALSE; update_dc( dc ); physdev = GET_DC_PHYSDEV( dc, pPie ); ret = physdev->funcs->pPie( physdev, left, top, right, bottom, xstart, ystart, xend, yend ); release_dc_ptr( dc ); return ret; }
/*********************************************************************** * PolyDraw (GDI32.@) */ BOOL WINAPI PolyDraw(HDC hdc, const POINT *lppt, const BYTE *lpbTypes, DWORD cCount) { DC *dc = get_dc_ptr( hdc ); PHYSDEV physdev; BOOL result; if(!dc) return FALSE; update_dc( dc ); physdev = GET_DC_PHYSDEV( dc, pPolyDraw ); result = physdev->funcs->pPolyDraw( physdev, lppt, lpbTypes, cCount ); release_dc_ptr( dc ); return result; }
/*********************************************************************** * BRUSH_SelectObject */ static HGDIOBJ BRUSH_SelectObject( HGDIOBJ handle, HDC hdc ) { BRUSHOBJ *brush; HGDIOBJ ret = 0; DC *dc = get_dc_ptr( hdc ); if (!dc) { SetLastError( ERROR_INVALID_HANDLE ); return 0; } if ((brush = GDI_GetObjPtr( handle, OBJ_BRUSH ))) { PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSelectBrush ); HBITMAP bitmap = brush->bitmap; BITMAPINFO *info; void *bits; UINT usage; if (bitmap && !brush->info) { BITMAPOBJ *bmp = GDI_GetObjPtr( bitmap, OBJ_BITMAP ); /* fetch the bitmap bits if we are selecting into a different type of DC */ if (bmp && bmp->funcs != physdev->funcs) store_bitmap_bits( brush, bmp ); GDI_ReleaseObj( bitmap ); } info = brush->info; bits = brush->bits.ptr; usage = brush->usage; GDI_inc_ref_count( handle ); GDI_ReleaseObj( handle ); if (!physdev->funcs->pSelectBrush( physdev, handle, bitmap, info, bits, usage )) { GDI_dec_ref_count( handle ); } else { ret = dc->hBrush; dc->hBrush = handle; GDI_dec_ref_count( ret ); } } release_dc_ptr( dc ); return ret; }
/*********************************************************************** * ExcludeClipRect (GDI32.@) */ INT WINAPI ExcludeClipRect( HDC hdc, INT left, INT top, INT right, INT bottom ) { PHYSDEV physdev; INT ret; DC *dc = get_dc_ptr( hdc ); TRACE("%p %d,%d-%d,%d\n", hdc, left, top, right, bottom ); if (!dc) return ERROR; update_dc( dc ); physdev = GET_DC_PHYSDEV( dc, pExcludeClipRect ); ret = physdev->funcs->pExcludeClipRect( physdev, left, top, right, bottom ); release_dc_ptr( dc ); return ret; }
/****************************************************************************** * GdiSwapBuffers [GDI32.@] * * Probably not the correct semantics, it's supposed to be an internal backend for SwapBuffers. */ BOOL WINAPI GdiSwapBuffers( HDC hdc ) { INT bRet = FALSE; DC * dc = get_dc_ptr( hdc ); TRACE("(%p)\n",hdc); if (dc) { PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSwapBuffers ); update_dc( dc ); bRet = physdev->funcs->pSwapBuffers( physdev ); release_dc_ptr( dc ); } return bRet; }
/*********************************************************************** * RoundRect (GDI32.@) */ BOOL WINAPI RoundRect( HDC hdc, INT left, INT top, INT right, INT bottom, INT ell_width, INT ell_height ) { PHYSDEV physdev; BOOL ret; DC *dc = get_dc_ptr( hdc ); TRACE( "%p, (%d, %d)-(%d, %d), %dx%d\n", hdc, left, top, right, bottom, ell_width, ell_height ); if (!dc) return FALSE; update_dc( dc ); physdev = GET_DC_PHYSDEV( dc, pRoundRect ); ret = physdev->funcs->pRoundRect( physdev, left, top, right, bottom, ell_width, ell_height ); release_dc_ptr( dc ); return ret; }
/*********************************************************************** * Rectangle (GDI32.@) */ BOOL WINAPI Rectangle( HDC hdc, INT left, INT top, INT right, INT bottom ) { PHYSDEV physdev; BOOL ret; DC * dc = get_dc_ptr( hdc ); TRACE( "%p, (%d, %d)-(%d, %d)\n", hdc, left, top, right, bottom ); if (!dc) return FALSE; update_dc( dc ); physdev = GET_DC_PHYSDEV( dc, pRectangle ); ret = physdev->funcs->pRectangle( physdev, left, top, right, bottom ); release_dc_ptr( dc ); return ret; }
/*********************************************************************** * Arc (GDI32.@) */ BOOL WINAPI Arc( HDC hdc, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend ) { BOOL ret = FALSE; DC * dc = get_dc_ptr( hdc ); if (dc) { PHYSDEV physdev = GET_DC_PHYSDEV( dc, pArc ); update_dc( dc ); ret = physdev->funcs->pArc( physdev, left, top, right, bottom, xstart, ystart, xend, yend ); release_dc_ptr( dc ); } return ret; }
/********************************************************************** * PolyPolyline (GDI32.@) */ BOOL WINAPI PolyPolyline( HDC hdc, const POINT* pt, const DWORD* counts, DWORD polylines ) { PHYSDEV physdev; BOOL ret; DC * dc = get_dc_ptr( hdc ); TRACE( "%p, %p, %p, %u\n", hdc, pt, counts, polylines ); if (!dc) return FALSE; update_dc( dc ); physdev = GET_DC_PHYSDEV( dc, pPolyPolyline ); ret = physdev->funcs->pPolyPolyline( physdev, pt, counts, polylines ); release_dc_ptr( dc ); return ret; }
/*********************************************************************** * FrameRgn (GDI32.@) */ BOOL WINAPI FrameRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush, INT nWidth, INT nHeight ) { PHYSDEV physdev; BOOL ret; DC *dc = get_dc_ptr( hdc ); TRACE( "%p, %p, %p, %dx%d\n", hdc, hrgn, hbrush, nWidth, nHeight ); if (!dc) return FALSE; update_dc( dc ); physdev = GET_DC_PHYSDEV( dc, pFrameRgn ); ret = physdev->funcs->pFrameRgn( physdev, hrgn, hbrush, nWidth, nHeight ); release_dc_ptr( dc ); return ret; }
/*********************************************************************** * wglCreateContext (OPENGL32.@) */ HGLRC WINAPI wglCreateContext(HDC hdc) { HGLRC ret = 0; DC * dc = get_dc_ptr( hdc ); TRACE("(%p)\n",hdc); if (dc) { PHYSDEV physdev = GET_DC_PHYSDEV( dc, pwglCreateContext ); update_dc( dc ); ret = physdev->funcs->pwglCreateContext( physdev ); release_dc_ptr( dc ); } return ret; }
/********************************************************************** * ExtFloodFill (GDI32.@) */ BOOL WINAPI ExtFloodFill( HDC hdc, INT x, INT y, COLORREF color, UINT fillType ) { PHYSDEV physdev; BOOL ret; DC * dc = get_dc_ptr( hdc ); TRACE( "%p, (%d, %d), %08x, %x\n", hdc, x, y, color, fillType ); if (!dc) return FALSE; update_dc( dc ); physdev = GET_DC_PHYSDEV( dc, pExtFloodFill ); ret = physdev->funcs->pExtFloodFill( physdev, x, y, color, fillType ); release_dc_ptr( dc ); return ret; }
/************************************************************************************** * WINE-specific wglSetPixelFormat which can set the iPixelFormat multiple times * */ static BOOL WINAPI wglSetPixelFormatWINE(HDC hdc, int iPixelFormat, const PIXELFORMATDESCRIPTOR *ppfd) { INT bRet = FALSE; DC * dc = get_dc_ptr( hdc ); TRACE("(%p,%d,%p)\n", hdc, iPixelFormat, ppfd); if (dc) { PHYSDEV physdev = GET_DC_PHYSDEV( dc, pwglSetPixelFormatWINE ); update_dc( dc ); bRet = physdev->funcs->pwglSetPixelFormatWINE( physdev, iPixelFormat, ppfd ); release_dc_ptr( dc ); } return bRet; }
/*********************************************************************** * wglCreateContextAttribsARB */ static HGLRC WINAPI wglCreateContextAttribsARB(HDC hdc, HGLRC hShareContext, const int *attributeList) { HGLRC ret = 0; DC * dc = get_dc_ptr( hdc ); TRACE("(%p)\n",hdc); if (dc) { PHYSDEV physdev = GET_DC_PHYSDEV( dc, pwglCreateContextAttribsARB ); update_dc( dc ); ret = physdev->funcs->pwglCreateContextAttribsARB( physdev, hShareContext, attributeList ); release_dc_ptr( dc ); } return ret; }
/********************************************************************** * ExtFloodFill (GDI32.@) */ BOOL WINAPI ExtFloodFill( HDC hdc, INT x, INT y, COLORREF color, UINT fillType ) { BOOL ret = FALSE; DC * dc = get_dc_ptr( hdc ); if (dc) { PHYSDEV physdev = GET_DC_PHYSDEV( dc, pExtFloodFill ); update_dc( dc ); ret = physdev->funcs->pExtFloodFill( physdev, x, y, color, fillType ); release_dc_ptr( dc ); } return ret; }
/****************************************************************************** * GdiDescribePixelFormat [GDI32.@] * * Probably not the correct semantics, it's supposed to be an internal backend for DescribePixelFormat. */ INT WINAPI GdiDescribePixelFormat( HDC hdc, INT iPixelFormat, UINT nBytes, LPPIXELFORMATDESCRIPTOR ppfd ) { INT ret = 0; DC * dc = get_dc_ptr( hdc ); TRACE("(%p,%d,%d,%p): stub\n",hdc,iPixelFormat,nBytes,ppfd); if (dc) { PHYSDEV physdev = GET_DC_PHYSDEV( dc, pDescribePixelFormat ); update_dc( dc ); ret = physdev->funcs->pDescribePixelFormat( physdev, iPixelFormat, nBytes, ppfd ); release_dc_ptr( dc ); } return ret; }
/*********************************************************************** * PatBlt (GDI32.@) */ BOOL WINAPI PatBlt( HDC hdc, INT left, INT top, INT width, INT height, DWORD rop) { DC * dc; BOOL bRet = FALSE; TRACE("%p %d,%d %dx%d %06x\n", hdc, left, top, width, height, rop ); if (rop_uses_src( rop )) return FALSE; if ((dc = get_dc_ptr( hdc ))) { PHYSDEV physdev = GET_DC_PHYSDEV( dc, pPatBlt ); update_dc( dc ); bRet = physdev->funcs->pPatBlt( physdev, left, top, width, height, rop ); release_dc_ptr( dc ); } return bRet; }
/*********************************************************************** * Chord (GDI32.@) */ BOOL WINAPI Chord( HDC hdc, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend ) { BOOL ret; PHYSDEV physdev; DC * dc = get_dc_ptr( hdc ); TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc, left, top, right, bottom, xstart, ystart, xend, yend ); if (!dc) return FALSE; update_dc( dc ); physdev = GET_DC_PHYSDEV( dc, pChord ); ret = physdev->funcs->pChord( physdev, left, top, right, bottom, xstart, ystart, xend, yend ); release_dc_ptr( dc ); return ret; }
/****************************************************************************** * PolyBezier [GDI32.@] * Draws one or more Bezier curves * * PARAMS * hDc [I] Handle to device context * lppt [I] Pointer to endpoints and control points * cPoints [I] Count of endpoints and control points * * RETURNS * Success: TRUE * Failure: FALSE */ BOOL WINAPI PolyBezier( HDC hdc, const POINT* lppt, DWORD cPoints ) { PHYSDEV physdev; BOOL ret; DC * dc; /* cPoints must be 3 * n + 1 (where n>=1) */ if (cPoints == 1 || (cPoints % 3) != 1) return FALSE; dc = get_dc_ptr( hdc ); if(!dc) return FALSE; update_dc( dc ); physdev = GET_DC_PHYSDEV( dc, pPolyBezier ); ret = physdev->funcs->pPolyBezier( physdev, lppt, cPoints ); release_dc_ptr( dc ); return ret; }
/*********************************************************************** * LineTo (GDI32.@) */ BOOL WINAPI LineTo( HDC hdc, INT x, INT y ) { DC * dc = get_dc_ptr( hdc ); PHYSDEV physdev; BOOL ret; if(!dc) return FALSE; update_dc( dc ); physdev = GET_DC_PHYSDEV( dc, pLineTo ); ret = physdev->funcs->pLineTo( physdev, x, y ); if(ret) { dc->CursPosX = x; dc->CursPosY = y; } release_dc_ptr( dc ); return ret; }
/*********************************************************************** * GetSystemPaletteEntries [GDI32.@] * * Gets range of palette entries. * * RETURNS * Success: Number of entries retrieved from palette * Failure: 0 */ UINT WINAPI GetSystemPaletteEntries( HDC hdc, /* [in] Handle of device context */ UINT start, /* [in] Index of first entry to be retrieved */ UINT count, /* [in] Number of entries to be retrieved */ LPPALETTEENTRY entries) /* [out] Array receiving system-palette entries */ { UINT ret = 0; DC *dc; TRACE("hdc=%p,start=%i,count=%i\n", hdc,start,count); if ((dc = get_dc_ptr( hdc ))) { PHYSDEV physdev = GET_DC_PHYSDEV( dc, pGetSystemPaletteEntries ); ret = physdev->funcs->pGetSystemPaletteEntries( physdev, start, count, entries ); release_dc_ptr( dc ); } return ret; }
/*********************************************************************** * wglShareLists (OPENGL32.@) */ BOOL WINAPI wglShareLists(HGLRC hglrc1, HGLRC hglrc2) { DC *dc; BOOL ret = FALSE; OPENGL_Context ctx = (OPENGL_Context)hglrc1; TRACE("hglrc1: (%p); hglrc: (%p)\n", hglrc1, hglrc2); if(ctx == NULL || hglrc2 == NULL) return FALSE; /* Retrieve the HDC associated with the context to access the display driver */ dc = get_dc_ptr(ctx->hdc); if (dc) { PHYSDEV physdev = GET_DC_PHYSDEV( dc, pwglShareLists ); ret = physdev->funcs->pwglShareLists( hglrc1, hglrc2 ); release_dc_ptr( dc ); } return ret; }
/*********************************************************************** * PolyDraw (GDI32.@) */ BOOL WINAPI PolyDraw(HDC hdc, const POINT *lppt, const BYTE *lpbTypes, DWORD cCount) { DC *dc = get_dc_ptr( hdc ); PHYSDEV physdev; BOOL result; TRACE( "%p, %p, %p, %u\n", hdc, lppt, lpbTypes, cCount ); if(!dc) return FALSE; update_dc( dc ); physdev = GET_DC_PHYSDEV( dc, pPolyDraw ); result = physdev->funcs->pPolyDraw( physdev, lppt, lpbTypes, cCount ); if (result && cCount) dc->cur_pos = lppt[cCount - 1]; release_dc_ptr( dc ); return result; }
/********************************************************************** * PolylineTo (GDI32.@) */ BOOL WINAPI PolylineTo( HDC hdc, const POINT* pt, DWORD cCount ) { DC * dc = get_dc_ptr( hdc ); PHYSDEV physdev; BOOL ret; TRACE( "%p, %p, %u\n", hdc, pt, cCount ); if(!dc) return FALSE; update_dc( dc ); physdev = GET_DC_PHYSDEV( dc, pPolylineTo ); ret = physdev->funcs->pPolylineTo( physdev, pt, cCount ); if (ret && cCount) dc->cur_pos = pt[cCount - 1]; release_dc_ptr( dc ); return ret; }
/*********************************************************************** * MoveToEx (GDI32.@) */ BOOL WINAPI MoveToEx( HDC hdc, INT x, INT y, LPPOINT pt ) { BOOL ret; PHYSDEV physdev; DC * dc = get_dc_ptr( hdc ); if(!dc) return FALSE; if(pt) { pt->x = dc->CursPosX; pt->y = dc->CursPosY; } dc->CursPosX = x; dc->CursPosY = y; physdev = GET_DC_PHYSDEV( dc, pMoveTo ); ret = physdev->funcs->pMoveTo( physdev, x, y ); release_dc_ptr( dc ); return ret; }
/********************************************************************** * PolylineTo (GDI32.@) */ BOOL WINAPI PolylineTo( HDC hdc, const POINT* pt, DWORD cCount ) { DC * dc = get_dc_ptr( hdc ); PHYSDEV physdev; BOOL ret; if(!dc) return FALSE; update_dc( dc ); physdev = GET_DC_PHYSDEV( dc, pPolylineTo ); ret = physdev->funcs->pPolylineTo( physdev, pt, cCount ); if (ret && cCount) { dc->CursPosX = pt[cCount-1].x; dc->CursPosY = pt[cCount-1].y; } release_dc_ptr( dc ); return ret; }
/*********************************************************************** * wglCopyContext (OPENGL32.@) */ BOOL WINAPI wglCopyContext(HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask) { DC *dc; BOOL ret = FALSE; OPENGL_Context ctx = (OPENGL_Context)hglrcSrc; TRACE("hglrcSrc: (%p), hglrcDst: (%p), mask: %#x\n", hglrcSrc, hglrcDst, mask); /* If no context is set, this call doesn't have a purpose */ if(!hglrcSrc || !hglrcDst) return FALSE; /* Retrieve the HDC associated with the context to access the display driver */ dc = get_dc_ptr(ctx->hdc); if (dc) { PHYSDEV physdev = GET_DC_PHYSDEV( dc, pwglCopyContext ); ret = physdev->funcs->pwglCopyContext(hglrcSrc, hglrcDst, mask); release_dc_ptr( dc ); } return ret; }
/*********************************************************************** * SetWorldTransform (GDI32.@) */ BOOL WINAPI SetWorldTransform( HDC hdc, const XFORM *xform ) { BOOL ret = FALSE; DC *dc; if (!xform) return FALSE; /* The transform must conform to (eM11 * eM22 != eM12 * eM21) requirement */ if (xform->eM11 * xform->eM22 == xform->eM12 * xform->eM21) return FALSE; TRACE("eM11 %f eM12 %f eM21 %f eM22 %f eDx %f eDy %f\n", xform->eM11, xform->eM12, xform->eM21, xform->eM22, xform->eDx, xform->eDy); if ((dc = get_dc_ptr( hdc ))) { PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetWorldTransform ); if (dc->GraphicsMode == GM_ADVANCED) ret = physdev->funcs->pSetWorldTransform( physdev, xform ); release_dc_ptr( dc ); } return ret; }
/*********************************************************************** * MoveToEx (GDI32.@) */ BOOL WINAPI MoveToEx( HDC hdc, INT x, INT y, LPPOINT pt ) { BOOL ret; PHYSDEV physdev; DC * dc = get_dc_ptr( hdc ); TRACE( "%p, (%d, %d), %p\n", hdc, x, y, pt ); if(!dc) return FALSE; if(pt) *pt = dc->cur_pos; dc->cur_pos.x = x; dc->cur_pos.y = y; physdev = GET_DC_PHYSDEV( dc, pMoveTo ); ret = physdev->funcs->pMoveTo( physdev, x, y ); release_dc_ptr( dc ); return ret; }
/*********************************************************************** * LineTo (GDI32.@) */ BOOL WINAPI LineTo( HDC hdc, INT x, INT y ) { DC * dc = get_dc_ptr( hdc ); PHYSDEV physdev; BOOL ret; TRACE( "%p, (%d, %d)\n", hdc, x, y ); if(!dc) return FALSE; update_dc( dc ); physdev = GET_DC_PHYSDEV( dc, pLineTo ); ret = physdev->funcs->pLineTo( physdev, x, y ); if(ret) { dc->cur_pos.x = x; dc->cur_pos.y = y; } release_dc_ptr( dc ); return ret; }