mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-01 12:23:29 +00:00
1. implemented hatched brushes
2. fixed memory leak when deleting patterned brushes 3. use brush origin in dib code svn path=/trunk/; revision=9214
This commit is contained in:
@@ -31,7 +31,7 @@ typedef struct
|
||||
ULONG ulBrushUnique;
|
||||
BRUSHATTR *pBrushAttr;
|
||||
BRUSHATTR BrushAttr;
|
||||
ULONG Unknown30;
|
||||
POINT ptOrigin;
|
||||
ULONG bCacheGrabbed;
|
||||
COLORREF crBack;
|
||||
COLORREF crFore;
|
||||
@@ -66,7 +66,7 @@ typedef struct
|
||||
#define GDIBRUSH_IS_MASKING 0x8000 /* Pattern bitmap is used as transparent mask (?) */
|
||||
#define GDIBRUSH_CACHED_IS_SOLID 0x80000000
|
||||
|
||||
#define BRUSHOBJ_AllocBrush() ((HBRUSH) GDIOBJ_AllocObj (sizeof(GDIBRUSHOBJ), GDI_OBJECT_TYPE_BRUSH, NULL))
|
||||
#define BRUSHOBJ_AllocBrush() ((HBRUSH) GDIOBJ_AllocObj (sizeof(GDIBRUSHOBJ), GDI_OBJECT_TYPE_BRUSH, (GDICLEANUPPROC) Brush_InternalDelete))
|
||||
#define BRUSHOBJ_FreeBrush(hBrush) GDIOBJ_FreeObj((HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH, GDIOBJFLAG_DEFAULT)
|
||||
#define BRUSHOBJ_LockBrush(hBrush) ((PGDIBRUSHOBJ)GDIOBJ_LockObj((HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH))
|
||||
#define BRUSHOBJ_UnlockBrush(hBrush) GDIOBJ_UnlockObj((HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH)
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: dib16bpp.c,v 1.29 2004/04/09 22:00:38 navaraf Exp $ */
|
||||
/* $Id: dib16bpp.c,v 1.30 2004/04/25 11:34:12 weiden Exp $ */
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <stdlib.h>
|
||||
@@ -351,7 +351,7 @@ DIB_16BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||
SourceX = SourcePoint->x;
|
||||
|
||||
if(UsesPattern)
|
||||
PatternY = Y % PatternHeight;
|
||||
PatternY = (Y + BrushOrigin.y) % PatternHeight;
|
||||
|
||||
for (X = DestRect->left; X < RoundedRight; X += 2, DestBits++, SourceX += 2)
|
||||
{
|
||||
@@ -365,8 +365,8 @@ DIB_16BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||
|
||||
if (UsesPattern)
|
||||
{
|
||||
Pattern = (DIB_1BPP_GetPixel(PatternObj, X % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack);
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (X + 1) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 16;
|
||||
Pattern = (DIB_1BPP_GetPixel(PatternObj, (X + BrushOrigin.x) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack);
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (X + BrushOrigin.x + 1) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 16;
|
||||
}
|
||||
|
||||
*DestBits = DIB_DoRop(Rop4, Dest, Source, Pattern);
|
||||
@@ -383,7 +383,7 @@ DIB_16BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||
|
||||
if (UsesPattern)
|
||||
{
|
||||
Pattern = DIB_1BPP_GetPixel(PatternObj, X % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
|
||||
Pattern = DIB_1BPP_GetPixel(PatternObj, (X + BrushOrigin.x) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
|
||||
}
|
||||
|
||||
DIB_16BPP_PutPixel(DestSurf, X, Y, DIB_DoRop(Rop4, Dest, Source, Pattern) & 0xFFFF);
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: dib1bpp.c,v 1.24 2004/04/09 22:00:38 navaraf Exp $ */
|
||||
/* $Id: dib1bpp.c,v 1.25 2004/04/25 11:34:12 weiden Exp $ */
|
||||
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
@@ -423,7 +423,7 @@ DIB_1BPP_BitBlt(
|
||||
Y * DestSurf->lDelta);
|
||||
|
||||
if(UsesPattern)
|
||||
PatternY = Y % PatternHeight;
|
||||
PatternY = (Y + BrushOrigin.y) % PatternHeight;
|
||||
|
||||
X = DestRect->left;
|
||||
if (X & 31)
|
||||
@@ -444,7 +444,7 @@ DIB_1BPP_BitBlt(
|
||||
{
|
||||
Pattern = 0;
|
||||
for (k = 31 - NoBits; k < NoBits; k++)
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (X + k) % PatternWidth, PatternY) << (31 - k));
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (X + BrushOrigin.x + k) % PatternWidth, PatternY) << (31 - k));
|
||||
}
|
||||
|
||||
Dest = DIB_DoRop(Rop4, Dest, Source, Pattern);
|
||||
@@ -478,10 +478,10 @@ DIB_1BPP_BitBlt(
|
||||
Pattern = 0;
|
||||
for (k = 0; k < 8; k++)
|
||||
{
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (X + k) % PatternWidth, PatternY) << (7 - k));
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (X + k + 8) % PatternWidth, PatternY) << (8 + (7 - k)));
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (X + k + 16) % PatternWidth, PatternY) << (16 + (7 - k)));
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (X + k + 24) % PatternWidth, PatternY) << (24 + (7 - k)));
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (X + BrushOrigin.x + k) % PatternWidth, PatternY) << (7 - k));
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (X + BrushOrigin.x + k + 8) % PatternWidth, PatternY) << (8 + (7 - k)));
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (X + BrushOrigin.x + k + 16) % PatternWidth, PatternY) << (16 + (7 - k)));
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (X + BrushOrigin.x + k + 24) % PatternWidth, PatternY) << (24 + (7 - k)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -503,7 +503,7 @@ DIB_1BPP_BitBlt(
|
||||
|
||||
if (UsesPattern)
|
||||
{
|
||||
Pattern = DIB_1BPP_GetPixel(PatternObj, X % PatternWidth, PatternY);
|
||||
Pattern = DIB_1BPP_GetPixel(PatternObj, (X + BrushOrigin.x) % PatternWidth, PatternY);
|
||||
}
|
||||
|
||||
DIB_1BPP_PutPixel(DestSurf, X, Y, DIB_DoRop(Rop4, Dest, Source, Pattern) & 0xF);
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: dib24bpp.c,v 1.24 2004/04/09 22:00:38 navaraf Exp $ */
|
||||
/* $Id: dib24bpp.c,v 1.25 2004/04/25 11:34:12 weiden Exp $ */
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <stdlib.h>
|
||||
@@ -319,7 +319,7 @@ DIB_24BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||
SourceX = SourcePoint->x;
|
||||
|
||||
if(UsesPattern)
|
||||
PatternY = Y % PatternHeight;
|
||||
PatternY = (Y + BrushOrigin.y) % PatternHeight;
|
||||
|
||||
for (X = DestRect->left; X < DestRect->right; X++, DestBits += 3, SourceX++)
|
||||
{
|
||||
@@ -332,7 +332,7 @@ DIB_24BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||
|
||||
if (UsesPattern)
|
||||
{
|
||||
Pattern = DIB_1BPP_GetPixel(PatternObj, X % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
|
||||
Pattern = DIB_1BPP_GetPixel(PatternObj, (X + BrushOrigin.x) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
|
||||
}
|
||||
|
||||
Dest = DIB_DoRop(Rop4, Dest, Source, Pattern) & 0xFFFFFF;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: dib32bpp.c,v 1.24 2004/04/09 22:00:38 navaraf Exp $ */
|
||||
/* $Id: dib32bpp.c,v 1.25 2004/04/25 11:34:12 weiden Exp $ */
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <stdlib.h>
|
||||
@@ -370,7 +370,7 @@ DIB_32BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||
SourceX = SourcePoint->x;
|
||||
|
||||
if(UsesPattern)
|
||||
PatternY = Y % PatternHeight;
|
||||
PatternY = (Y + BrushOrigin.y) % PatternHeight;
|
||||
|
||||
for (X = DestRect->left; X < DestRect->right; X++, DestBits++, SourceX++)
|
||||
{
|
||||
@@ -383,7 +383,7 @@ DIB_32BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||
|
||||
if (UsesPattern)
|
||||
{
|
||||
Pattern = DIB_1BPP_GetPixel(PatternObj, X % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
|
||||
Pattern = DIB_1BPP_GetPixel(PatternObj, (X + BrushOrigin.x) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
|
||||
}
|
||||
|
||||
*DestBits = DIB_DoRop(Rop4, Dest, Source, Pattern);
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: dib8bpp.c,v 1.22 2004/04/09 22:00:38 navaraf Exp $ */
|
||||
/* $Id: dib8bpp.c,v 1.23 2004/04/25 11:34:12 weiden Exp $ */
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <stdlib.h>
|
||||
@@ -343,7 +343,7 @@ DIB_8BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||
DestBits = (PULONG)(DestSurf->pvScan0 + DestRect->left + j * DestSurf->lDelta);
|
||||
|
||||
if(UsesPattern)
|
||||
PatternY = j % PatternHeight;
|
||||
PatternY = (j + BrushOrigin.y) % PatternHeight;
|
||||
|
||||
for (i = DestRect->left; i < RoundedRight; i += 4, DestBits++)
|
||||
{
|
||||
@@ -358,10 +358,10 @@ DIB_8BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||
|
||||
if (UsesPattern)
|
||||
{
|
||||
Pattern = DIB_1BPP_GetPixel(PatternObj, i % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + 1) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 8;
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + 2) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 16;
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + 3) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 24;
|
||||
Pattern = DIB_1BPP_GetPixel(PatternObj, (i + BrushOrigin.x) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + BrushOrigin.x + 1) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 8;
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + BrushOrigin.x + 2) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 16;
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + BrushOrigin.x + 3) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 24;
|
||||
}
|
||||
*DestBits = DIB_DoRop(Rop4, Dest, Source, Pattern);
|
||||
}
|
||||
@@ -378,7 +378,7 @@ DIB_8BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||
|
||||
if (UsesPattern)
|
||||
{
|
||||
Pattern = DIB_1BPP_GetPixel(PatternObj, i % PatternWidth,PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
|
||||
Pattern = DIB_1BPP_GetPixel(PatternObj, (i + BrushOrigin.x) % PatternWidth,PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
|
||||
}
|
||||
|
||||
DIB_8BPP_PutPixel(DestSurf, i, j, DIB_DoRop(Rop4, Dest, Source, Pattern) & 0xFFFF);
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: bitblt.c,v 1.51 2004/04/10 00:58:14 navaraf Exp $
|
||||
/* $Id: bitblt.c,v 1.52 2004/04/25 11:34:13 weiden Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
@@ -371,6 +371,7 @@ EngBitBlt(SURFOBJ *DestObj,
|
||||
OutputRect.top = DestRect->top + Translate.y;
|
||||
OutputRect.bottom = DestRect->bottom + Translate.y;
|
||||
|
||||
#if 0
|
||||
if(BrushOrigin)
|
||||
{
|
||||
AdjustedBrushOrigin.x = BrushOrigin->x + Translate.x;
|
||||
@@ -378,6 +379,9 @@ EngBitBlt(SURFOBJ *DestObj,
|
||||
}
|
||||
else
|
||||
AdjustedBrushOrigin = Translate;
|
||||
#else
|
||||
AdjustedBrushOrigin = (BrushOrigin ? *BrushOrigin : Translate);
|
||||
#endif
|
||||
|
||||
if (NULL != OutputObj)
|
||||
{
|
||||
@@ -738,7 +742,7 @@ EngStretchBlt(
|
||||
OutputRect.right = prclDest->right + Translate.x;
|
||||
OutputRect.top = prclDest->top + Translate.y;
|
||||
OutputRect.bottom = prclDest->bottom + Translate.y;
|
||||
|
||||
#if 0
|
||||
if(BrushOrigin)
|
||||
{
|
||||
AdjustedBrushOrigin.x = BrushOrigin->x + Translate.x;
|
||||
@@ -746,6 +750,9 @@ EngStretchBlt(
|
||||
}
|
||||
else
|
||||
AdjustedBrushOrigin = Translate;
|
||||
#else
|
||||
AdjustedBrushOrigin = (BrushOrigin ? *BrushOrigin : Translate);
|
||||
#endif
|
||||
|
||||
if (NULL != OutputObj)
|
||||
{
|
||||
@@ -1134,6 +1141,7 @@ EngMaskBitBlt(SURFOBJ *DestObj,
|
||||
OutputRect.top = DestRect->top + Translate.y;
|
||||
OutputRect.bottom = DestRect->bottom + Translate.y;
|
||||
|
||||
#if 0
|
||||
if(BrushOrigin)
|
||||
{
|
||||
AdjustedBrushOrigin.x = BrushOrigin->x + Translate.x;
|
||||
@@ -1141,6 +1149,9 @@ EngMaskBitBlt(SURFOBJ *DestObj,
|
||||
}
|
||||
else
|
||||
AdjustedBrushOrigin = Translate;
|
||||
#else
|
||||
AdjustedBrushOrigin = (BrushOrigin ? *BrushOrigin : Translate);
|
||||
#endif
|
||||
|
||||
if (NULL != OutputObj)
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: bitmaps.c,v 1.69 2004/04/09 20:03:20 navaraf Exp $ */
|
||||
/* $Id: bitmaps.c,v 1.70 2004/04/25 11:34:13 weiden Exp $ */
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <stdlib.h>
|
||||
@@ -56,7 +56,7 @@ NtGdiBitBlt(
|
||||
SURFOBJ *SurfDest, *SurfSrc;
|
||||
PSURFGDI SurfGDIDest, SurfGDISrc;
|
||||
RECTL DestRect;
|
||||
POINTL SourcePoint;
|
||||
POINTL SourcePoint, BrushOrigin;
|
||||
BOOL Status;
|
||||
PPALGDI PalDestGDI, PalSourceGDI;
|
||||
XLATEOBJ *XlateObj = NULL;
|
||||
@@ -114,6 +114,9 @@ NtGdiBitBlt(
|
||||
|
||||
SourcePoint.x = XSrc;
|
||||
SourcePoint.y = YSrc;
|
||||
|
||||
BrushOrigin.x = 0;
|
||||
BrushOrigin.y = 0;
|
||||
|
||||
/* Determine surfaces to be used in the bitblt */
|
||||
SurfDest = (SURFOBJ*)AccessUserObject((ULONG)DCDest->Surface);
|
||||
@@ -142,6 +145,7 @@ NtGdiBitBlt(
|
||||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
BrushOrigin = BrushObj->ptOrigin;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -244,7 +248,7 @@ NtGdiBitBlt(
|
||||
|
||||
/* Perform the bitblt operation */
|
||||
Status = IntEngBitBlt(SurfDest, SurfSrc, NULL, DCDest->CombinedClip, XlateObj,
|
||||
&DestRect, &SourcePoint, NULL, &BrushObj->BrushObject, NULL, ROP);
|
||||
&DestRect, &SourcePoint, NULL, &BrushObj->BrushObject, &BrushOrigin, ROP);
|
||||
|
||||
EngDeleteXlate(XlateObj);
|
||||
if (NULL != Mono)
|
||||
@@ -1071,7 +1075,10 @@ NtGdiSetPixelV(
|
||||
return(FALSE);
|
||||
OldBrush = NtGdiSelectObject(hDC, NewBrush);
|
||||
if (OldBrush == NULL)
|
||||
{
|
||||
NtGdiDeleteObject(NewBrush);
|
||||
return(FALSE);
|
||||
}
|
||||
NtGdiPatBlt(hDC, X, Y, 1, 1, PATCOPY);
|
||||
NtGdiSelectObject(hDC, OldBrush);
|
||||
NtGdiDeleteObject(NewBrush);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: brush.c,v 1.34 2004/04/09 20:03:20 navaraf Exp $
|
||||
* $Id: brush.c,v 1.35 2004/04/25 11:34:13 weiden Exp $
|
||||
*/
|
||||
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
@@ -33,12 +33,56 @@
|
||||
#define NDEBUG
|
||||
#include <win32k/debug1.h>
|
||||
|
||||
static const USHORT HatchBrushes[NB_HATCH_STYLES][8] =
|
||||
{
|
||||
{0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00}, /* HS_HORIZONTAL */
|
||||
{0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08}, /* HS_VERTICAL */
|
||||
{0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80}, /* HS_FDIAGONAL */
|
||||
{0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01}, /* HS_BDIAGONAL */
|
||||
{0x08, 0x08, 0x08, 0xff, 0x08, 0x08, 0x08, 0x08}, /* HS_CROSS */
|
||||
{0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81} /* HS_DIAGCROSS */
|
||||
};
|
||||
|
||||
BOOL FASTCALL
|
||||
Brush_InternalDelete( PGDIBRUSHOBJ pBrush )
|
||||
{
|
||||
ASSERT(pBrush);
|
||||
|
||||
if(pBrush->flAttrs & (GDIBRUSH_IS_HATCH | GDIBRUSH_IS_BITMAP))
|
||||
{
|
||||
ASSERT(pBrush->hbmPattern);
|
||||
NtGdiDeleteObject(pBrush->hbmPattern);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
HBRUSH FASTCALL
|
||||
IntGdiCreateBrushIndirect(PLOGBRUSH LogBrush)
|
||||
{
|
||||
PGDIBRUSHOBJ BrushObject;
|
||||
HBRUSH hBrush;
|
||||
|
||||
HBITMAP hPattern;
|
||||
|
||||
switch (LogBrush->lbStyle)
|
||||
{
|
||||
case BS_HATCHED:
|
||||
if(!(hPattern = NtGdiCreateBitmap(8, 8, 1, 1, HatchBrushes[LogBrush->lbHatch])))
|
||||
{
|
||||
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
case BS_PATTERN:
|
||||
if(!(hPattern = BITMAPOBJ_CopyBitmap((HBITMAP)LogBrush->lbHatch)))
|
||||
{
|
||||
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
hBrush = BRUSHOBJ_AllocBrush();
|
||||
if (hBrush == NULL)
|
||||
{
|
||||
@@ -51,22 +95,26 @@ IntGdiCreateBrushIndirect(PLOGBRUSH LogBrush)
|
||||
switch (LogBrush->lbStyle)
|
||||
{
|
||||
case BS_NULL:
|
||||
BrushObject->flAttrs = GDIBRUSH_IS_NULL;
|
||||
BrushObject->flAttrs |= GDIBRUSH_IS_NULL;
|
||||
break;
|
||||
|
||||
/* FIXME */
|
||||
case BS_HATCHED:
|
||||
|
||||
case BS_SOLID:
|
||||
BrushObject->flAttrs = GDIBRUSH_IS_SOLID;
|
||||
BrushObject->flAttrs |= GDIBRUSH_IS_SOLID;
|
||||
BrushObject->BrushAttr.lbColor = LogBrush->lbColor & 0xFFFFFF;
|
||||
BrushObject->BrushObject.iSolidColor = BrushObject->BrushAttr.lbColor;
|
||||
/* FIXME: Fill in the rest of fields!!! */
|
||||
break;
|
||||
|
||||
case BS_HATCHED:
|
||||
BrushObject->flAttrs |= GDIBRUSH_IS_HATCH;
|
||||
BrushObject->hbmPattern = hPattern;
|
||||
BrushObject->BrushAttr.lbColor = LogBrush->lbColor & 0xFFFFFF;
|
||||
BrushObject->BrushObject.iSolidColor = 0xFFFFFFFF;
|
||||
break;
|
||||
|
||||
case BS_PATTERN:
|
||||
BrushObject->flAttrs = GDIBRUSH_IS_BITMAP;
|
||||
BrushObject->hbmPattern = BITMAPOBJ_CopyBitmap((HBITMAP)LogBrush->lbHatch);
|
||||
BrushObject->flAttrs |= GDIBRUSH_IS_BITMAP;
|
||||
BrushObject->hbmPattern = hPattern;
|
||||
BrushObject->BrushObject.iSolidColor = 0xFFFFFFFF;
|
||||
/* FIXME: Fill in the rest of fields!!! */
|
||||
break;
|
||||
@@ -92,6 +140,7 @@ IntPatBlt(
|
||||
{
|
||||
RECTL DestRect;
|
||||
SURFOBJ *SurfObj;
|
||||
POINTL BrushOrigin;
|
||||
BOOL ret;
|
||||
|
||||
SurfObj = (SURFOBJ *)AccessUserObject((ULONG)dc->Surface);
|
||||
@@ -125,6 +174,9 @@ IntPatBlt(
|
||||
DestRect.top = YLeft + Height + dc->w.DCOrgY + 1;
|
||||
DestRect.bottom = YLeft + dc->w.DCOrgY + 1;
|
||||
}
|
||||
|
||||
BrushOrigin.x = BrushObj->ptOrigin.x + dc->w.DCOrgX;
|
||||
BrushOrigin.y = BrushObj->ptOrigin.y + dc->w.DCOrgY;
|
||||
|
||||
ret = IntEngBitBlt(
|
||||
SurfObj,
|
||||
@@ -136,7 +188,7 @@ IntPatBlt(
|
||||
NULL,
|
||||
NULL,
|
||||
&BrushObj->BrushObject,
|
||||
NULL,
|
||||
&BrushOrigin,
|
||||
ROP);
|
||||
}
|
||||
|
||||
@@ -221,7 +273,9 @@ NtGdiCreateHatchBrush(INT Style, COLORREF Color)
|
||||
LOGBRUSH LogBrush;
|
||||
|
||||
if (Style < 0 || Style >= NB_HATCH_STYLES)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
LogBrush.lbStyle = BS_HATCHED;
|
||||
LogBrush.lbColor = Color;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: dc.c,v 1.128 2004/04/09 20:03:20 navaraf Exp $
|
||||
/* $Id: dc.c,v 1.129 2004/04/25 11:34:13 weiden Exp $
|
||||
*
|
||||
* DC.C - Device context functions
|
||||
*
|
||||
@@ -1797,7 +1797,13 @@ NtGdiSelectObject(HDC hDC, HGDIOBJ hGDIObj)
|
||||
brush->BrushObject.iSolidColor = 0xFFFFFFFF;
|
||||
}
|
||||
brush->crBack = XLATEOBJ_iXlate(XlateObj, dc->w.backgroundColor);
|
||||
brush->crFore = XLATEOBJ_iXlate(XlateObj, dc->w.textColor);
|
||||
brush->crFore = XLATEOBJ_iXlate(XlateObj, ((brush->flAttrs & GDIBRUSH_IS_HATCH) ?
|
||||
brush->BrushAttr.lbColor : dc->w.textColor));
|
||||
/* according to the documentation of SetBrushOrgEx(), the origin is assigned to the
|
||||
next brush selected into the DC, so we should set it here */
|
||||
brush->ptOrigin.x = dc->w.brushOrgX;
|
||||
brush->ptOrigin.y = dc->w.brushOrgY;
|
||||
|
||||
BRUSHOBJ_UnlockBrush((HBRUSH) hGDIObj);
|
||||
objOrg = (HGDIOBJ)dc->w.hBrush;
|
||||
dc->w.hBrush = (HBRUSH) hGDIObj;
|
||||
|
||||
Reference in New Issue
Block a user