- Finnish up gdi wine pen cross test fixes.

- Fix width issue with simple stock pens.
- Fix Info DC building. This was made obvious with wine pen cross tests.


svn path=/trunk/; revision=37694
This commit is contained in:
James Tabor 2008-11-27 20:51:19 +00:00
parent a68cd30c0d
commit 1301bd7eb6
3 changed files with 57 additions and 44 deletions

View file

@ -60,7 +60,7 @@ NtGdiCreateCompatibleDC(HDC hDC)
{
PDC NewDC, OrigDC;
PDC_ATTR nDc_Attr, oDc_Attr;
HDC hNewDC, DisplayDC;
HDC hNewDC, DisplayDC = NULL;
HRGN hVisRgn;
UNICODE_STRING DriverName;
DWORD Layout = 0;
@ -146,6 +146,8 @@ NtGdiCreateCompatibleDC(HDC hDC)
nDc_Attr->ulDirty_ = oDc_Attr->ulDirty_;
nDc_Attr->iCS_CP = oDc_Attr->iCS_CP;
NewDC->erclWindow = (RECTL){0,0,1,1};
DC_UnlockDc(NewDC);
DC_UnlockDc(OrigDC);
if (NULL != DisplayDC)
@ -838,35 +840,30 @@ IntGdiCreateDC(PUNICODE_STRING Driver,
NewDC->flGraphics = PrimarySurface.DevInfo.flGraphicsCaps;
NewDC->flGraphics2 = PrimarySurface.DevInfo.flGraphicsCaps2;
NewDC->DcLevel.hpal = NtGdiGetStockObject(DEFAULT_PALETTE);
nDc_Attr->jROP2 = R2_COPYPEN;
NewDC->erclWindow.top = NewDC->erclWindow.left = 0;
NewDC->erclWindow.right = ((PGDIDEVICE)NewDC->pPDev)->GDIInfo.ulHorzRes;
NewDC->erclWindow.bottom = ((PGDIDEVICE)NewDC->pPDev)->GDIInfo.ulVertRes;
NewDC->DcLevel.flPath &= ~DCPATH_CLOCKWISE; // Default is CCW.
nDc_Attr->iCS_CP = ftGdiGetTextCharsetInfo(NewDC,NULL,0);
hVisRgn = NtGdiCreateRectRgn(0, 0, ((PGDIDEVICE)NewDC->pPDev)->GDIInfo.ulHorzRes,
((PGDIDEVICE)NewDC->pPDev)->GDIInfo.ulVertRes);
if (!CreateAsIC)
{
NewDC->DcLevel.hpal = NtGdiGetStockObject(DEFAULT_PALETTE);
nDc_Attr->jROP2 = R2_COPYPEN;
NewDC->erclWindow.top = NewDC->erclWindow.left = 0;
NewDC->erclWindow.right = ((PGDIDEVICE)NewDC->pPDev)->GDIInfo.ulHorzRes;
NewDC->erclWindow.bottom = ((PGDIDEVICE)NewDC->pPDev)->GDIInfo.ulVertRes;
NewDC->DcLevel.flPath &= ~DCPATH_CLOCKWISE; // Default is CCW.
nDc_Attr->iCS_CP = ftGdiGetTextCharsetInfo(NewDC,NULL,0);
NewDC->pSurfInfo = NULL;
// NewDC->DcLevel.pSurface =
DC_UnlockDc( NewDC );
hVisRgn = NtGdiCreateRectRgn(0, 0, ((PGDIDEVICE)NewDC->pPDev)->GDIInfo.ulHorzRes,
((PGDIDEVICE)NewDC->pPDev)->GDIInfo.ulVertRes);
if (hVisRgn)
{
GdiSelectVisRgn(hNewDC, hVisRgn);
NtGdiDeleteObject(hVisRgn);
}
/* Initialize the DC state */
DC_InitDC(hNewDC);
IntGdiSetTextColor(hNewDC, RGB(0, 0, 0));
IntGdiSetTextAlign(hNewDC, TA_TOP);
IntGdiSetBkColor(hNewDC, RGB(255, 255, 255));
IntGdiSetBkMode(hNewDC, OPAQUE);
}
else
{
@ -877,8 +874,22 @@ IntGdiCreateDC(PUNICODE_STRING Driver,
cannot accept a handle to an information context.
*/
NewDC->DC_Type = DC_TYPE_INFO;
// NewDC->pSurfInfo =
NewDC->DcLevel.pSurface = NULL;
nDc_Attr->crBackgroundClr = nDc_Attr->ulBackgroundClr = RGB(255, 255, 255);
nDc_Attr->crForegroundClr = RGB(0, 0, 0);
DC_UnlockDc( NewDC );
}
if (hVisRgn)
{
GdiSelectVisRgn(hNewDC, hVisRgn);
NtGdiDeleteObject(hVisRgn);
}
IntGdiSetTextAlign(hNewDC, TA_TOP);
IntGdiSetBkMode(hNewDC, OPAQUE);
return hNewDC;
}

View file

@ -209,32 +209,34 @@ PEN_GetObject(PGDIBRUSHOBJ pPenObject, INT cbCount, PLOGPEN pBuffer)
PLOGPEN pLogPen;
PEXTLOGPEN pExtLogPen;
INT cbRetCount;
BOOLEAN isOldPen;
isOldPen = (pPenObject->flAttrs & GDIBRUSH_IS_OLDSTYLEPEN) > 0;
if ((pPenObject->ulPenStyle & PS_STYLE_MASK) == PS_NULL)
{
/* PS_NULL can be retrieved as LOGPEN or as EXTLOGPEN */
if (cbCount == sizeof(LOGPEN))
{
isOldPen = TRUE;
}
else if (cbCount == sizeof(EXTLOGPEN))
{
isOldPen = FALSE;
}
}
if (isOldPen)
if (pPenObject->flAttrs & GDIBRUSH_IS_OLDSTYLEPEN)
{
cbRetCount = sizeof(LOGPEN);
if (pBuffer)
{
if (cbCount < cbRetCount) return 0;
pLogPen = (PLOGPEN)pBuffer;
pLogPen->lopnWidth = pPenObject->ptPenWidth;
pLogPen->lopnStyle = pPenObject->ulPenStyle;
pLogPen->lopnColor = pPenObject->BrushAttr.lbColor;
if ( (pPenObject->ulPenStyle & PS_STYLE_MASK) == PS_NULL &&
cbCount == sizeof(EXTLOGPEN))
{
pExtLogPen = (PEXTLOGPEN)pBuffer;
pExtLogPen->elpPenStyle = pPenObject->ulPenStyle;
pExtLogPen->elpWidth = 0;
pExtLogPen->elpBrushStyle = pPenObject->ulStyle;
pExtLogPen->elpColor = pPenObject->BrushAttr.lbColor;
pExtLogPen->elpHatch = 0;
pExtLogPen->elpNumEntries = 0;
cbRetCount = sizeof(EXTLOGPEN);
}
else
{
pLogPen = (PLOGPEN)pBuffer;
pLogPen->lopnWidth = pPenObject->ptPenWidth;
pLogPen->lopnStyle = pPenObject->ulPenStyle;
pLogPen->lopnColor = pPenObject->BrushAttr.lbColor;
}
}
}
else

View file

@ -120,9 +120,9 @@ IntCreateStockPen( DWORD dwPenStyle,
HPEN hPen;
PGDIBRUSHOBJ PenObject = PENOBJ_AllocPenWithHandle();
if ((!dwWidth) && (dwPenStyle & PS_STYLE_MASK) != PS_SOLID) dwWidth = 1;
if ((dwPenStyle & PS_STYLE_MASK) == PS_NULL) dwWidth = 1;
PenObject->ptPenWidth.x = dwWidth;
PenObject->ptPenWidth.x = abs(dwWidth);
PenObject->ptPenWidth.y = 0;
PenObject->ulPenStyle = dwPenStyle;
PenObject->BrushAttr.lbColor = ulColor;