Author: tkreuzer Date: Thu Apr 28 14:29:47 2011 New Revision: 51475
URL: http://svn.reactos.org/svn/reactos?rev=51475&view=rev Log: [WIN32K] - Don't use exclusive locks for pens - Don't try to delete the window update region - Don't ignore pid in GreIsHandleValid - Check if handle is valid before deleting it in DC_Cleanup - Silence a DPRINT
Modified: trunk/reactos/subsystems/win32/win32k/include/pen.h trunk/reactos/subsystems/win32/win32k/ntuser/painting.c trunk/reactos/subsystems/win32/win32k/objects/arc.c trunk/reactos/subsystems/win32/win32k/objects/dclife.c trunk/reactos/subsystems/win32/win32k/objects/fillshap.c trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c trunk/reactos/subsystems/win32/win32k/objects/pen.c
Modified: trunk/reactos/subsystems/win32/win32k/include/pen.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/pen.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/pen.h [iso-8859-1] Thu Apr 28 14:29:47 2011 @@ -11,8 +11,6 @@ #define PEN_FreePen(pBMObj) GDIOBJ_FreeObj((POBJ) pBMObj, GDIObjType_BRUSH_TYPE) #define PEN_FreePenByHandle(hBMObj) GDIOBJ_FreeObjByHandle((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_PEN)
-//#define PEN_LockPen(hBMObj) ((PBRUSH)GDIOBJ_LockObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_PEN)) - #define PEN_AllocExtPen() ((PBRUSH)GDIOBJ_AllocObj(GDIObjType_BRUSH_TYPE)) #define PEN_AllocExtPenWithHandle() ((PBRUSH)GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_EXTPEN, sizeof(BRUSH)))
@@ -25,8 +23,6 @@
#define PEN_ShareUnlockPen(ppen) GDIOBJ_vDereferenceObject((POBJ)ppen)
- -PBRUSH FASTCALL PEN_LockPen(HGDIOBJ); PBRUSH FASTCALL PEN_ShareLockPen(HGDIOBJ);
INT APIENTRY PEN_GetObject(PBRUSH pPen, INT Count, PLOGPEN Buffer);
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/painting.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/painting.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/painting.c [iso-8859-1] Thu Apr 28 14:29:47 2011 @@ -242,12 +242,6 @@ MsqDecPaintCountQueue(Wnd->head.pti->MessageQueue); co_IntSendMessage(hWnd, WM_NCPAINT, (WPARAM)TempRegion, 0);
- if ( (HANDLE) 1 != TempRegion && - NULL != TempRegion) - { - /* NOTE: The region can already be deleted! */ - GreDeleteObject(TempRegion); - } }
if (Wnd->state & WNDS_ERASEBACKGROUND)
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 Apr 28 14:29:47 2011 @@ -46,7 +46,7 @@ { PDC_ATTR pdcattr; RECTL RectBounds, RectSEpts; - PBRUSH pbrushPen; + PBRUSH pbrPen; SURFACE *psurf; BOOL ret = TRUE; LONG PenWidth, PenOrigWidth; @@ -71,18 +71,18 @@
pdcattr = dc->pdcattr;
- pbrushPen = PEN_LockPen(pdcattr->hpen); - if (!pbrushPen) + pbrPen = PEN_ShareLockPen(pdcattr->hpen); + if (!pbrPen) { DPRINT1("Arc Fail 1\n"); EngSetLastError(ERROR_INTERNAL_ERROR); return FALSE; }
- PenOrigWidth = PenWidth = pbrushPen->ptPenWidth.x; - if (pbrushPen->ulPenStyle == PS_NULL) PenWidth = 0; - - if (pbrushPen->ulPenStyle == PS_INSIDEFRAME) + PenOrigWidth = PenWidth = pbrPen->ptPenWidth.x; + if (pbrPen->ulPenStyle == PS_NULL) PenWidth = 0; + + if (pbrPen->ulPenStyle == PS_INSIDEFRAME) { if (2*PenWidth > (Right - Left)) PenWidth = (Right -Left + 1)/2; if (2*PenWidth > (Bottom - Top)) PenWidth = (Bottom -Top + 1)/2; @@ -93,7 +93,7 @@ }
if (!PenWidth) PenWidth = 1; - pbrushPen->ptPenWidth.x = PenWidth; + pbrPen->ptPenWidth.x = PenWidth;
RectBounds.left = Left; RectBounds.right = Right; @@ -156,13 +156,13 @@ AngleStart, AngleEnd, arctype, - pbrushPen); + pbrPen);
psurf = dc->dclevel.pSurface; if (NULL == psurf) { DPRINT1("Arc Fail 2\n"); - PEN_UnlockPen(pbrushPen); + PEN_ShareUnlockPen(pbrPen); EngSetLastError(ERROR_INTERNAL_ERROR); return FALSE; } @@ -175,8 +175,8 @@ if (arctype == GdiTypeChord) PUTLINE(EfCx + CenterX, EfCy + CenterY, SfCx + CenterX, SfCy + CenterY, dc->eboLine);
- pbrushPen->ptPenWidth.x = PenOrigWidth; - PEN_UnlockPen(pbrushPen); + pbrPen->ptPenWidth.x = PenOrigWidth; + PEN_ShareUnlockPen(pbrPen); DPRINT("IntArc Exit.\n"); return ret; }
Modified: trunk/reactos/subsystems/win32/win32k/objects/dclife.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] Thu Apr 28 14:29:47 2011 @@ -368,13 +368,13 @@ EBRUSHOBJ_vCleanup(&pdc->eboBackground);
/* Free regions */ - if (pdc->rosdc.hClipRgn) + if (pdc->rosdc.hClipRgn && GreIsHandleValid(pdc->rosdc.hClipRgn)) GreDeleteObject(pdc->rosdc.hClipRgn); if (pdc->prgnVis) { REGION_Delete(pdc->prgnVis); } - if (pdc->rosdc.hGCClipRgn) + if (pdc->rosdc.hGCClipRgn && GreIsHandleValid(pdc->rosdc.hGCClipRgn)) { GreDeleteObject(pdc->rosdc.hGCClipRgn); }
Modified: trunk/reactos/subsystems/win32/win32k/objects/fillshap.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/fillshap.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/fillshap.c [iso-8859-1] Thu Apr 28 14:29:47 2011 @@ -248,7 +248,7 @@ if (pdcattr->ulDirty_ & (DIRTY_LINE | DC_PEN_DIRTY)) DC_vUpdateLineBrush(dc);
- pbrush = PEN_LockPen(pdcattr->hpen); + pbrush = PEN_ShareLockPen(pdcattr->hpen); if (!pbrush) { DPRINT1("Ellipse Fail 1\n"); @@ -329,7 +329,7 @@ pbrush);
pbrush->ptPenWidth.x = PenOrigWidth; - PEN_UnlockPen(pbrush); + PEN_ShareUnlockPen(pbrush); DC_UnlockDc(dc); DPRINT("Ellipse Exit.\n"); return ret; @@ -714,7 +714,7 @@ int yCurveDiameter) { PDC_ATTR pdcattr; - PBRUSH pbrushLine, pbrushFill; + PBRUSH pbrLine, pbrFill; RECTL RectBounds; LONG PenWidth, PenOrigWidth; BOOL ret = TRUE; // default to success @@ -748,18 +748,18 @@ if (pdcattr->ulDirty_ & (DIRTY_LINE | DC_PEN_DIRTY)) DC_vUpdateLineBrush(dc);
- pbrushLine = PEN_LockPen(pdcattr->hpen); - if (!pbrushLine) + pbrLine = PEN_ShareLockPen(pdcattr->hpen); + if (!pbrLine) { /* Nothing to do, as we don't have a bitmap */ EngSetLastError(ERROR_INTERNAL_ERROR); return FALSE; }
- PenOrigWidth = PenWidth = pbrushLine->ptPenWidth.x; - if (pbrushLine->ulPenStyle == PS_NULL) PenWidth = 0; - - if (pbrushLine->ulPenStyle == PS_INSIDEFRAME) + PenOrigWidth = PenWidth = pbrLine->ptPenWidth.x; + if (pbrLine->ulPenStyle == PS_NULL) PenWidth = 0; + + if (pbrLine->ulPenStyle == PS_INSIDEFRAME) { if (2*PenWidth > (Right - Left)) PenWidth = (Right -Left + 1)/2; if (2*PenWidth > (Bottom - Top)) PenWidth = (Bottom -Top + 1)/2; @@ -770,7 +770,7 @@ }
if (!PenWidth) PenWidth = 1; - pbrushLine->ptPenWidth.x = PenWidth; + pbrLine->ptPenWidth.x = PenWidth;
RectBounds.left = Left; RectBounds.top = Top; @@ -784,8 +784,8 @@ RectBounds.right += dc->ptlDCOrig.x; RectBounds.bottom += dc->ptlDCOrig.y;
- pbrushFill = BRUSH_ShareLockBrush(pdcattr->hbrush); - if (NULL == pbrushFill) + pbrFill = BRUSH_ShareLockBrush(pdcattr->hbrush); + if (!pbrFill) { DPRINT1("FillRound Fail\n"); EngSetLastError(ERROR_INTERNAL_ERROR); @@ -793,7 +793,7 @@ } else { - RtlCopyMemory(&brushTemp, pbrushFill, sizeof(brushTemp)); + RtlCopyMemory(&brushTemp, pbrFill, sizeof(brushTemp)); brushTemp.ptOrigin.x += RectBounds.left - Left; brushTemp.ptOrigin.y += RectBounds.top - Top; ret = IntFillRoundRect( dc, @@ -804,7 +804,7 @@ xCurveDiameter, yCurveDiameter, &brushTemp); - BRUSH_ShareUnlockBrush(pbrushFill); + BRUSH_ShareUnlockBrush(pbrFill); }
if (ret) @@ -815,10 +815,10 @@ RectBounds.bottom, xCurveDiameter, yCurveDiameter, - pbrushLine); - - pbrushLine->ptPenWidth.x = PenOrigWidth; - PEN_UnlockPen(pbrushLine); + pbrLine); + + pbrLine->ptPenWidth.x = PenOrigWidth; + PEN_ShareUnlockPen(pbrLine); return ret; }
Modified: trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c [iso-8859-1] Thu Apr 28 14:29:47 2011 @@ -368,9 +368,8 @@ pentry->ObjectOwner.ulObj != GDI_OBJ_HMGR_PUBLIC && pentry->ObjectOwner.ulObj != PtrToUlong(PsGetCurrentProcessId())) { - DPRINT1("GDIOBJ: Cannot reference foreign handle %p, pentry=%p:%lx.\n", + DPRINT("GDIOBJ: Cannot reference foreign handle %p, pentry=%p:%lx.\n", hobj, pentry, pentry->ObjectOwner.ulObj); - //ASSERT(FALSE); return NULL; }
@@ -892,7 +891,7 @@ { PENTRY pentry;
- pentry = ENTRY_ReferenceEntryByHandle(hobj, GDIOBJFLAG_IGNOREPID); + pentry = ENTRY_ReferenceEntryByHandle(hobj, 0); if (!pentry) return FALSE; GDIOBJ_vDereferenceObject(pentry->einfo.pobj); return TRUE;
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 Apr 28 14:29:47 2011 @@ -29,22 +29,15 @@
PBRUSH FASTCALL -PEN_LockPen(HGDIOBJ hobj) +PEN_ShareLockPen(HGDIOBJ hobj) { if (GDI_HANDLE_GET_TYPE(hobj) != GDILoObjType_LO_PEN_TYPE && - GDI_HANDLE_GET_TYPE(hobj) != GDILoObjType_LO_EXTPEN_TYPE) return NULL; - - return GDIOBJ_LockObject(hobj, GDIObjType_BRUSH_TYPE); -} - -PBRUSH -FASTCALL -PEN_ShareLockPen(HGDIOBJ hBMObj) -{ - if (GDI_HANDLE_GET_TYPE(hBMObj) == GDI_OBJECT_TYPE_EXTPEN) - return GDIOBJ_ShareLockObj( hBMObj, GDI_OBJECT_TYPE_EXTPEN); - else - return GDIOBJ_ShareLockObj( hBMObj, GDI_OBJECT_TYPE_PEN); + GDI_HANDLE_GET_TYPE(hobj) != GDILoObjType_LO_EXTPEN_TYPE) + { + return NULL; + } + + return (PBRUSH)GDIOBJ_ReferenceObjectByHandle(hobj, GDIObjType_BRUSH_TYPE); }
HPEN APIENTRY @@ -196,16 +189,16 @@ VOID FASTCALL IntGdiSetSolidPenColor(HPEN hPen, COLORREF Color) { - PBRUSH pbrushPen; - - pbrushPen = PEN_LockPen(hPen); - if (pbrushPen) + PBRUSH pbrPen; + + pbrPen = PEN_ShareLockPen(hPen); + if (pbrPen) { - if (pbrushPen->flAttrs & GDIBRUSH_IS_SOLID) + if (pbrPen->flAttrs & GDIBRUSH_IS_SOLID) { - pbrushPen->BrushAttr.lbColor = Color & 0xFFFFFF; + pbrPen->BrushAttr.lbColor = Color & 0xFFFFFF; } - PEN_UnlockPen(pbrushPen); + PEN_ShareUnlockPen(pbrPen); } }