From 30358935073c25169b0b8f5df4ad7eee1d83d894 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 11 Feb 2015 21:33:50 +0000 Subject: [PATCH] [WIN32K] Improve naming of some BRUSH fields and set the correct fields to the correct values (ulStyle was not for the brush style, but the hatch style!) svn path=/trunk/; revision=66227 --- reactos/win32ss/gdi/eng/engbrush.c | 4 +- reactos/win32ss/gdi/ntgdi/arc.c | 6 +-- reactos/win32ss/gdi/ntgdi/brush.c | 4 +- reactos/win32ss/gdi/ntgdi/brush.h | 68 ++++++++++++++++++---------- reactos/win32ss/gdi/ntgdi/drawing.c | 6 +-- reactos/win32ss/gdi/ntgdi/fillshap.c | 12 ++--- reactos/win32ss/gdi/ntgdi/pen.c | 15 +++--- reactos/win32ss/gdi/ntgdi/stockobj.c | 7 +-- 8 files changed, 71 insertions(+), 51 deletions(-) diff --git a/reactos/win32ss/gdi/eng/engbrush.c b/reactos/win32ss/gdi/eng/engbrush.c index c9de13d901b..275ec2a7b05 100644 --- a/reactos/win32ss/gdi/eng/engbrush.c +++ b/reactos/win32ss/gdi/eng/engbrush.c @@ -312,8 +312,8 @@ EBRUSHOBJ_bRealizeBrush(EBRUSHOBJ *pebo, BOOL bCallDriver) if (pbr->flAttrs & BR_IS_HATCH) { /* Get the hatch brush pattern from the PDEV */ - hbmPattern = (HBITMAP)ppdev->ahsurf[pbr->ulStyle]; - iHatch = pbr->ulStyle; + hbmPattern = (HBITMAP)ppdev->ahsurf[pbr->iHatch]; + iHatch = pbr->iHatch; } else { diff --git a/reactos/win32ss/gdi/ntgdi/arc.c b/reactos/win32ss/gdi/ntgdi/arc.c index 7e329601ae5..a4273ddfe18 100644 --- a/reactos/win32ss/gdi/ntgdi/arc.c +++ b/reactos/win32ss/gdi/ntgdi/arc.c @@ -79,7 +79,7 @@ IntArc( DC *dc, return FALSE; } - PenOrigWidth = PenWidth = pbrPen->ptPenWidth.x; + PenOrigWidth = PenWidth = pbrPen->lWidth; if (pbrPen->ulPenStyle == PS_NULL) PenWidth = 0; if (pbrPen->ulPenStyle == PS_INSIDEFRAME) @@ -93,7 +93,7 @@ IntArc( DC *dc, } if (!PenWidth) PenWidth = 1; - pbrPen->ptPenWidth.x = PenWidth; + pbrPen->lWidth = PenWidth; RectBounds.left = Left; RectBounds.right = Right; @@ -181,7 +181,7 @@ IntArc( DC *dc, if (arctype == GdiTypeChord) PUTLINE(EfCx + CenterX, EfCy + CenterY, SfCx + CenterX, SfCy + CenterY, dc->eboLine); - pbrPen->ptPenWidth.x = PenOrigWidth; + pbrPen->lWidth = PenOrigWidth; PEN_ShareUnlockPen(pbrPen); DPRINT("IntArc Exit.\n"); return ret; diff --git a/reactos/win32ss/gdi/ntgdi/brush.c b/reactos/win32ss/gdi/ntgdi/brush.c index 7b2fde287f6..a690c84224a 100644 --- a/reactos/win32ss/gdi/ntgdi/brush.c +++ b/reactos/win32ss/gdi/ntgdi/brush.c @@ -181,7 +181,7 @@ BRUSH_GetObject(PBRUSH pbrush, INT cjSize, LPLOGBRUSH plogbrush) else if (pbrush->flAttrs & BR_IS_HATCH) { plogbrush->lbStyle = BS_HATCHED; - plogbrush->lbHatch = pbrush->ulStyle; + plogbrush->lbHatch = pbrush->iHatch; } else if (pbrush->flAttrs & BR_IS_DIB) { @@ -293,7 +293,7 @@ IntGdiCreateHatchBrush( pbrush->flAttrs |= BR_IS_HATCH; pbrush->BrushAttr.lbColor = Color & 0xFFFFFF; - pbrush->ulStyle = Style; + pbrush->iHatch = Style; GDIOBJ_vUnlockObject(&pbrush->BaseObject); diff --git a/reactos/win32ss/gdi/ntgdi/brush.h b/reactos/win32ss/gdi/ntgdi/brush.h index 68685216036..67768bccca0 100644 --- a/reactos/win32ss/gdi/ntgdi/brush.h +++ b/reactos/win32ss/gdi/ntgdi/brush.h @@ -13,31 +13,40 @@ */ typedef struct _BRUSH { - /* Header for all gdi objects in the handle table. - Do not (re)move this. */ - BASEOBJECT BaseObject; + /* Header for all gdi objects in the handle table. + Do not (re)move this. */ + BASEOBJECT BaseObject; - ULONG ulStyle; - HBITMAP hbmPattern; - HBITMAP hbmClient; - ULONG flAttrs; + ULONG iHatch; // This is not the brush style, but the hatch style! + HBITMAP hbmPattern; + HBITMAP hbmClient; + ULONG flAttrs; - ULONG ulBrushUnique; - BRUSH_ATTR *pBrushAttr; // Just like DC_ATTR, pointer to user data - BRUSH_ATTR BrushAttr; // " " DCOBJ, internal if pBrushAttr == Zero - POINT ptOrigin; - ULONG bCacheGrabbed; - COLORREF crBack; - COLORREF crFore; - ULONG ulPalTime; - ULONG ulSurfTime; - PVOID ulRealization; - //ULONG Unknown4C[3]; - POINT ptPenWidth; - ULONG ulPenStyle; - DWORD *pStyle; - ULONG dwStyleCount; - //ULONG Unknown6C; + ULONG ulBrushUnique; + BRUSH_ATTR *pBrushAttr; // Pointer to the currently active brush attribute + BRUSH_ATTR BrushAttr; // Internal brush attribute for global brushes + POINT ptOrigin; + ULONG bCacheGrabbed; + COLORREF crBack; + COLORREF crFore; + ULONG ulPalTime; + ULONG ulSurfTime; + PVOID pvRBrush; + HDEV hdev; + //DWORD unk054; + LONG lWidth; + FLOAT eWidth; + ULONG ulPenStyle; + DWORD *pStyle; + ULONG dwStyleCount; + BYTE jJoin; // 0x06c Join styles for geometric wide lines + BYTE jEndCap; // end cap style for a geometric wide line + //WORD unk06e; // 0x06e + INT iBrushStyle; // 0x070 + //PREGION prgn; // 0x074 + //DWORD unk078; // 0x078 + DWORD unk07c; // 0x07c + LIST_ENTRY ListHead; // 0x080 } BRUSH, *PBRUSH; typedef struct _EBRUSHOBJ @@ -91,8 +100,17 @@ typedef struct _EBRUSHOBJ #define BRUSH_ShareLockBrush(hBrush) ((PBRUSH)GDIOBJ_ShareLockObj((HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH)) #define BRUSH_ShareUnlockBrush(pBrush) GDIOBJ_vDereferenceObject((POBJ)pBrush) -INT FASTCALL BRUSH_GetObject (PBRUSH GdiObject, INT Count, LPLOGBRUSH Buffer); -VOID NTAPI BRUSH_vCleanup(PVOID ObjectBody); +INT +FASTCALL +BRUSH_GetObject( + PBRUSH GdiObject, + INT Count, + LPLOGBRUSH Buffer); + +VOID +NTAPI +BRUSH_vCleanup( + PVOID ObjectBody); extern HSURF gahsurfHatch[HS_DDI_MAX]; diff --git a/reactos/win32ss/gdi/ntgdi/drawing.c b/reactos/win32ss/gdi/ntgdi/drawing.c index 9a597737193..7dd82843053 100644 --- a/reactos/win32ss/gdi/ntgdi/drawing.c +++ b/reactos/win32ss/gdi/ntgdi/drawing.c @@ -139,7 +139,7 @@ app_draw_ellipse(DC *g, Rect r, PBRUSH pbrush) int d2xt = b2+b2; int d2yt = a2+a2; - int w = pbrush->ptPenWidth.x; + int w = pbrush->lWidth; /* Inner ellipse: E(X,Y) = B*B*X*X + A*A*Y*Y - A*A*B*B */ @@ -983,7 +983,7 @@ int app_draw_arc(DC *g, Rect r, int start_angle, int end_angle, PBRUSH pbrushPen int d2xt = b2+b2; int d2yt = a2+a2; - int w = pbrushPen->ptPenWidth.x; + int w = pbrushPen->lWidth; /* Inner ellipse: E(X,Y) = B*B*X*X + A*A*Y*Y - A*A*B*B */ @@ -1470,7 +1470,7 @@ IntDrawRoundRect( PDC dc, { Rect r; int rx, ry; /* Radius in x and y directions */ - int w = pbrushPen->ptPenWidth.x; + int w = pbrushPen->lWidth; r = rect( Left, Top, abs(Right-Left), abs(Bottom-Top)); rx = Wellipse/2; diff --git a/reactos/win32ss/gdi/ntgdi/fillshap.c b/reactos/win32ss/gdi/ntgdi/fillshap.c index d5c6a281e9c..3fa5e4f6d4a 100644 --- a/reactos/win32ss/gdi/ntgdi/fillshap.c +++ b/reactos/win32ss/gdi/ntgdi/fillshap.c @@ -252,7 +252,7 @@ NtGdiEllipse( return FALSE; } - PenOrigWidth = PenWidth = pbrush->ptPenWidth.x; + PenOrigWidth = PenWidth = pbrush->lWidth; if (pbrush->ulPenStyle == PS_NULL) PenWidth = 0; if (pbrush->ulPenStyle == PS_INSIDEFRAME) @@ -266,7 +266,7 @@ NtGdiEllipse( } if (!PenWidth) PenWidth = 1; - pbrush->ptPenWidth.x = PenWidth; + pbrush->lWidth = PenWidth; RectBounds.left = Left; RectBounds.right = Right; @@ -330,7 +330,7 @@ NtGdiEllipse( DC_vFinishBlit(dc, NULL); } - pbrush->ptPenWidth.x = PenOrigWidth; + pbrush->lWidth = PenOrigWidth; PEN_ShareUnlockPen(pbrush); DC_UnlockDc(dc); DPRINT("Ellipse Exit.\n"); @@ -760,7 +760,7 @@ IntRoundRect( return FALSE; } - PenOrigWidth = PenWidth = pbrLine->ptPenWidth.x; + PenOrigWidth = PenWidth = pbrLine->lWidth; if (pbrLine->ulPenStyle == PS_NULL) PenWidth = 0; if (pbrLine->ulPenStyle == PS_INSIDEFRAME) @@ -774,7 +774,7 @@ IntRoundRect( } if (!PenWidth) PenWidth = 1; - pbrLine->ptPenWidth.x = PenWidth; + pbrLine->lWidth = PenWidth; RectBounds.left = Left; RectBounds.top = Top; @@ -829,7 +829,7 @@ IntRoundRect( } - pbrLine->ptPenWidth.x = PenOrigWidth; + pbrLine->lWidth = PenOrigWidth; PEN_ShareUnlockPen(pbrLine); return ret; } diff --git a/reactos/win32ss/gdi/ntgdi/pen.c b/reactos/win32ss/gdi/ntgdi/pen.c index b4ab1017c59..c1a2ce0c7f0 100644 --- a/reactos/win32ss/gdi/ntgdi/pen.c +++ b/reactos/win32ss/gdi/ntgdi/pen.c @@ -120,11 +120,11 @@ IntGdiExtCreatePen( if ((bOldStylePen) && (!dwWidth) && ((dwPenStyle & PS_STYLE_MASK) != PS_SOLID)) dwWidth = 1; - pbrushPen->ptPenWidth.x = dwWidth; - pbrushPen->ptPenWidth.y = 0; + pbrushPen->lWidth = dwWidth; + pbrushPen->eWidth = (FLOAT)pbrushPen->lWidth; pbrushPen->ulPenStyle = dwPenStyle; pbrushPen->BrushAttr.lbColor = ulColor; - pbrushPen->ulStyle = ulBrushStyle; + pbrushPen->iBrushStyle = ulBrushStyle; // FIXME: Copy the bitmap first ? pbrushPen->hbmClient = (HANDLE)ulClientHatch; pbrushPen->dwStyleCount = dwStyleCount; @@ -256,7 +256,7 @@ PEN_GetObject(PBRUSH pbrushPen, INT cbCount, PLOGPEN pBuffer) pExtLogPen = (PEXTLOGPEN)pBuffer; pExtLogPen->elpPenStyle = pbrushPen->ulPenStyle; pExtLogPen->elpWidth = 0; - pExtLogPen->elpBrushStyle = pbrushPen->ulStyle; + pExtLogPen->elpBrushStyle = pbrushPen->iBrushStyle; pExtLogPen->elpColor = pbrushPen->BrushAttr.lbColor; pExtLogPen->elpHatch = 0; pExtLogPen->elpNumEntries = 0; @@ -265,7 +265,8 @@ PEN_GetObject(PBRUSH pbrushPen, INT cbCount, PLOGPEN pBuffer) else { pLogPen = (PLOGPEN)pBuffer; - pLogPen->lopnWidth = pbrushPen->ptPenWidth; + pLogPen->lopnWidth.x = pbrushPen->lWidth; + pLogPen->lopnWidth.y = 0; pLogPen->lopnStyle = pbrushPen->ulPenStyle; pLogPen->lopnColor = pbrushPen->BrushAttr.lbColor; } @@ -282,8 +283,8 @@ PEN_GetObject(PBRUSH pbrushPen, INT cbCount, PLOGPEN pBuffer) if (cbCount < cbRetCount) return 0; pExtLogPen = (PEXTLOGPEN)pBuffer; pExtLogPen->elpPenStyle = pbrushPen->ulPenStyle; - pExtLogPen->elpWidth = pbrushPen->ptPenWidth.x; - pExtLogPen->elpBrushStyle = pbrushPen->ulStyle; + pExtLogPen->elpWidth = pbrushPen->lWidth; + pExtLogPen->elpBrushStyle = pbrushPen->iBrushStyle; pExtLogPen->elpColor = pbrushPen->BrushAttr.lbColor; pExtLogPen->elpHatch = (ULONG_PTR)pbrushPen->hbmClient; pExtLogPen->elpNumEntries = pbrushPen->dwStyleCount; diff --git a/reactos/win32ss/gdi/ntgdi/stockobj.c b/reactos/win32ss/gdi/ntgdi/stockobj.c index 9f286b3fa00..3d4d9fc59b1 100644 --- a/reactos/win32ss/gdi/ntgdi/stockobj.c +++ b/reactos/win32ss/gdi/ntgdi/stockobj.c @@ -114,11 +114,12 @@ IntCreateStockPen(DWORD dwPenStyle, if ((dwPenStyle & PS_STYLE_MASK) == PS_NULL) dwWidth = 1; - pbrushPen->ptPenWidth.x = abs(dwWidth); - pbrushPen->ptPenWidth.y = 0; + pbrushPen->iHatch = 0; + pbrushPen->lWidth = abs(dwWidth); + pbrushPen->eWidth = (FLOAT)pbrushPen->lWidth; pbrushPen->ulPenStyle = dwPenStyle; pbrushPen->BrushAttr.lbColor = ulColor; - pbrushPen->ulStyle = ulBrushStyle; + pbrushPen->iBrushStyle = ulBrushStyle; pbrushPen->hbmClient = (HANDLE)NULL; pbrushPen->dwStyleCount = 0; pbrushPen->pStyle = 0;