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
This commit is contained in:
Timo Kreuzer 2015-02-11 21:33:50 +00:00
parent 1b7dcc47ca
commit 3035893507
8 changed files with 71 additions and 51 deletions

View file

@ -312,8 +312,8 @@ EBRUSHOBJ_bRealizeBrush(EBRUSHOBJ *pebo, BOOL bCallDriver)
if (pbr->flAttrs & BR_IS_HATCH) if (pbr->flAttrs & BR_IS_HATCH)
{ {
/* Get the hatch brush pattern from the PDEV */ /* Get the hatch brush pattern from the PDEV */
hbmPattern = (HBITMAP)ppdev->ahsurf[pbr->ulStyle]; hbmPattern = (HBITMAP)ppdev->ahsurf[pbr->iHatch];
iHatch = pbr->ulStyle; iHatch = pbr->iHatch;
} }
else else
{ {

View file

@ -79,7 +79,7 @@ IntArc( DC *dc,
return FALSE; return FALSE;
} }
PenOrigWidth = PenWidth = pbrPen->ptPenWidth.x; PenOrigWidth = PenWidth = pbrPen->lWidth;
if (pbrPen->ulPenStyle == PS_NULL) PenWidth = 0; if (pbrPen->ulPenStyle == PS_NULL) PenWidth = 0;
if (pbrPen->ulPenStyle == PS_INSIDEFRAME) if (pbrPen->ulPenStyle == PS_INSIDEFRAME)
@ -93,7 +93,7 @@ IntArc( DC *dc,
} }
if (!PenWidth) PenWidth = 1; if (!PenWidth) PenWidth = 1;
pbrPen->ptPenWidth.x = PenWidth; pbrPen->lWidth = PenWidth;
RectBounds.left = Left; RectBounds.left = Left;
RectBounds.right = Right; RectBounds.right = Right;
@ -181,7 +181,7 @@ IntArc( DC *dc,
if (arctype == GdiTypeChord) if (arctype == GdiTypeChord)
PUTLINE(EfCx + CenterX, EfCy + CenterY, SfCx + CenterX, SfCy + CenterY, dc->eboLine); PUTLINE(EfCx + CenterX, EfCy + CenterY, SfCx + CenterX, SfCy + CenterY, dc->eboLine);
pbrPen->ptPenWidth.x = PenOrigWidth; pbrPen->lWidth = PenOrigWidth;
PEN_ShareUnlockPen(pbrPen); PEN_ShareUnlockPen(pbrPen);
DPRINT("IntArc Exit.\n"); DPRINT("IntArc Exit.\n");
return ret; return ret;

View file

@ -181,7 +181,7 @@ BRUSH_GetObject(PBRUSH pbrush, INT cjSize, LPLOGBRUSH plogbrush)
else if (pbrush->flAttrs & BR_IS_HATCH) else if (pbrush->flAttrs & BR_IS_HATCH)
{ {
plogbrush->lbStyle = BS_HATCHED; plogbrush->lbStyle = BS_HATCHED;
plogbrush->lbHatch = pbrush->ulStyle; plogbrush->lbHatch = pbrush->iHatch;
} }
else if (pbrush->flAttrs & BR_IS_DIB) else if (pbrush->flAttrs & BR_IS_DIB)
{ {
@ -293,7 +293,7 @@ IntGdiCreateHatchBrush(
pbrush->flAttrs |= BR_IS_HATCH; pbrush->flAttrs |= BR_IS_HATCH;
pbrush->BrushAttr.lbColor = Color & 0xFFFFFF; pbrush->BrushAttr.lbColor = Color & 0xFFFFFF;
pbrush->ulStyle = Style; pbrush->iHatch = Style;
GDIOBJ_vUnlockObject(&pbrush->BaseObject); GDIOBJ_vUnlockObject(&pbrush->BaseObject);

View file

@ -13,31 +13,40 @@
*/ */
typedef struct _BRUSH typedef struct _BRUSH
{ {
/* Header for all gdi objects in the handle table. /* Header for all gdi objects in the handle table.
Do not (re)move this. */ Do not (re)move this. */
BASEOBJECT BaseObject; BASEOBJECT BaseObject;
ULONG ulStyle; ULONG iHatch; // This is not the brush style, but the hatch style!
HBITMAP hbmPattern; HBITMAP hbmPattern;
HBITMAP hbmClient; HBITMAP hbmClient;
ULONG flAttrs; ULONG flAttrs;
ULONG ulBrushUnique; ULONG ulBrushUnique;
BRUSH_ATTR *pBrushAttr; // Just like DC_ATTR, pointer to user data BRUSH_ATTR *pBrushAttr; // Pointer to the currently active brush attribute
BRUSH_ATTR BrushAttr; // " " DCOBJ, internal if pBrushAttr == Zero BRUSH_ATTR BrushAttr; // Internal brush attribute for global brushes
POINT ptOrigin; POINT ptOrigin;
ULONG bCacheGrabbed; ULONG bCacheGrabbed;
COLORREF crBack; COLORREF crBack;
COLORREF crFore; COLORREF crFore;
ULONG ulPalTime; ULONG ulPalTime;
ULONG ulSurfTime; ULONG ulSurfTime;
PVOID ulRealization; PVOID pvRBrush;
//ULONG Unknown4C[3]; HDEV hdev;
POINT ptPenWidth; //DWORD unk054;
ULONG ulPenStyle; LONG lWidth;
DWORD *pStyle; FLOAT eWidth;
ULONG dwStyleCount; ULONG ulPenStyle;
//ULONG Unknown6C; 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; } BRUSH, *PBRUSH;
typedef struct _EBRUSHOBJ 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_ShareLockBrush(hBrush) ((PBRUSH)GDIOBJ_ShareLockObj((HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH))
#define BRUSH_ShareUnlockBrush(pBrush) GDIOBJ_vDereferenceObject((POBJ)pBrush) #define BRUSH_ShareUnlockBrush(pBrush) GDIOBJ_vDereferenceObject((POBJ)pBrush)
INT FASTCALL BRUSH_GetObject (PBRUSH GdiObject, INT Count, LPLOGBRUSH Buffer); INT
VOID NTAPI BRUSH_vCleanup(PVOID ObjectBody); FASTCALL
BRUSH_GetObject(
PBRUSH GdiObject,
INT Count,
LPLOGBRUSH Buffer);
VOID
NTAPI
BRUSH_vCleanup(
PVOID ObjectBody);
extern HSURF gahsurfHatch[HS_DDI_MAX]; extern HSURF gahsurfHatch[HS_DDI_MAX];

View file

@ -139,7 +139,7 @@ app_draw_ellipse(DC *g, Rect r, PBRUSH pbrush)
int d2xt = b2+b2; int d2xt = b2+b2;
int d2yt = a2+a2; 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 */ /* 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 d2xt = b2+b2;
int d2yt = a2+a2; 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 */ /* 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; Rect r;
int rx, ry; /* Radius in x and y directions */ 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)); r = rect( Left, Top, abs(Right-Left), abs(Bottom-Top));
rx = Wellipse/2; rx = Wellipse/2;

View file

@ -252,7 +252,7 @@ NtGdiEllipse(
return FALSE; return FALSE;
} }
PenOrigWidth = PenWidth = pbrush->ptPenWidth.x; PenOrigWidth = PenWidth = pbrush->lWidth;
if (pbrush->ulPenStyle == PS_NULL) PenWidth = 0; if (pbrush->ulPenStyle == PS_NULL) PenWidth = 0;
if (pbrush->ulPenStyle == PS_INSIDEFRAME) if (pbrush->ulPenStyle == PS_INSIDEFRAME)
@ -266,7 +266,7 @@ NtGdiEllipse(
} }
if (!PenWidth) PenWidth = 1; if (!PenWidth) PenWidth = 1;
pbrush->ptPenWidth.x = PenWidth; pbrush->lWidth = PenWidth;
RectBounds.left = Left; RectBounds.left = Left;
RectBounds.right = Right; RectBounds.right = Right;
@ -330,7 +330,7 @@ NtGdiEllipse(
DC_vFinishBlit(dc, NULL); DC_vFinishBlit(dc, NULL);
} }
pbrush->ptPenWidth.x = PenOrigWidth; pbrush->lWidth = PenOrigWidth;
PEN_ShareUnlockPen(pbrush); PEN_ShareUnlockPen(pbrush);
DC_UnlockDc(dc); DC_UnlockDc(dc);
DPRINT("Ellipse Exit.\n"); DPRINT("Ellipse Exit.\n");
@ -760,7 +760,7 @@ IntRoundRect(
return FALSE; return FALSE;
} }
PenOrigWidth = PenWidth = pbrLine->ptPenWidth.x; PenOrigWidth = PenWidth = pbrLine->lWidth;
if (pbrLine->ulPenStyle == PS_NULL) PenWidth = 0; if (pbrLine->ulPenStyle == PS_NULL) PenWidth = 0;
if (pbrLine->ulPenStyle == PS_INSIDEFRAME) if (pbrLine->ulPenStyle == PS_INSIDEFRAME)
@ -774,7 +774,7 @@ IntRoundRect(
} }
if (!PenWidth) PenWidth = 1; if (!PenWidth) PenWidth = 1;
pbrLine->ptPenWidth.x = PenWidth; pbrLine->lWidth = PenWidth;
RectBounds.left = Left; RectBounds.left = Left;
RectBounds.top = Top; RectBounds.top = Top;
@ -829,7 +829,7 @@ IntRoundRect(
} }
pbrLine->ptPenWidth.x = PenOrigWidth; pbrLine->lWidth = PenOrigWidth;
PEN_ShareUnlockPen(pbrLine); PEN_ShareUnlockPen(pbrLine);
return ret; return ret;
} }

View file

@ -120,11 +120,11 @@ IntGdiExtCreatePen(
if ((bOldStylePen) && (!dwWidth) && ((dwPenStyle & PS_STYLE_MASK) != PS_SOLID)) if ((bOldStylePen) && (!dwWidth) && ((dwPenStyle & PS_STYLE_MASK) != PS_SOLID))
dwWidth = 1; dwWidth = 1;
pbrushPen->ptPenWidth.x = dwWidth; pbrushPen->lWidth = dwWidth;
pbrushPen->ptPenWidth.y = 0; pbrushPen->eWidth = (FLOAT)pbrushPen->lWidth;
pbrushPen->ulPenStyle = dwPenStyle; pbrushPen->ulPenStyle = dwPenStyle;
pbrushPen->BrushAttr.lbColor = ulColor; pbrushPen->BrushAttr.lbColor = ulColor;
pbrushPen->ulStyle = ulBrushStyle; pbrushPen->iBrushStyle = ulBrushStyle;
// FIXME: Copy the bitmap first ? // FIXME: Copy the bitmap first ?
pbrushPen->hbmClient = (HANDLE)ulClientHatch; pbrushPen->hbmClient = (HANDLE)ulClientHatch;
pbrushPen->dwStyleCount = dwStyleCount; pbrushPen->dwStyleCount = dwStyleCount;
@ -256,7 +256,7 @@ PEN_GetObject(PBRUSH pbrushPen, INT cbCount, PLOGPEN pBuffer)
pExtLogPen = (PEXTLOGPEN)pBuffer; pExtLogPen = (PEXTLOGPEN)pBuffer;
pExtLogPen->elpPenStyle = pbrushPen->ulPenStyle; pExtLogPen->elpPenStyle = pbrushPen->ulPenStyle;
pExtLogPen->elpWidth = 0; pExtLogPen->elpWidth = 0;
pExtLogPen->elpBrushStyle = pbrushPen->ulStyle; pExtLogPen->elpBrushStyle = pbrushPen->iBrushStyle;
pExtLogPen->elpColor = pbrushPen->BrushAttr.lbColor; pExtLogPen->elpColor = pbrushPen->BrushAttr.lbColor;
pExtLogPen->elpHatch = 0; pExtLogPen->elpHatch = 0;
pExtLogPen->elpNumEntries = 0; pExtLogPen->elpNumEntries = 0;
@ -265,7 +265,8 @@ PEN_GetObject(PBRUSH pbrushPen, INT cbCount, PLOGPEN pBuffer)
else else
{ {
pLogPen = (PLOGPEN)pBuffer; pLogPen = (PLOGPEN)pBuffer;
pLogPen->lopnWidth = pbrushPen->ptPenWidth; pLogPen->lopnWidth.x = pbrushPen->lWidth;
pLogPen->lopnWidth.y = 0;
pLogPen->lopnStyle = pbrushPen->ulPenStyle; pLogPen->lopnStyle = pbrushPen->ulPenStyle;
pLogPen->lopnColor = pbrushPen->BrushAttr.lbColor; pLogPen->lopnColor = pbrushPen->BrushAttr.lbColor;
} }
@ -282,8 +283,8 @@ PEN_GetObject(PBRUSH pbrushPen, INT cbCount, PLOGPEN pBuffer)
if (cbCount < cbRetCount) return 0; if (cbCount < cbRetCount) return 0;
pExtLogPen = (PEXTLOGPEN)pBuffer; pExtLogPen = (PEXTLOGPEN)pBuffer;
pExtLogPen->elpPenStyle = pbrushPen->ulPenStyle; pExtLogPen->elpPenStyle = pbrushPen->ulPenStyle;
pExtLogPen->elpWidth = pbrushPen->ptPenWidth.x; pExtLogPen->elpWidth = pbrushPen->lWidth;
pExtLogPen->elpBrushStyle = pbrushPen->ulStyle; pExtLogPen->elpBrushStyle = pbrushPen->iBrushStyle;
pExtLogPen->elpColor = pbrushPen->BrushAttr.lbColor; pExtLogPen->elpColor = pbrushPen->BrushAttr.lbColor;
pExtLogPen->elpHatch = (ULONG_PTR)pbrushPen->hbmClient; pExtLogPen->elpHatch = (ULONG_PTR)pbrushPen->hbmClient;
pExtLogPen->elpNumEntries = pbrushPen->dwStyleCount; pExtLogPen->elpNumEntries = pbrushPen->dwStyleCount;

View file

@ -114,11 +114,12 @@ IntCreateStockPen(DWORD dwPenStyle,
if ((dwPenStyle & PS_STYLE_MASK) == PS_NULL) dwWidth = 1; if ((dwPenStyle & PS_STYLE_MASK) == PS_NULL) dwWidth = 1;
pbrushPen->ptPenWidth.x = abs(dwWidth); pbrushPen->iHatch = 0;
pbrushPen->ptPenWidth.y = 0; pbrushPen->lWidth = abs(dwWidth);
pbrushPen->eWidth = (FLOAT)pbrushPen->lWidth;
pbrushPen->ulPenStyle = dwPenStyle; pbrushPen->ulPenStyle = dwPenStyle;
pbrushPen->BrushAttr.lbColor = ulColor; pbrushPen->BrushAttr.lbColor = ulColor;
pbrushPen->ulStyle = ulBrushStyle; pbrushPen->iBrushStyle = ulBrushStyle;
pbrushPen->hbmClient = (HANDLE)NULL; pbrushPen->hbmClient = (HANDLE)NULL;
pbrushPen->dwStyleCount = 0; pbrushPen->dwStyleCount = 0;
pbrushPen->pStyle = 0; pbrushPen->pStyle = 0;