Get rid of a few more references to the DC structure.

This commit is contained in:
Alexandre Julliard 2004-02-13 04:00:29 +00:00
parent a4626a43f5
commit da6214a37d
3 changed files with 34 additions and 25 deletions

View File

@ -1133,8 +1133,6 @@ static BOOL BITBLT_GetVisRectangles( X11DRV_PDEVICE *physDevDst, INT xDst, INT y
RECT *visRectSrc, RECT *visRectDst ) RECT *visRectSrc, RECT *visRectDst )
{ {
RECT rect, clipRect; RECT rect, clipRect;
DC *dcSrc = physDevSrc ? physDevSrc->dc : NULL;
DC *dcDst = physDevDst->dc;
/* Get the destination visible rectangle */ /* Get the destination visible rectangle */
@ -1144,7 +1142,7 @@ static BOOL BITBLT_GetVisRectangles( X11DRV_PDEVICE *physDevDst, INT xDst, INT y
rect.bottom = yDst + heightDst; rect.bottom = yDst + heightDst;
if (widthDst < 0) SWAP_INT32( &rect.left, &rect.right ); if (widthDst < 0) SWAP_INT32( &rect.left, &rect.right );
if (heightDst < 0) SWAP_INT32( &rect.top, &rect.bottom ); if (heightDst < 0) SWAP_INT32( &rect.top, &rect.bottom );
GetRgnBox( dcDst->hGCClipRgn, &clipRect ); GetRgnBox( physDevDst->dc->hGCClipRgn, &clipRect );
if (!IntersectRect( visRectDst, &rect, &clipRect )) return FALSE; if (!IntersectRect( visRectDst, &rect, &clipRect )) return FALSE;
/* Get the source visible rectangle */ /* Get the source visible rectangle */
@ -1157,8 +1155,15 @@ static BOOL BITBLT_GetVisRectangles( X11DRV_PDEVICE *physDevDst, INT xDst, INT y
if (widthSrc < 0) SWAP_INT32( &rect.left, &rect.right ); if (widthSrc < 0) SWAP_INT32( &rect.left, &rect.right );
if (heightSrc < 0) SWAP_INT32( &rect.top, &rect.bottom ); if (heightSrc < 0) SWAP_INT32( &rect.top, &rect.bottom );
/* Apparently the clipping and visible regions are only for output, /* Apparently the clipping and visible regions are only for output,
so just check against totalExtent here to avoid BadMatch errors */ so just check against dc extent here to avoid BadMatch errors */
if (!IntersectRect( visRectSrc, &rect, &dcSrc->totalExtent )) if (GetObjectType( physDevSrc->hdc ) == OBJ_MEMDC)
{
BITMAP bm;
GetObjectW( GetCurrentObject(physDevSrc->hdc,OBJ_BITMAP), sizeof(bm), &bm );
SetRect( &clipRect, 0, 0, bm.bmWidth, bm.bmHeight );
}
else SetRect( &clipRect, 0, 0, screen_width, screen_height );
if (!IntersectRect( visRectSrc, &rect, &clipRect ))
return FALSE; return FALSE;
/* Intersect the rectangles */ /* Intersect the rectangles */

View File

@ -59,6 +59,7 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
POINT pt; POINT pt;
DC *dc = physDev->dc; DC *dc = physDev->dc;
UINT align = GetTextAlign( physDev->hdc ); UINT align = GetTextAlign( physDev->hdc );
INT charExtra = GetTextCharacterExtra( physDev->hdc );
if(dc->gdiFont) if(dc->gdiFont)
return X11DRV_XRender_ExtTextOut(physDev, x, y, flags, lprect, wstr, count, return X11DRV_XRender_ExtTextOut(physDev, x, y, flags, lprect, wstr, count,
@ -261,7 +262,7 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
wine_tsx11_unlock(); wine_tsx11_unlock();
if(!rotated) if(!rotated)
{ {
if (!dc->charExtra && !dc->breakExtra && !lpDx) if (!charExtra && !dc->breakExtra && !lpDx)
{ {
X11DRV_cptable[pfo->fi->cptable].pDrawString( X11DRV_cptable[pfo->fi->cptable].pDrawString(
pfo, gdi_display, physDev->drawable, physDev->gc, pfo, gdi_display, physDev->drawable, physDev->gc,
@ -326,7 +327,7 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
do do
{ {
delta += dc->charExtra; delta += charExtra;
if (str2b[i].byte2 == (char)dfBreakChar) if (str2b[i].byte2 == (char)dfBreakChar)
delta += dc->breakExtra; delta += dc->breakExtra;
pitem->nchars++; pitem->nchars++;
@ -369,7 +370,7 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
font->per_char[char_metric_offset].attributes: font->per_char[char_metric_offset].attributes:
font->min_bounds.attributes) font->min_bounds.attributes)
* pfo->lpX11Trans->pixelsize / 1000.0; * pfo->lpX11Trans->pixelsize / 1000.0;
offset += dc->charExtra; offset += charExtra;
if (str2b[i].byte2 == (char)dfBreakChar) if (str2b[i].byte2 == (char)dfBreakChar)
offset += dc->breakExtra; offset += dc->breakExtra;
} }
@ -434,6 +435,7 @@ BOOL X11DRV_GetTextExtentPoint( X11DRV_PDEVICE *physDev, LPCWSTR str, INT count,
TRACE("%s %d\n", debugstr_wn(str,count), count); TRACE("%s %d\n", debugstr_wn(str,count), count);
if( pfo ) { if( pfo ) {
INT charExtra = GetTextCharacterExtra( physDev->hdc );
XChar2b *p = X11DRV_cptable[pfo->fi->cptable].punicode_to_char2b( pfo, str, count ); XChar2b *p = X11DRV_cptable[pfo->fi->cptable].punicode_to_char2b( pfo, str, count );
if (!p) return FALSE; if (!p) return FALSE;
if( !pfo->lpX11Trans ) { if( !pfo->lpX11Trans ) {
@ -443,7 +445,7 @@ BOOL X11DRV_GetTextExtentPoint( X11DRV_PDEVICE *physDev, LPCWSTR str, INT count,
count, &dir, &ascent, &descent, &info_width ); count, &dir, &ascent, &descent, &info_width );
size->cx = fabs((FLOAT)(info_width + dc->breakRem + count * size->cx = fabs((FLOAT)(info_width + dc->breakRem + count *
dc->charExtra) * dc->xformVport2World.eM11); charExtra) * dc->xformVport2World.eM11);
size->cy = fabs((FLOAT)(pfo->fs->ascent + pfo->fs->descent) * size->cy = fabs((FLOAT)(pfo->fs->ascent + pfo->fs->descent) *
dc->xformVport2World.eM22); dc->xformVport2World.eM22);
} else { } else {
@ -459,7 +461,7 @@ BOOL X11DRV_GetTextExtentPoint( X11DRV_PDEVICE *physDev, LPCWSTR str, INT count,
TRACE("x = %f y = %f\n", x, y); TRACE("x = %f y = %f\n", x, y);
x *= pfo->lpX11Trans->pixelsize / 1000.0; x *= pfo->lpX11Trans->pixelsize / 1000.0;
y *= pfo->lpX11Trans->pixelsize / 1000.0; y *= pfo->lpX11Trans->pixelsize / 1000.0;
size->cx = fabs((x + dc->breakRem + count * dc->charExtra) * size->cx = fabs((x + dc->breakRem + count * charExtra) *
dc->xformVport2World.eM11); dc->xformVport2World.eM11);
size->cy = fabs(y * dc->xformVport2World.eM22); size->cy = fabs(y * dc->xformVport2World.eM22);
} }

View File

@ -949,11 +949,11 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
gsCacheEntry *entry; gsCacheEntry *entry;
BOOL retv = FALSE; BOOL retv = FALSE;
HDC hdc = physDev->hdc; HDC hdc = physDev->hdc;
DC *dc = physDev->dc;
int textPixel, backgroundPixel; int textPixel, backgroundPixel;
INT *deltas = NULL; INT *deltas = NULL;
INT char_extra; INT char_extra;
UINT align = GetTextAlign( hdc ); UINT align = GetTextAlign( hdc );
COLORREF textColor = GetTextColor( hdc );
TRACE("%p, %d, %d, %08x, %p, %s, %d, %p)\n", hdc, x, y, flags, TRACE("%p, %d, %d, %08x, %p, %s, %d, %p)\n", hdc, x, y, flags,
lprect, debugstr_wn(wstr, count), count, lpDx); lprect, debugstr_wn(wstr, count), count, lpDx);
@ -968,7 +968,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
if(lprect) if(lprect)
TRACE("rect: %ld,%ld - %ld,%ld\n", lprect->left, lprect->top, lprect->right, TRACE("rect: %ld,%ld - %ld,%ld\n", lprect->left, lprect->top, lprect->right,
lprect->bottom); lprect->bottom);
TRACE("align = %x bkmode = %x mapmode = %x\n", align, GetBkMode(hdc), dc->MapMode); TRACE("align = %x bkmode = %x mapmode = %x\n", align, GetBkMode(hdc), GetMapMode(hdc));
if(align & TA_UPDATECP) if(align & TA_UPDATECP)
{ {
@ -1015,7 +1015,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
X11DRV_LockDIBSection( physDev, DIB_Status_GdiMod, FALSE ); X11DRV_LockDIBSection( physDev, DIB_Status_GdiMod, FALSE );
if(physDev->depth == 1) { if(physDev->depth == 1) {
if((dc->textColor & 0xffffff) == 0) { if((textColor & 0xffffff) == 0) {
textPixel = 0; textPixel = 0;
backgroundPixel = 1; backgroundPixel = 1;
} else { } else {
@ -1083,7 +1083,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
tm.tmAscent = X11DRV_YWStoDS(physDev, tm.tmAscent); tm.tmAscent = X11DRV_YWStoDS(physDev, tm.tmAscent);
tm.tmDescent = X11DRV_YWStoDS(physDev, tm.tmDescent); tm.tmDescent = X11DRV_YWStoDS(physDev, tm.tmDescent);
switch( dc->textAlign & (TA_LEFT | TA_RIGHT | TA_CENTER) ) { switch( align & (TA_LEFT | TA_RIGHT | TA_CENTER) ) {
case TA_LEFT: case TA_LEFT:
if (align & TA_UPDATECP) { if (align & TA_UPDATECP) {
pt.x = x + xwidth; pt.x = x + xwidth;
@ -1144,12 +1144,14 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
CPSubwindowMode, &pa); CPSubwindowMode, &pa);
wine_tsx11_unlock(); wine_tsx11_unlock();
TRACE("allocing pict = %lx dc = %p drawable = %08lx\n", physDev->xrender->pict, dc, physDev->drawable); TRACE("allocing pict = %lx dc = %p drawable = %08lx\n",
physDev->xrender->pict, hdc, physDev->drawable);
} else { } else {
TRACE("using existing pict = %lx dc = %p drawable = %08lx\n", physDev->xrender->pict, dc, physDev->drawable); TRACE("using existing pict = %lx dc = %p drawable = %08lx\n",
physDev->xrender->pict, hdc, physDev->drawable);
} }
if ((data = X11DRV_GetRegionData( dc->hGCClipRgn, 0 ))) if ((data = X11DRV_GetRegionData( physDev->dc->hGCClipRgn, 0 )))
{ {
wine_tsx11_lock(); wine_tsx11_lock();
pXRenderSetPictureClipRectangles( gdi_display, physDev->xrender->pict, pXRenderSetPictureClipRectangles( gdi_display, physDev->xrender->pict,
@ -1192,19 +1194,19 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
CPRepeat, &pa); CPRepeat, &pa);
wine_tsx11_unlock(); wine_tsx11_unlock();
TRACE("Created pixmap of depth %d\n", format->depth); TRACE("Created pixmap of depth %d\n", format->depth);
/* init lastTextColor to something different from dc->textColor */ /* init lastTextColor to something different from textColor */
physDev->xrender->lastTextColor = ~dc->textColor; physDev->xrender->lastTextColor = ~textColor;
} }
if(dc->textColor != physDev->xrender->lastTextColor) { if(textColor != physDev->xrender->lastTextColor) {
if(physDev->depth != 1) { if(physDev->depth != 1) {
/* Map 0 -- 0xff onto 0 -- 0xffff */ /* Map 0 -- 0xff onto 0 -- 0xffff */
col.red = GetRValue(dc->textColor); col.red = GetRValue(textColor);
col.red |= col.red << 8; col.red |= col.red << 8;
col.green = GetGValue(dc->textColor); col.green = GetGValue(textColor);
col.green |= col.green << 8; col.green |= col.green << 8;
col.blue = GetBValue(dc->textColor); col.blue = GetBValue(textColor);
col.blue |= col.blue << 8; col.blue |= col.blue << 8;
col.alpha = 0x0; col.alpha = 0x0;
} else { /* for a 1bpp bitmap we always need a 1 in the tile */ } else { /* for a 1bpp bitmap we always need a 1 in the tile */
@ -1216,7 +1218,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
physDev->xrender->tile_pict, physDev->xrender->tile_pict,
&col, 0, 0, 1, 1); &col, 0, 0, 1, 1);
wine_tsx11_unlock(); wine_tsx11_unlock();
physDev->xrender->lastTextColor = dc->textColor; physDev->xrender->lastTextColor = textColor;
} }
/* FIXME the mapping of Text/BkColor onto 1 or 0 needs investigation. /* FIXME the mapping of Text/BkColor onto 1 or 0 needs investigation.
@ -1439,7 +1441,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
yoff + image_off_y - extents.top, yoff + image_off_y - extents.top,
entry->bitmaps[glyphs[idx]], entry->bitmaps[glyphs[idx]],
&entry->gis[glyphs[idx]], &entry->gis[glyphs[idx]],
dc->textColor); textColor);
if(deltas) { if(deltas) {
offset += X11DRV_XWStoDS(physDev, deltas[idx]); offset += X11DRV_XWStoDS(physDev, deltas[idx]);
xoff = offset * cosEsc; xoff = offset * cosEsc;