diff --git a/dlls/gdi32/bitblt.c b/dlls/gdi32/bitblt.c index 2506c02b403..ebed7af01d4 100644 --- a/dlls/gdi32/bitblt.c +++ b/dlls/gdi32/bitblt.c @@ -300,7 +300,7 @@ BOOL nulldrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst, ((src->width != dst->width) || (src->height != dst->height))) { copy_bitmapinfo( src_info, dst_info ); - err = stretch_bits( src_info, src, dst_info, dst, &bits, GetStretchBltMode( dst_dev->hdc )); + err = stretch_bits( src_info, src, dst_info, dst, &bits, dc_dst->stretchBltMode ); if (!err) err = dst_dev->funcs->pPutImage( dst_dev, 0, dst_info, &bits, src, dst, rop ); } @@ -933,12 +933,12 @@ BOOL WINAPI GdiAlphaBlend(HDC hdcDst, int xDst, int yDst, int widthDst, int heig src.log_y = ySrc; src.log_width = widthSrc; src.log_height = heightSrc; - src.layout = GetLayout( hdcSrc ); + src.layout = dcSrc->layout; dst.log_x = xDst; dst.log_y = yDst; dst.log_width = widthDst; dst.log_height = heightDst; - dst.layout = GetLayout( hdcDst ); + dst.layout = dcDst->layout; ret = !get_vis_rectangles( dcDst, &dst, dcSrc, &src ); TRACE("src %p log=%d,%d %dx%d phys=%d,%d %dx%d vis=%s dst %p log=%d,%d %dx%d phys=%d,%d %dx%d vis=%s blend=%02x/%02x/%02x/%02x\n", diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c index c47729db0a1..585d2ac0d48 100644 --- a/dlls/gdi32/dib.c +++ b/dlls/gdi32/dib.c @@ -600,7 +600,7 @@ INT nulldrv_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst, INT he if (err == ERROR_TRANSFORM_NOT_SUPPORTED) { copy_bitmapinfo( src_info, dst_info ); - err = stretch_bits( src_info, &src, dst_info, &dst, &src_bits, GetStretchBltMode( dev->hdc ) ); + err = stretch_bits( src_info, &src, dst_info, &dst, &src_bits, dc->stretchBltMode ); if (!err) err = dev->funcs->pPutImage( dev, NULL, dst_info, &src_bits, &src, &dst, rop ); } if (err) ret = 0; @@ -853,7 +853,7 @@ INT nulldrv_SetDIBitsToDevice( PHYSDEV dev, INT x_dst, INT y_dst, DWORD cx, DWOR dst.y = pt.y; dst.width = cx; dst.height = cy; - if (GetLayout( dev->hdc ) & LAYOUT_RTL) dst.x -= cx - 1; + if (dc->layout & LAYOUT_RTL) dst.x -= cx - 1; rect.left = dst.x; rect.top = dst.y; diff --git a/dlls/gdi32/enhmfdrv/graphics.c b/dlls/gdi32/enhmfdrv/graphics.c index 7aaff9d61a7..68bf4d29d4c 100644 --- a/dlls/gdi32/enhmfdrv/graphics.c +++ b/dlls/gdi32/enhmfdrv/graphics.c @@ -69,16 +69,14 @@ static void *store_points( POINTL *dest, const POINT *pts, UINT count, BOOL shor } /* compute the bounds of an array of points, optionally including the current position */ -static void get_points_bounds( RECTL *bounds, const POINT *pts, UINT count, HDC hdc ) +static void get_points_bounds( RECTL *bounds, const POINT *pts, UINT count, DC *dc ) { UINT i; - if (hdc) + if (dc) { - POINT cur_pt; - GetCurrentPositionEx( hdc, &cur_pt ); - bounds->left = bounds->right = cur_pt.x; - bounds->top = bounds->bottom = cur_pt.y; + bounds->left = bounds->right = dc->cur_pos.x; + bounds->top = bounds->bottom = dc->cur_pos.y; } else if (count) { @@ -143,6 +141,7 @@ BOOL EMFDRV_MoveTo(PHYSDEV dev, INT x, INT y) BOOL EMFDRV_LineTo( PHYSDEV dev, INT x, INT y ) { EMFDRV_PDEVICE *physDev = get_emf_physdev( dev ); + DC *dc = get_physdev_dc( dev ); POINT pt; EMRLINETO emr; RECTL bounds; @@ -155,7 +154,7 @@ BOOL EMFDRV_LineTo( PHYSDEV dev, INT x, INT y ) if(!EMFDRV_WriteRecord( dev, &emr.emr )) return FALSE; - GetCurrentPositionEx( dev->hdc, &pt ); + pt = dc->cur_pos; bounds.left = min(x, pt.x); bounds.top = min(y, pt.y); @@ -177,6 +176,7 @@ EMFDRV_ArcChordPie( PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend, DWORD iType ) { EMFDRV_PDEVICE *physDev = get_emf_physdev( dev ); + DC *dc = get_physdev_dc( dev ); INT temp, xCentre, yCentre, i; double angleStart, angleEnd; double xinterStart, yinterStart, xinterEnd, yinterEnd; @@ -188,7 +188,7 @@ EMFDRV_ArcChordPie( PHYSDEV dev, INT left, INT top, INT right, INT bottom, if(left > right) {temp = left; left = right; right = temp;} if(top > bottom) {temp = top; top = bottom; bottom = temp;} - if(GetGraphicsMode(dev->hdc) == GM_COMPATIBLE) { + if(dc->GraphicsMode == GM_COMPATIBLE) { right--; bottom--; } @@ -269,7 +269,7 @@ EMFDRV_ArcChordPie( PHYSDEV dev, INT left, INT top, INT right, INT bottom, if (iType == EMR_ARCTO) { POINT pt; - GetCurrentPositionEx( dev->hdc, &pt ); + pt = dc->cur_pos; bounds.left = min( bounds.left, pt.x ); bounds.top = min( bounds.top, pt.y ); bounds.right = max( bounds.right, pt.x ); @@ -348,6 +348,7 @@ BOOL EMFDRV_AngleArc( PHYSDEV dev, INT x, INT y, DWORD radius, FLOAT start, FLOA BOOL EMFDRV_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) { EMFDRV_PDEVICE *physDev = get_emf_physdev( dev ); + DC *dc = get_physdev_dc( dev ); EMRELLIPSE emr; INT temp; @@ -358,7 +359,7 @@ BOOL EMFDRV_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) if(left > right) {temp = left; left = right; right = temp;} if(top > bottom) {temp = top; top = bottom; bottom = temp;} - if(GetGraphicsMode( dev->hdc ) == GM_COMPATIBLE) { + if(dc->GraphicsMode == GM_COMPATIBLE) { right--; bottom--; } @@ -381,6 +382,7 @@ BOOL EMFDRV_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) BOOL EMFDRV_Rectangle(PHYSDEV dev, INT left, INT top, INT right, INT bottom) { EMFDRV_PDEVICE *physDev = get_emf_physdev( dev ); + DC *dc = get_physdev_dc( dev ); EMRRECTANGLE emr; INT temp; @@ -391,7 +393,7 @@ BOOL EMFDRV_Rectangle(PHYSDEV dev, INT left, INT top, INT right, INT bottom) if(left > right) {temp = left; left = right; right = temp;} if(top > bottom) {temp = top; top = bottom; bottom = temp;} - if(GetGraphicsMode( dev->hdc ) == GM_COMPATIBLE) { + if(dc->GraphicsMode == GM_COMPATIBLE) { right--; bottom--; } @@ -415,6 +417,7 @@ BOOL EMFDRV_RoundRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT ell_width, INT ell_height ) { EMFDRV_PDEVICE *physDev = get_emf_physdev( dev ); + DC *dc = get_physdev_dc( dev ); EMRROUNDRECT emr; INT temp; @@ -423,7 +426,7 @@ BOOL EMFDRV_RoundRect( PHYSDEV dev, INT left, INT top, INT right, if(left > right) {temp = left; left = right; right = temp;} if(top > bottom) {temp = top; top = bottom; bottom = temp;} - if(GetGraphicsMode( dev->hdc ) == GM_COMPATIBLE) { + if(dc->GraphicsMode == GM_COMPATIBLE) { right--; bottom--; } @@ -474,6 +477,7 @@ static BOOL EMFDRV_Polylinegon( PHYSDEV dev, const POINT* pt, INT count, DWORD iType ) { EMFDRV_PDEVICE *physDev = get_emf_physdev( dev ); + DC *dc = get_physdev_dc( dev ); EMRPOLYLINE *emr; DWORD size; BOOL ret, use_small_emr = can_use_short_points( pt, count ); @@ -489,7 +493,7 @@ EMFDRV_Polylinegon( PHYSDEV dev, const POINT* pt, INT count, DWORD iType ) if (!physDev->path) get_points_bounds( &emr->rclBounds, pt, count, - (iType == EMR_POLYBEZIERTO || iType == EMR_POLYLINETO) ? dev->hdc : 0 ); + (iType == EMR_POLYBEZIERTO || iType == EMR_POLYLINETO) ? dc : 0 ); else emr->rclBounds = empty_bounds; @@ -799,13 +803,14 @@ BOOL EMFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *lprec LPCWSTR str, UINT count, const INT *lpDx ) { EMFDRV_PDEVICE *physDev = get_emf_physdev( dev ); + DC *dc = get_physdev_dc( dev ); EMREXTTEXTOUTW *pemr; DWORD nSize; BOOL ret; int textHeight = 0; int textWidth = 0; - const UINT textAlign = GetTextAlign( dev->hdc ); - const INT graphicsMode = GetGraphicsMode( dev->hdc ); + const UINT textAlign = dc->textAlign; + const INT graphicsMode = dc->GraphicsMode; FLOAT exScale, eyScale; nSize = sizeof(*pemr) + ((count+1) & ~1) * sizeof(WCHAR) + count * sizeof(INT); diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index 0dad0243ece..1155ee4e8e0 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -1961,7 +1961,7 @@ BOOL nulldrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *rect if (flags & ETO_OPAQUE) { RECT rc = *rect; - HBRUSH brush = CreateSolidBrush( GetNearestColor( dev->hdc, GetBkColor(dev->hdc) )); + HBRUSH brush = CreateSolidBrush( GetNearestColor( dev->hdc, dc->backgroundColor ) ); if (brush) { @@ -2052,7 +2052,7 @@ BOOL nulldrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *rect } } - pen = CreatePen( PS_SOLID, 1, GetTextColor(dev->hdc) ); + pen = CreatePen( PS_SOLID, 1, dc->textColor ); orig = SelectObject( dev->hdc, pen ); for (i = 0; i < count; i++) @@ -2194,8 +2194,8 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags, BOOL ret = FALSE; LPWSTR reordered_str = (LPWSTR)str; WORD *glyphs = NULL; - UINT align = GetTextAlign( hdc ); - DWORD layout = GetLayout( hdc ); + UINT align; + DWORD layout; POINT pt; TEXTMETRICW tm; LOGFONTW lf; @@ -2212,7 +2212,9 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags, if (!dc) return FALSE; + align = dc->textAlign; breakRem = dc->breakRem; + layout = dc->layout; if (quietfixme == 0 && flags & (ETO_NUMERICSLOCAL | ETO_NUMERICSLATIN)) { @@ -2259,11 +2261,11 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags, TRACE("%p, %d, %d, %08x, %s, %s, %d, %p)\n", hdc, x, y, flags, wine_dbgstr_rect(lprect), debugstr_wn(str, count), count, lpDx); - TRACE("align = %x bkmode = %x mapmode = %x\n", align, GetBkMode(hdc), GetMapMode(hdc)); + TRACE("align = %x bkmode = %x mapmode = %x\n", align, dc->backgroundMode, dc->MapMode); if(align & TA_UPDATECP) { - GetCurrentPositionEx( hdc, &pt ); + pt = dc->cur_pos; x = pt.x; y = pt.y; } @@ -2463,7 +2465,7 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags, break; } - if (GetBkMode(hdc) != TRANSPARENT) + if (dc->backgroundMode != TRANSPARENT) { if(!((flags & ETO_CLIPPED) && (flags & ETO_OPAQUE))) { @@ -2502,7 +2504,7 @@ done: OUTLINETEXTMETRICW* otm = NULL; POINT pts[5]; HPEN hpen = SelectObject(hdc, GetStockObject(NULL_PEN)); - HBRUSH hbrush = CreateSolidBrush(GetTextColor(hdc)); + HBRUSH hbrush = CreateSolidBrush(dc->textColor); hbrush = SelectObject(hdc, hbrush); diff --git a/dlls/gdi32/painting.c b/dlls/gdi32/painting.c index 1ddaaf6abb6..b12f3129e2c 100644 --- a/dlls/gdi32/painting.c +++ b/dlls/gdi32/painting.c @@ -124,12 +124,13 @@ BOOL nulldrv_PolyBezier( PHYSDEV dev, const POINT *points, DWORD count ) BOOL nulldrv_PolyBezierTo( PHYSDEV dev, const POINT *points, DWORD count ) { + DC *dc = get_nulldrv_dc( dev ); BOOL ret = FALSE; POINT *pts = HeapAlloc( GetProcessHeap(), 0, sizeof(POINT) * (count + 1) ); if (pts) { - GetCurrentPositionEx( dev->hdc, &pts[0] ); + pts[0] = dc->cur_pos; memcpy( pts + 1, points, sizeof(POINT) * count ); ret = PolyBezier( dev->hdc, pts, count + 1 ); HeapFree( GetProcessHeap(), 0, pts ); @@ -139,6 +140,7 @@ BOOL nulldrv_PolyBezierTo( PHYSDEV dev, const POINT *points, DWORD count ) BOOL nulldrv_PolyDraw( PHYSDEV dev, const POINT *points, const BYTE *types, DWORD count ) { + DC *dc = get_nulldrv_dc( dev ); POINT *line_pts = NULL, *bzr_pts = NULL, bzr[4]; DWORD i; INT num_pts, num_bzr_pts, space, size; @@ -167,7 +169,7 @@ BOOL nulldrv_PolyDraw( PHYSDEV dev, const POINT *points, const BYTE *types, DWOR line_pts = HeapAlloc( GetProcessHeap(), 0, space * sizeof(POINT) ); num_pts = 1; - GetCurrentPositionEx( dev->hdc, &line_pts[0] ); + line_pts[0] = dc->cur_pos; for (i = 0; i < count; i++) { switch (types[i]) @@ -211,13 +213,14 @@ BOOL nulldrv_PolyDraw( PHYSDEV dev, const POINT *points, const BYTE *types, DWOR BOOL nulldrv_PolylineTo( PHYSDEV dev, const POINT *points, INT count ) { + DC *dc = get_nulldrv_dc( dev ); BOOL ret = FALSE; POINT *pts; if (!count) return FALSE; if ((pts = HeapAlloc( GetProcessHeap(), 0, sizeof(POINT) * (count + 1) ))) { - GetCurrentPositionEx( dev->hdc, &pts[0] ); + pts[0] = dc->cur_pos; memcpy( pts + 1, points, sizeof(POINT) * count ); ret = Polyline( dev->hdc, pts, count + 1 ); HeapFree( GetProcessHeap(), 0, pts );