#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)))
#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);
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)
{
PDC_ATTR pdcattr;
RECTL RectBounds, RectSEpts;
- PBRUSH pbrushPen;
+ PBRUSH pbrPen;
SURFACE *psurf;
BOOL ret = TRUE;
LONG PenWidth, PenOrigWidth;
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;
+ PenOrigWidth = PenWidth = pbrPen->ptPenWidth.x;
+ if (pbrPen->ulPenStyle == PS_NULL) PenWidth = 0;
- if (pbrushPen->ulPenStyle == PS_INSIDEFRAME)
+ 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;
}
if (!PenWidth) PenWidth = 1;
- pbrushPen->ptPenWidth.x = PenWidth;
+ pbrPen->ptPenWidth.x = PenWidth;
RectBounds.left = Left;
RectBounds.right = Right;
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;
}
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;
}
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);
}
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");
pbrush);
pbrush->ptPenWidth.x = PenOrigWidth;
- PEN_UnlockPen(pbrush);
+ PEN_ShareUnlockPen(pbrush);
DC_UnlockDc(dc);
DPRINT("Ellipse Exit.\n");
return ret;
int yCurveDiameter)
{
PDC_ATTR pdcattr;
- PBRUSH pbrushLine, pbrushFill;
+ PBRUSH pbrLine, pbrFill;
RECTL RectBounds;
LONG PenWidth, PenOrigWidth;
BOOL ret = TRUE; // default to success
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;
+ PenOrigWidth = PenWidth = pbrLine->ptPenWidth.x;
+ if (pbrLine->ulPenStyle == PS_NULL) PenWidth = 0;
- if (pbrushLine->ulPenStyle == PS_INSIDEFRAME)
+ 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;
}
if (!PenWidth) PenWidth = 1;
- pbrushLine->ptPenWidth.x = PenWidth;
+ pbrLine->ptPenWidth.x = PenWidth;
RectBounds.left = Left;
RectBounds.top = Top;
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);
}
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,
xCurveDiameter,
yCurveDiameter,
&brushTemp);
- BRUSH_ShareUnlockBrush(pbrushFill);
+ BRUSH_ShareUnlockBrush(pbrFill);
}
if (ret)
RectBounds.bottom,
xCurveDiameter,
yCurveDiameter,
- pbrushLine);
+ pbrLine);
- pbrushLine->ptPenWidth.x = PenOrigWidth;
- PEN_UnlockPen(pbrushLine);
+ pbrLine->ptPenWidth.x = PenOrigWidth;
+ PEN_ShareUnlockPen(pbrLine);
return ret;
}
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;
}
{
PENTRY pentry;
- pentry = ENTRY_ReferenceEntryByHandle(hobj, GDIOBJFLAG_IGNOREPID);
+ pentry = ENTRY_ReferenceEntryByHandle(hobj, 0);
if (!pentry) return FALSE;
GDIOBJ_vDereferenceObject(pentry->einfo.pobj);
return TRUE;
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);
-}
+ GDI_HANDLE_GET_TYPE(hobj) != GDILoObjType_LO_EXTPEN_TYPE)
+ {
+ return NULL;
+ }
-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);
+ return (PBRUSH)GDIOBJ_ReferenceObjectByHandle(hobj, GDIObjType_BRUSH_TYPE);
}
HPEN APIENTRY
VOID FASTCALL
IntGdiSetSolidPenColor(HPEN hPen, COLORREF Color)
{
- PBRUSH pbrushPen;
+ PBRUSH pbrPen;
- pbrushPen = PEN_LockPen(hPen);
- if (pbrushPen)
+ 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);
}
}