Author: jimtabor Date: Thu Nov 13 17:12:42 2008 New Revision: 37346
URL: http://svn.reactos.org/svn/reactos?rev=37346&view=rev Log: - Start the implementation and support for dc attribute dirty bits. See bug 3863.
Modified: trunk/reactos/subsystems/win32/win32k/include/dc.h trunk/reactos/subsystems/win32/win32k/objects/arc.c trunk/reactos/subsystems/win32/win32k/objects/brush.c trunk/reactos/subsystems/win32/win32k/objects/dc.c trunk/reactos/subsystems/win32/win32k/objects/pen.c
Modified: trunk/reactos/subsystems/win32/win32k/include/dc.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] Thu Nov 13 17:12:42 2008 @@ -268,6 +268,8 @@ HDC FASTCALL IntGdiCreateDisplayDC(HDEV hDev, ULONG DcType, BOOL EmptyDC); BOOL FASTCALL IntGdiCleanDC(HDC hDC); VOID FASTCALL IntvGetDeviceCaps(PGDIDEVICE, PDEVCAPS); +HPEN FASTCALL IntGdiSelectPen(PDC,HPEN); +HBRUSH FASTCALL IntGdiSelectBrush(PDC,HBRUSH);
extern PGDIDEVICE pPrimarySurface;
Modified: trunk/reactos/subsystems/win32/win32k/objects/arc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/arc.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/arc.c [iso-8859-1] Thu Nov 13 17:12:42 2008 @@ -199,6 +199,7 @@ int YEndArc) { BOOL Ret; + PDC_ATTR pDc_Attr;
DPRINT("StartX: %d, StartY: %d, EndX: %d, EndY: %d\n", XStartArc,YStartArc,XEndArc,YEndArc); @@ -220,6 +221,15 @@ YEndArc, arctype); } + + pDc_Attr = dc->pDc_Attr; + if (!pDc_Attr) pDc_Attr = &dc->Dc_Attr; + + if (pDc_Attr->ulDirty_ & DC_BRUSH_DIRTY) + IntGdiSelectBrush(dc,pDc_Attr->hbrush); + + if (pDc_Attr->ulDirty_ & DC_PEN_DIRTY) + IntGdiSelectPen(dc,pDc_Attr->hpen);
if (arctype == GdiTypeArcTo) {
Modified: trunk/reactos/subsystems/win32/win32k/objects/brush.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/brush.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/brush.c [iso-8859-1] Thu Nov 13 17:12:42 2008 @@ -508,6 +508,52 @@
return hBrush; } + +HBRUSH +FASTCALL +IntGdiSelectBrush( + PDC pDC, + HBRUSH hBrush) +{ + PDC_ATTR pDc_Attr; + HBRUSH hOrgBrush; + PGDIBRUSHOBJ pBrush; + XLATEOBJ *XlateObj; + BOOLEAN bFailed; + + if (pDC == NULL || hBrush == NULL) return NULL; + + pDc_Attr = pDC->pDc_Attr; + if(!pDc_Attr) pDc_Attr = &pDC->Dc_Attr; + + pBrush = BRUSHOBJ_LockBrush(hBrush); + if (pBrush == NULL) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return NULL; + } + + XlateObj = IntGdiCreateBrushXlate(pDC, pBrush, &bFailed); + BRUSHOBJ_UnlockBrush(pBrush); + if(bFailed) + { + return NULL; + } + + hOrgBrush = pDc_Attr->hbrush; + pDc_Attr->hbrush = hBrush; + + if (pDC->XlateBrush != NULL) + { + EngDeleteXlate(pDC->XlateBrush); + } + pDC->XlateBrush = XlateObj; + + pDc_Attr->ulDirty_ &= ~DC_BRUSH_DIRTY; + + return hOrgBrush; +} +
/* PUBLIC FUNCTIONS ***********************************************************/
@@ -656,4 +702,31 @@ BRUSHOBJ_UnlockBrush(BrushObject); }
+ /* + * @implemented + */ +HBRUSH +APIENTRY +NtGdiSelectBrush( + IN HDC hDC, + IN HBRUSH hBrush) +{ + PDC pDC; + HBRUSH hOrgBrush; + + if (hDC == NULL || hBrush == NULL) return NULL; + + pDC = DC_LockDc(hDC); + if (!pDC) + { + return NULL; + } + + hOrgBrush = IntGdiSelectBrush(pDC,hBrush); + + DC_UnlockDc(pDC); + + return hOrgBrush; +} + /* EOF */
Modified: trunk/reactos/subsystems/win32/win32k/objects/dc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dc.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dc.c [iso-8859-1] Thu Nov 13 17:12:42 2008 @@ -2142,61 +2142,6 @@ /* * @implemented */ -HBRUSH -APIENTRY -NtGdiSelectBrush( - IN HDC hDC, - IN HBRUSH hBrush) -{ - PDC pDC; - PDC_ATTR pDc_Attr; - HBRUSH hOrgBrush; - PGDIBRUSHOBJ pBrush; - XLATEOBJ *XlateObj; - BOOLEAN bFailed; - - if (hDC == NULL || hBrush == NULL) return NULL; - - pDC = DC_LockDc(hDC); - if (!pDC) - { - return NULL; - } - - pDc_Attr = pDC->pDc_Attr; - if(!pDc_Attr) pDc_Attr = &pDC->Dc_Attr; - - pBrush = BRUSHOBJ_LockBrush(hBrush); - if (pBrush == NULL) - { - SetLastWin32Error(ERROR_INVALID_HANDLE); - DC_UnlockDc(pDC); - return NULL; - } - - XlateObj = IntGdiCreateBrushXlate(pDC, pBrush, &bFailed); - BRUSHOBJ_UnlockBrush(pBrush); - if(bFailed) - { - DC_UnlockDc(pDC); - return NULL; - } - - hOrgBrush = pDc_Attr->hbrush; - pDc_Attr->hbrush = hBrush; - if (pDC->XlateBrush != NULL) - { - EngDeleteXlate(pDC->XlateBrush); - } - pDC->XlateBrush = XlateObj; - - DC_UnlockDc(pDC); - return hOrgBrush; -} - - /* - * @implemented - */ HFONT APIENTRY NtGdiSelectFont( @@ -2228,60 +2173,6 @@ DC_UnlockDc(pDC);
return hOrgFont; -} - - /* - * @implemented - */ -HPEN -APIENTRY -NtGdiSelectPen( - IN HDC hDC, - IN HPEN hPen) -{ - PDC pDC; - PDC_ATTR pDc_Attr; - HPEN hOrgPen = NULL; - PGDIBRUSHOBJ pPen; - XLATEOBJ *XlateObj; - BOOLEAN bFailed; - - if (hDC == NULL || hPen == NULL) return NULL; - - pDC = DC_LockDc(hDC); - if (!pDC) - { - return NULL; - } - - pDc_Attr = pDC->pDc_Attr; - if(!pDc_Attr) pDc_Attr = &pDC->Dc_Attr; - - pPen = PENOBJ_LockPen(hPen); - if (pPen == NULL) - { - return NULL; - } - - XlateObj = IntGdiCreateBrushXlate(pDC, pPen, &bFailed); - PENOBJ_UnlockPen(pPen); - if (bFailed) - { - SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES); - return NULL; - } - - hOrgPen = pDc_Attr->hpen; - pDc_Attr->hpen = hPen; - if (pDC->XlatePen != NULL) - { - EngDeleteXlate(pDC->XlatePen); - } - pDC->XlatePen = XlateObj; - - DC_UnlockDc(pDC); - - return hOrgPen; }
HPALETTE
Modified: trunk/reactos/subsystems/win32/win32k/objects/pen.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/pen.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/pen.c [iso-8859-1] Thu Nov 13 17:12:42 2008 @@ -247,6 +247,50 @@ return cbRetCount; }
+ +HPEN +FASTCALL +IntGdiSelectPen( + PDC pDC, + HPEN hPen) +{ + PDC_ATTR pDc_Attr; + HPEN hOrgPen = NULL; + PGDIBRUSHOBJ pPen; + XLATEOBJ *XlateObj; + BOOLEAN bFailed; + + pDc_Attr = pDC->pDc_Attr; + if(!pDc_Attr) pDc_Attr = &pDC->Dc_Attr; + + pPen = PENOBJ_LockPen(hPen); + if (pPen == NULL) + { + return NULL; + } + + XlateObj = IntGdiCreateBrushXlate(pDC, pPen, &bFailed); + PENOBJ_UnlockPen(pPen); + if (bFailed) + { + SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES); + return NULL; + } + + hOrgPen = pDc_Attr->hpen; + pDc_Attr->hpen = hPen; + + if (pDC->XlatePen != NULL) + { + EngDeleteXlate(pDC->XlatePen); + } + pDc_Attr->ulDirty_ &= ~DC_PEN_DIRTY; + + pDC->XlatePen = XlateObj; + + return hOrgPen; +} + /* PUBLIC FUNCTIONS ***********************************************************/
HPEN STDCALL @@ -346,5 +390,31 @@ return hPen; }
+ /* + * @implemented + */ +HPEN +APIENTRY +NtGdiSelectPen( + IN HDC hDC, + IN HPEN hPen) +{ + PDC pDC; + HPEN hOrgPen; + + if (hDC == NULL || hPen == NULL) return NULL; + + pDC = DC_LockDc(hDC); + if (!pDC) + { + return NULL; + } + + hOrgPen = IntGdiSelectPen(pDC,hPen); + + DC_UnlockDc(pDC); + + return hOrgPen; +}
/* EOF */