- Change the prototype of DIB_*_BitBlt* functions to take a pointer to a BLTINFO structure instead of many parameters.

- Make DIB_GetSource and DIB_GetSourceIndex macros.
- Add IntEngCreateSrcMonoXlate.
- Change the semantics of IntEngCreate*Xlate functions to treat palette mode == 0 as mode of the passed palette.
- Add XlateBrush and XlatePen to the DC structure.
- Fixed the bad design decision that caused mess when one brush was selected into more than one DC.
- Remove incorrect Int[Get/Set]DCColor implementation (used by [Get/Set]DC[Pen/Brush]Color).
- Get rid of compiler warnings in Win32k.

svn path=/trunk/; revision=10116
This commit is contained in:
Filip Navara 2004-07-14 20:48:58 +00:00
parent d0ba990059
commit dcbabca872
35 changed files with 1322 additions and 1644 deletions

View file

@ -36,14 +36,9 @@ typedef struct
COLORREF crBack;
COLORREF crFore;
ULONG ulPalTime;
#if 0
ULONG ulSurfTime;
PVOID ulRealization;
ULONG Unknown4C[3];
#else
BRUSHOBJ BrushObject;
ULONG Unknown50[2];
#endif
POINT ptPenWidth;
ULONG ulPenStyle;
DWORD *pStyle;
@ -51,6 +46,13 @@ typedef struct
ULONG Unknown6C;
} GDIBRUSHOBJ, *PGDIBRUSHOBJ;
typedef struct
{
BRUSHOBJ BrushObject;
PGDIBRUSHOBJ GdiBrushObject;
XLATEOBJ *XlateObject;
} GDIBRUSHINST, *PGDIBRUSHINST;
/* GDI Brush Attributes */
#define GDIBRUSH_NEED_BK_CLR 0x0002 /* Background color is needed */

View file

@ -100,6 +100,9 @@ typedef struct _DC
CLIPOBJ *CombinedClip;
XLATEOBJ *XlateBrush;
XLATEOBJ *XlatePen;
INT saveLevel;
WIN_DC_INFO w;

View file

@ -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: dib.c,v 1.11 2004/07/03 13:55:35 navaraf Exp $ */
/* $Id: dib.c,v 1.12 2004/07/14 20:48:56 navaraf Exp $ */
#include <w32k.h>
/* Static data */
@ -29,106 +29,66 @@ DIB_FUNCTIONS DibFunctionsForBitmapFormat[] =
/* 0 */
{
Dummy_PutPixel, Dummy_GetPixel, Dummy_HLine, Dummy_VLine,
Dummy_BitBlt, Dummy_StretchBlt, Dummy_TransparentBlt
Dummy_BitBlt, Dummy_BitBlt, Dummy_StretchBlt, Dummy_TransparentBlt
},
/* BMF_1BPP */
{
DIB_1BPP_PutPixel, DIB_1BPP_GetPixel, DIB_1BPP_HLine, DIB_1BPP_VLine,
DIB_1BPP_BitBlt, DIB_1BPP_StretchBlt, DIB_1BPP_TransparentBlt
DIB_1BPP_BitBlt, DIB_1BPP_BitBltSrcCopy, DIB_1BPP_StretchBlt,
DIB_1BPP_TransparentBlt
},
/* BMF_4BPP */
{
DIB_4BPP_PutPixel, DIB_4BPP_GetPixel, DIB_4BPP_HLine, DIB_4BPP_VLine,
DIB_4BPP_BitBlt, DIB_4BPP_StretchBlt, DIB_4BPP_TransparentBlt
DIB_4BPP_BitBlt, DIB_4BPP_BitBltSrcCopy, DIB_4BPP_StretchBlt,
DIB_4BPP_TransparentBlt
},
/* BMF_8BPP */
{
DIB_8BPP_PutPixel, DIB_8BPP_GetPixel, DIB_8BPP_HLine, DIB_8BPP_VLine,
DIB_8BPP_BitBlt, DIB_8BPP_StretchBlt, DIB_8BPP_TransparentBlt
DIB_8BPP_BitBlt, DIB_8BPP_BitBltSrcCopy, DIB_8BPP_StretchBlt,
DIB_8BPP_TransparentBlt
},
/* BMF_16BPP */
{
DIB_16BPP_PutPixel, DIB_16BPP_GetPixel, DIB_16BPP_HLine, DIB_16BPP_VLine,
DIB_16BPP_BitBlt, DIB_16BPP_StretchBlt, DIB_16BPP_TransparentBlt
DIB_16BPP_BitBlt, DIB_16BPP_BitBltSrcCopy, DIB_16BPP_StretchBlt,
DIB_16BPP_TransparentBlt
},
/* BMF_24BPP */
{
DIB_24BPP_PutPixel, DIB_24BPP_GetPixel, DIB_24BPP_HLine, DIB_24BPP_VLine,
DIB_24BPP_BitBlt, DIB_24BPP_StretchBlt, DIB_24BPP_TransparentBlt
DIB_24BPP_BitBlt, DIB_24BPP_BitBltSrcCopy, DIB_24BPP_StretchBlt,
DIB_24BPP_TransparentBlt
},
/* BMF_32BPP */
{
DIB_32BPP_PutPixel, DIB_32BPP_GetPixel, DIB_32BPP_HLine, DIB_32BPP_VLine,
DIB_32BPP_BitBlt, DIB_32BPP_StretchBlt, DIB_32BPP_TransparentBlt
DIB_32BPP_BitBlt, DIB_32BPP_BitBltSrcCopy, DIB_32BPP_StretchBlt,
DIB_32BPP_TransparentBlt
},
/* BMF_4RLE */
{
Dummy_PutPixel, Dummy_GetPixel, Dummy_HLine, Dummy_VLine,
Dummy_BitBlt, Dummy_StretchBlt, Dummy_TransparentBlt
Dummy_BitBlt, Dummy_BitBlt, Dummy_StretchBlt, Dummy_TransparentBlt
},
/* BMF_8RLE */
{
Dummy_PutPixel, Dummy_GetPixel, Dummy_HLine, Dummy_VLine,
Dummy_BitBlt, Dummy_StretchBlt, Dummy_TransparentBlt
Dummy_BitBlt, Dummy_BitBlt, Dummy_StretchBlt, Dummy_TransparentBlt
},
/* BMF_JPEG */
{
Dummy_PutPixel, Dummy_GetPixel, Dummy_HLine, Dummy_VLine,
Dummy_BitBlt, Dummy_StretchBlt, Dummy_TransparentBlt
Dummy_BitBlt, Dummy_BitBlt, Dummy_StretchBlt, Dummy_TransparentBlt
},
/* BMF_PNG */
{
Dummy_PutPixel, Dummy_GetPixel, Dummy_HLine, Dummy_VLine,
Dummy_BitBlt, Dummy_StretchBlt, Dummy_TransparentBlt
Dummy_BitBlt, Dummy_BitBlt, Dummy_StretchBlt, Dummy_TransparentBlt
}
};
ULONG
DIB_GetSource(SURFOBJ* SourceSurf, ULONG sx, ULONG sy, XLATEOBJ* ColorTranslation)
{
switch (SourceSurf->iBitmapFormat)
{
case BMF_1BPP:
return(XLATEOBJ_iXlate(ColorTranslation, DIB_1BPP_GetPixel(SourceSurf, sx, sy)));
case BMF_4BPP:
return(XLATEOBJ_iXlate(ColorTranslation, DIB_4BPP_GetPixel(SourceSurf, sx, sy)));
case BMF_8BPP:
return(XLATEOBJ_iXlate(ColorTranslation, DIB_8BPP_GetPixel(SourceSurf, sx, sy)));
case BMF_16BPP:
return(XLATEOBJ_iXlate(ColorTranslation, DIB_16BPP_GetPixel(SourceSurf, sx, sy)));
case BMF_24BPP:
return(XLATEOBJ_iXlate(ColorTranslation, DIB_24BPP_GetPixel(SourceSurf, sx, sy)));
case BMF_32BPP:
return(XLATEOBJ_iXlate(ColorTranslation, DIB_32BPP_GetPixel(SourceSurf, sx, sy)));
default:
DPRINT1("DIB_GetSource: Unhandled number of bits per pixel in source (%d).\n", BitsPerFormat(SourceSurf->iBitmapFormat));
return(0);
}
}
ULONG
DIB_GetSourceIndex(SURFOBJ* SourceSurf, ULONG sx, ULONG sy)
{
switch (SourceSurf->iBitmapFormat)
{
case BMF_1BPP:
return DIB_1BPP_GetPixel(SourceSurf, sx, sy);
case BMF_4BPP:
return DIB_4BPP_GetPixel(SourceSurf, sx, sy);
case BMF_8BPP:
return DIB_8BPP_GetPixel(SourceSurf, sx, sy);
case BMF_16BPP:
return DIB_16BPP_GetPixel(SourceSurf, sx, sy);
case BMF_24BPP:
return DIB_24BPP_GetPixel(SourceSurf, sx, sy);
case BMF_32BPP:
return DIB_32BPP_GetPixel(SourceSurf, sx, sy);
default:
DPRINT1("DIB_GetOriginalSource: Unhandled number of bits per pixel in source (%d).\n", BitsPerFormat(SourceSurf->iBitmapFormat));
return(0);
}
}
ULONG
DIB_DoRop(ULONG Rop, ULONG Dest, ULONG Source, ULONG Pattern)
{
@ -249,10 +209,7 @@ VOID Dummy_VLine(SURFOBJ* SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
return;
}
BOOLEAN Dummy_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
RECTL* DestRect, POINTL *SourcePoint,
BRUSHOBJ* BrushObj, POINTL BrushOrign,
XLATEOBJ *ColorTranslation, ULONG Rop4)
BOOLEAN Dummy_BitBlt(PBLTINFO BltInfo)
{
return FALSE;
}

View file

@ -1,11 +1,25 @@
#ifndef _W32K_DIB_DIB_H
#define _W32K_DIB_DIB_H
typedef struct _BLTINFO
{
SURFOBJ *DestSurface;
SURFOBJ *SourceSurface;
SURFOBJ *PatternSurface;
XLATEOBJ *XlateSourceToDest;
XLATEOBJ *XlatePatternToDest;
RECTL DestRect;
POINTL SourcePoint;
BRUSHOBJ *Brush;
POINTL BrushOrigin;
ULONG Rop4;
} BLTINFO, *PBLTINFO;
typedef VOID (*PFN_DIB_PutPixel)(SURFOBJ*,LONG,LONG,ULONG);
typedef ULONG (*PFN_DIB_GetPixel)(SURFOBJ*,LONG,LONG);
typedef VOID (*PFN_DIB_HLine)(SURFOBJ*,LONG,LONG,LONG,ULONG);
typedef VOID (*PFN_DIB_VLine)(SURFOBJ*,LONG,LONG,LONG,ULONG);
typedef BOOLEAN (*PFN_DIB_BitBlt)(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,BRUSHOBJ*,POINTL,XLATEOBJ*,ULONG);
typedef BOOLEAN (*PFN_DIB_BitBlt)(PBLTINFO);
typedef BOOLEAN (*PFN_DIB_StretchBlt)(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,POINTL,CLIPOBJ*,XLATEOBJ*,ULONG);
typedef BOOLEAN (*PFN_DIB_TransparentBlt)(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULONG);
@ -16,137 +30,92 @@ typedef struct
PFN_DIB_HLine DIB_HLine;
PFN_DIB_VLine DIB_VLine;
PFN_DIB_BitBlt DIB_BitBlt;
PFN_DIB_BitBlt DIB_BitBltSrcCopy;
PFN_DIB_StretchBlt DIB_StretchBlt;
PFN_DIB_TransparentBlt DIB_TransparentBlt;
} DIB_FUNCTIONS;
extern DIB_FUNCTIONS DibFunctionsForBitmapFormat[];
VOID Dummy_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
ULONG Dummy_GetPixel(SURFOBJ*,LONG,LONG);
VOID Dummy_HLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
VOID Dummy_VLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
BOOLEAN Dummy_BitBlt(PBLTINFO);
BOOLEAN Dummy_StretchBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,POINTL,CLIPOBJ*,XLATEOBJ*,ULONG);
BOOLEAN Dummy_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULONG);
VOID DIB_1BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
ULONG DIB_1BPP_GetPixel(SURFOBJ*,LONG,LONG);
VOID DIB_1BPP_HLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
VOID DIB_1BPP_VLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
BOOLEAN DIB_1BPP_BitBlt(PBLTINFO);
BOOLEAN DIB_1BPP_BitBltSrcCopy(PBLTINFO);
BOOLEAN DIB_1BPP_StretchBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,POINTL,CLIPOBJ*,XLATEOBJ*,ULONG);
BOOLEAN DIB_1BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULONG);
VOID DIB_4BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
ULONG DIB_4BPP_GetPixel(SURFOBJ*,LONG,LONG);
VOID DIB_4BPP_HLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
VOID DIB_4BPP_VLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
BOOLEAN DIB_4BPP_BitBlt(PBLTINFO);
BOOLEAN DIB_4BPP_BitBltSrcCopy(PBLTINFO);
BOOLEAN DIB_4BPP_StretchBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,POINTL,CLIPOBJ*,XLATEOBJ*,ULONG);
BOOLEAN DIB_4BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULONG);
VOID DIB_8BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
ULONG DIB_8BPP_GetPixel(SURFOBJ*,LONG,LONG);
VOID DIB_8BPP_HLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
VOID DIB_8BPP_VLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
BOOLEAN DIB_8BPP_BitBlt(PBLTINFO);
BOOLEAN DIB_8BPP_BitBltSrcCopy(PBLTINFO);
BOOLEAN DIB_8BPP_StretchBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,POINTL,CLIPOBJ*,XLATEOBJ*,ULONG);
BOOLEAN DIB_8BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULONG);
VOID DIB_16BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
ULONG DIB_16BPP_GetPixel(SURFOBJ*,LONG,LONG);
VOID DIB_16BPP_HLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
VOID DIB_16BPP_VLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
BOOLEAN DIB_16BPP_BitBlt(PBLTINFO);
BOOLEAN DIB_16BPP_BitBltSrcCopy(PBLTINFO);
BOOLEAN DIB_16BPP_StretchBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,POINTL,CLIPOBJ*,XLATEOBJ*,ULONG);
BOOLEAN DIB_16BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULONG);
VOID DIB_24BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
ULONG DIB_24BPP_GetPixel(SURFOBJ*,LONG,LONG);
VOID DIB_24BPP_HLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
VOID DIB_24BPP_VLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
BOOLEAN DIB_24BPP_BitBlt(PBLTINFO);
BOOLEAN DIB_24BPP_BitBltSrcCopy(PBLTINFO);
BOOLEAN DIB_24BPP_StretchBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,POINTL,CLIPOBJ*,XLATEOBJ*,ULONG);
BOOLEAN DIB_24BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULONG);
VOID DIB_32BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
ULONG DIB_32BPP_GetPixel(SURFOBJ*,LONG,LONG);
VOID DIB_32BPP_HLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
VOID DIB_32BPP_VLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
BOOLEAN DIB_32BPP_BitBlt(PBLTINFO);
BOOLEAN DIB_32BPP_BitBltSrcCopy(PBLTINFO);
BOOLEAN DIB_32BPP_StretchBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,POINTL,CLIPOBJ*,XLATEOBJ*,ULONG);
BOOLEAN DIB_32BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULONG);
#define ROP_USES_SOURCE(Rop4) (((Rop4 & 0xCC0000) >> 2) != (Rop4 & 0x330000))
#define ROP_USES_PATTERN(Rop4) (((Rop4 & 0xF00000) >> 4) != (Rop4 & 0x0F0000))
extern unsigned char notmask[2];
extern unsigned char altnotmask[2];
#define MASK1BPP(x) (1<<(7-((x)&7)))
ULONG DIB_DoRop(ULONG Rop, ULONG Dest, ULONG Source, ULONG Pattern);
ULONG DIB_GetSource(SURFOBJ* SourceSurf, ULONG sx, ULONG sy, XLATEOBJ* ColorTranslation);
ULONG DIB_GetSourceIndex(SURFOBJ* SourceSurf, ULONG sx, ULONG sy);
VOID Dummy_PutPixel(SURFOBJ* SurfObj, LONG x, LONG y, ULONG c);
ULONG Dummy_GetPixel(SURFOBJ* SurfObj, LONG x, LONG y);
VOID Dummy_HLine(SURFOBJ* SurfObj, LONG x1, LONG x2, LONG y, ULONG c);
VOID Dummy_VLine(SURFOBJ* SurfObj, LONG x, LONG y1, LONG y2, ULONG c);
BOOLEAN Dummy_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
RECTL* DestRect, POINTL *SourcePoint,
BRUSHOBJ* BrushObj, POINTL BrushOrign,
XLATEOBJ *ColorTranslation, ULONG Rop4);
BOOLEAN Dummy_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
RECTL* DestRect, RECTL *SourceRect,
POINTL* MaskOrigin, POINTL BrushOrign,
CLIPOBJ *ClipRegion, XLATEOBJ *ColorTranslation,
ULONG Mode);
BOOLEAN Dummy_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
RECTL* DestRect, POINTL *SourcePoint,
XLATEOBJ *ColorTranslation, ULONG iTransColor);
#define DIB_GetSource(SourceSurf,sx,sy,ColorTranslation) \
XLATEOBJ_iXlate(ColorTranslation, \
DibFunctionsForBitmapFormat[SourceSurf->iBitmapFormat]. \
DIB_GetPixel(SourceSurf, sx, sy))
VOID DIB_1BPP_PutPixel(SURFOBJ* SurfObj, LONG x, LONG y, ULONG c);
ULONG DIB_1BPP_GetPixel(SURFOBJ* SurfObj, LONG x, LONG y);
VOID DIB_1BPP_HLine(SURFOBJ* SurfObj, LONG x1, LONG x2, LONG y, ULONG c);
VOID DIB_1BPP_VLine(SURFOBJ* SurfObj, LONG x, LONG y1, LONG y2, ULONG c);
BOOLEAN DIB_1BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
RECTL* DestRect, POINTL *SourcePoint,
BRUSHOBJ* Brush, POINTL BrushOrigin,
XLATEOBJ *ColorTranslation, ULONG Rop4);
BOOLEAN DIB_1BPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
RECTL* DestRect, RECTL *SourceRect,
POINTL* MaskOrigin, POINTL BrushOrigin,
CLIPOBJ *ClipRegion, XLATEOBJ *ColorTranslation,
ULONG Mode);
BOOLEAN DIB_1BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
RECTL* DestRect, POINTL *SourcePoint,
XLATEOBJ *ColorTranslation, ULONG iTransColor);
VOID DIB_4BPP_PutPixel(SURFOBJ* SurfObj, LONG x, LONG y, ULONG c);
ULONG DIB_4BPP_GetPixel(SURFOBJ* SurfObj, LONG x, LONG y);
VOID DIB_4BPP_HLine(SURFOBJ* SurfObj, LONG x1, LONG x2, LONG y, ULONG c);
VOID DIB_4BPP_VLine(SURFOBJ* SurfObj, LONG x, LONG y1, LONG y2, ULONG c);
BOOLEAN DIB_4BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
RECTL* DestRect, POINTL *SourcePoint,
BRUSHOBJ* Brush, POINTL BrushOrigin,
XLATEOBJ *ColorTranslation, ULONG Rop4);
BOOLEAN DIB_4BPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
RECTL* DestRect, RECTL *SourceRect,
POINTL* MaskOrigin, POINTL BrushOrigin,
CLIPOBJ *ClipRegion, XLATEOBJ *ColorTranslation,
ULONG Mode);
BOOLEAN DIB_4BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
RECTL* DestRect, POINTL *SourcePoint,
XLATEOBJ *ColorTranslation, ULONG iTransColor);
VOID DIB_8BPP_PutPixel(SURFOBJ* SurfObj, LONG x, LONG y, ULONG c);
ULONG DIB_8BPP_GetPixel(SURFOBJ* SurfObj, LONG x, LONG y);
VOID DIB_8BPP_HLine(SURFOBJ* SurfObj, LONG x1, LONG x2, LONG y, ULONG c);
VOID DIB_8BPP_VLine(SURFOBJ* SurfObj, LONG x, LONG y1, LONG y2, ULONG c);
BOOLEAN DIB_8BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
RECTL* DestRect, POINTL *SourcePoint,
BRUSHOBJ* Brush, POINTL BrushOrigin,
XLATEOBJ *ColorTranslation, ULONG Rop4);
BOOLEAN DIB_8BPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
RECTL* DestRect, RECTL *SourceRect,
POINTL* MaskOrigin, POINTL BrushOrigin,
CLIPOBJ *ClipRegion, XLATEOBJ *ColorTranslation,
ULONG Mode);
BOOLEAN DIB_8BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
RECTL* DestRect, POINTL *SourcePoint,
XLATEOBJ *ColorTranslation, ULONG iTransColor);
VOID DIB_16BPP_PutPixel(SURFOBJ* SurfObj, LONG x, LONG y, ULONG c);
ULONG DIB_16BPP_GetPixel(SURFOBJ* SurfObj, LONG x, LONG y);
VOID DIB_16BPP_HLine(SURFOBJ* SurfObj, LONG x1, LONG x2, LONG y, ULONG c);
VOID DIB_16BPP_VLine(SURFOBJ* SurfObj, LONG x, LONG y1, LONG y2, ULONG c);
BOOLEAN DIB_16BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
RECTL* DestRect, POINTL *SourcePoint,
BRUSHOBJ* Brush, POINTL BrushOrigin,
XLATEOBJ *ColorTranslation, ULONG Rop4);
BOOLEAN DIB_16BPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
RECTL* DestRect, RECTL *SourceRect,
POINTL* MaskOrigin, POINTL BrushOrigin,
CLIPOBJ *ClipRegion, XLATEOBJ *ColorTranslation,
ULONG Mode);
BOOLEAN DIB_16BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
RECTL* DestRect, POINTL *SourcePoint,
XLATEOBJ *ColorTranslation, ULONG iTransColor);
VOID DIB_24BPP_PutPixel(SURFOBJ* SurfObj, LONG x, LONG y, ULONG c);
ULONG DIB_24BPP_GetPixel(SURFOBJ* SurfObj, LONG x, LONG y);
VOID DIB_24BPP_HLine(SURFOBJ* SurfObj, LONG x1, LONG x2, LONG y, ULONG c);
VOID DIB_24BPP_VLine(SURFOBJ* SurfObj, LONG x, LONG y1, LONG y2, ULONG c);
BOOLEAN DIB_24BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
RECTL* DestRect, POINTL *SourcePoint,
BRUSHOBJ* Brush, POINTL BrushOrigin,
XLATEOBJ *ColorTranslation, ULONG Rop4);
BOOLEAN DIB_24BPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
RECTL* DestRect, RECTL *SourceRect,
POINTL* MaskOrigin, POINTL BrushOrigin,
CLIPOBJ *ClipRegion, XLATEOBJ *ColorTranslation,
ULONG Mode);
BOOLEAN DIB_24BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
RECTL* DestRect, POINTL *SourcePoint,
XLATEOBJ *ColorTranslation, ULONG iTransColor);
VOID DIB_32BPP_PutPixel(SURFOBJ* SurfObj, LONG x, LONG y, ULONG c);
ULONG DIB_32BPP_GetPixel(SURFOBJ* SurfObj, LONG x, LONG y);
VOID DIB_32BPP_HLine(SURFOBJ* SurfObj, LONG x1, LONG x2, LONG y, ULONG c);
VOID DIB_32BPP_VLine(SURFOBJ* SurfObj, LONG x, LONG y1, LONG y2, ULONG c);
BOOLEAN DIB_32BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
RECTL* DestRect, POINTL *SourcePoint,
BRUSHOBJ* Brush, POINTL BrushOrigin,
XLATEOBJ *ColorTranslation, ULONG Rop4);
BOOLEAN DIB_32BPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
RECTL* DestRect, RECTL *SourceRect,
POINTL* MaskOrigin, POINTL BrushOrigin,
CLIPOBJ *ClipRegion, XLATEOBJ *ColorTranslation,
ULONG Mode);
BOOLEAN DIB_32BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
RECTL* DestRect, POINTL *SourcePoint,
XLATEOBJ *ColorTranslation, ULONG iTransColor);
#define DIB_GetSourceIndex(SourceSurf,sx,sy) \
DibFunctionsForBitmapFormat[SourceSurf->iBitmapFormat]. \
DIB_GetPixel(SourceSurf, sx, sy)
#endif /* _W32K_DIB_DIB_H */

View file

@ -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.34 2004/07/03 17:40:24 navaraf Exp $ */
/* $Id: dib16bpp.c,v 1.35 2004/07/14 20:48:56 navaraf Exp $ */
#include <w32k.h>
VOID
@ -67,32 +67,30 @@ DIB_16BPP_VLine(SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
}
}
BOOLEAN STATIC
DIB_16BPP_BitBltSrcCopy(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
PRECTL DestRect, POINTL *SourcePoint,
XLATEOBJ *ColorTranslation)
BOOLEAN
DIB_16BPP_BitBltSrcCopy(PBLTINFO BltInfo)
{
LONG i, j, sx, sy, xColor, f1;
PBYTE SourceBits, DestBits, SourceLine, DestLine;
PBYTE SourceBits_4BPP, SourceLine_4BPP;
DestBits = DestSurf->pvScan0 + (DestRect->top * DestSurf->lDelta) + 2 * DestRect->left;
DestBits = BltInfo->DestSurface->pvScan0 + (BltInfo->DestRect.top * BltInfo->DestSurface->lDelta) + 2 * BltInfo->DestRect.left;
switch(SourceSurf->iBitmapFormat)
switch(BltInfo->SourceSurface->iBitmapFormat)
{
case BMF_1BPP:
sx = SourcePoint->x;
sy = SourcePoint->y;
sx = BltInfo->SourcePoint.x;
sy = BltInfo->SourcePoint.y;
for (j=DestRect->top; j<DestRect->bottom; j++)
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
{
sx = SourcePoint->x;
for (i=DestRect->left; i<DestRect->right; i++)
sx = BltInfo->SourcePoint.x;
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
{
if(DIB_1BPP_GetPixel(SourceSurf, sx, sy) == 0)
if(DIB_1BPP_GetPixel(BltInfo->SourceSurface, sx, sy) == 0)
{
DIB_16BPP_PutPixel(DestSurf, i, j, XLATEOBJ_iXlate(ColorTranslation, 0));
DIB_16BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 0));
} else {
DIB_16BPP_PutPixel(DestSurf, i, j, XLATEOBJ_iXlate(ColorTranslation, 1));
DIB_16BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 1));
}
sx++;
}
@ -101,161 +99,161 @@ DIB_16BPP_BitBltSrcCopy(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
break;
case BMF_4BPP:
SourceBits_4BPP = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + (SourcePoint->x >> 1);
SourceBits_4BPP = BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + (BltInfo->SourcePoint.x >> 1);
for (j=DestRect->top; j<DestRect->bottom; j++)
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
{
SourceLine_4BPP = SourceBits_4BPP;
sx = SourcePoint->x;
sx = BltInfo->SourcePoint.x;
f1 = sx & 1;
for (i=DestRect->left; i<DestRect->right; i++)
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
{
xColor = XLATEOBJ_iXlate(ColorTranslation,
xColor = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest,
(*SourceLine_4BPP & altnotmask[f1]) >> (4 * (1 - f1)));
DIB_16BPP_PutPixel(DestSurf, i, j, xColor);
DIB_16BPP_PutPixel(BltInfo->DestSurface, i, j, xColor);
if(f1 == 1) { SourceLine_4BPP++; f1 = 0; } else { f1 = 1; }
sx++;
}
SourceBits_4BPP += SourceSurf->lDelta;
SourceBits_4BPP += BltInfo->SourceSurface->lDelta;
}
break;
case BMF_8BPP:
SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + SourcePoint->x;
SourceLine = BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + BltInfo->SourcePoint.x;
DestLine = DestBits;
for (j = DestRect->top; j < DestRect->bottom; j++)
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
{
SourceBits = SourceLine;
DestBits = DestLine;
for (i = DestRect->left; i < DestRect->right; i++)
for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
{
*((WORD *)DestBits) = (WORD)XLATEOBJ_iXlate(ColorTranslation, *SourceBits);
*((WORD *)DestBits) = (WORD)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *SourceBits);
SourceBits += 1;
DestBits += 2;
}
SourceLine += SourceSurf->lDelta;
DestLine += DestSurf->lDelta;
SourceLine += BltInfo->SourceSurface->lDelta;
DestLine += BltInfo->DestSurface->lDelta;
}
break;
case BMF_16BPP:
if (NULL == ColorTranslation || 0 != (ColorTranslation->flXlate & XO_TRIVIAL))
if (NULL == BltInfo->XlateSourceToDest || 0 != (BltInfo->XlateSourceToDest->flXlate & XO_TRIVIAL))
{
if (DestRect->top < SourcePoint->y)
if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
{
SourceBits = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 2 * SourcePoint->x;
for (j = DestRect->top; j < DestRect->bottom; j++)
SourceBits = BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 2 * BltInfo->SourcePoint.x;
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
{
RtlMoveMemory(DestBits, SourceBits, 2 * (DestRect->right - DestRect->left));
SourceBits += SourceSurf->lDelta;
DestBits += DestSurf->lDelta;
RtlMoveMemory(DestBits, SourceBits, 2 * (BltInfo->DestRect.right - BltInfo->DestRect.left));
SourceBits += BltInfo->SourceSurface->lDelta;
DestBits += BltInfo->DestSurface->lDelta;
}
}
else
{
SourceBits = SourceSurf->pvScan0 + ((SourcePoint->y + DestRect->bottom - DestRect->top - 1) * SourceSurf->lDelta) + 2 * SourcePoint->x;
DestBits = DestSurf->pvScan0 + ((DestRect->bottom - 1) * DestSurf->lDelta) + 2 * DestRect->left;
for (j = DestRect->bottom - 1; DestRect->top <= j; j--)
SourceBits = BltInfo->SourceSurface->pvScan0 + ((BltInfo->SourcePoint.y + BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta) + 2 * BltInfo->SourcePoint.x;
DestBits = BltInfo->DestSurface->pvScan0 + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta) + 2 * BltInfo->DestRect.left;
for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
{
RtlMoveMemory(DestBits, SourceBits, 2 * (DestRect->right - DestRect->left));
SourceBits -= SourceSurf->lDelta;
DestBits -= DestSurf->lDelta;
RtlMoveMemory(DestBits, SourceBits, 2 * (BltInfo->DestRect.right - BltInfo->DestRect.left));
SourceBits -= BltInfo->SourceSurface->lDelta;
DestBits -= BltInfo->DestSurface->lDelta;
}
}
}
else
{
if (DestRect->top < SourcePoint->y)
if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
{
SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 2 * SourcePoint->x;
SourceLine = BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 2 * BltInfo->SourcePoint.x;
DestLine = DestBits;
for (j = DestRect->top; j < DestRect->bottom; j++)
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
{
SourceBits = SourceLine;
DestBits = DestLine;
for (i = DestRect->left; i < DestRect->right; i++)
for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
{
*((WORD *)DestBits) = (WORD)XLATEOBJ_iXlate(ColorTranslation, *((WORD *)SourceBits));
*((WORD *)DestBits) = (WORD)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *((WORD *)SourceBits));
SourceBits += 2;
DestBits += 2;
}
SourceLine += SourceSurf->lDelta;
DestLine += DestSurf->lDelta;
SourceLine += BltInfo->SourceSurface->lDelta;
DestLine += BltInfo->DestSurface->lDelta;
}
}
else
{
SourceLine = SourceSurf->pvScan0 + ((SourcePoint->y + DestRect->bottom - DestRect->top - 1) * SourceSurf->lDelta) + 2 * SourcePoint->x;
DestLine = DestSurf->pvScan0 + ((DestRect->bottom - 1) * DestSurf->lDelta) + 2 * DestRect->left;
for (j = DestRect->bottom - 1; DestRect->top <= j; j--)
SourceLine = BltInfo->SourceSurface->pvScan0 + ((BltInfo->SourcePoint.y + BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta) + 2 * BltInfo->SourcePoint.x;
DestLine = BltInfo->DestSurface->pvScan0 + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta) + 2 * BltInfo->DestRect.left;
for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
{
SourceBits = SourceLine;
DestBits = DestLine;
for (i = DestRect->left; i < DestRect->right; i++)
for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
{
*((WORD *)DestBits) = (WORD)XLATEOBJ_iXlate(ColorTranslation, *((WORD *)SourceBits));
*((WORD *)DestBits) = (WORD)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *((WORD *)SourceBits));
SourceBits += 2;
DestBits += 2;
}
SourceLine -= SourceSurf->lDelta;
DestLine -= DestSurf->lDelta;
SourceLine -= BltInfo->SourceSurface->lDelta;
DestLine -= BltInfo->DestSurface->lDelta;
}
}
}
break;
case BMF_24BPP:
SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 3 * SourcePoint->x;
SourceLine = BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 3 * BltInfo->SourcePoint.x;
DestLine = DestBits;
for (j = DestRect->top; j < DestRect->bottom; j++)
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
{
SourceBits = SourceLine;
DestBits = DestLine;
for (i = DestRect->left; i < DestRect->right; i++)
for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
{
xColor = (*(SourceBits + 2) << 0x10) +
(*(SourceBits + 1) << 0x08) +
(*(SourceBits));
*((WORD *)DestBits) = (WORD)XLATEOBJ_iXlate(ColorTranslation, xColor);
*((WORD *)DestBits) = (WORD)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
SourceBits += 3;
DestBits += 2;
}
SourceLine += SourceSurf->lDelta;
DestLine += DestSurf->lDelta;
SourceLine += BltInfo->SourceSurface->lDelta;
DestLine += BltInfo->DestSurface->lDelta;
}
break;
case BMF_32BPP:
SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 4 * SourcePoint->x;
SourceLine = BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 4 * BltInfo->SourcePoint.x;
DestLine = DestBits;
for (j = DestRect->top; j < DestRect->bottom; j++)
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
{
SourceBits = SourceLine;
DestBits = DestLine;
for (i = DestRect->left; i < DestRect->right; i++)
for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
{
*((WORD *)DestBits) = (WORD)XLATEOBJ_iXlate(ColorTranslation, *((PDWORD) SourceBits));
*((WORD *)DestBits) = (WORD)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *((PDWORD) SourceBits));
SourceBits += 4;
DestBits += 2;
}
SourceLine += SourceSurf->lDelta;
DestLine += DestSurf->lDelta;
SourceLine += BltInfo->SourceSurface->lDelta;
DestLine += BltInfo->DestSurface->lDelta;
}
break;
default:
DPRINT1("DIB_16BPP_Bitblt: Unhandled Source BPP: %u\n", BitsPerFormat(SourceSurf->iBitmapFormat));
DPRINT1("DIB_16BPP_Bitblt: Unhandled Source BPP: %u\n", BitsPerFormat(BltInfo->SourceSurface->iBitmapFormat));
return FALSE;
}
@ -263,124 +261,94 @@ DIB_16BPP_BitBltSrcCopy(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
}
BOOLEAN
DIB_16BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
PRECTL DestRect, POINTL *SourcePoint,
BRUSHOBJ *Brush, POINTL BrushOrigin,
XLATEOBJ *ColorTranslation, ULONG Rop4)
DIB_16BPP_BitBlt(PBLTINFO BltInfo)
{
ULONG X, Y;
ULONG DestX, DestY;
ULONG SourceX, SourceY;
ULONG wd, Dest, Source = 0, Pattern = 0;
PULONG DestBits;
ULONG PatternY = 0;
ULONG Dest, Source = 0, Pattern = 0;
BOOL UsesSource;
BOOL UsesPattern;
PULONG DestBits;
ULONG RoundedRight;
/* Pattern brushes */
PGDIBRUSHOBJ GdiBrush = NULL;
HBITMAP PatternSurface = NULL;
SURFOBJ *PatternObj = NULL;
ULONG PatternWidth = 0, PatternHeight = 0, PatternY = 0;
if (Rop4 == SRCCOPY)
{
return DIB_16BPP_BitBltSrcCopy(
DestSurf,
SourceSurf,
DestRect,
SourcePoint,
ColorTranslation);
}
UsesSource = ROP_USES_SOURCE(BltInfo->Rop4);
UsesPattern = ROP_USES_PATTERN(BltInfo->Rop4);
UsesSource = ((Rop4 & 0xCC0000) >> 2) != (Rop4 & 0x330000);
UsesPattern = (((Rop4 & 0xF00000) >> 4) != (Rop4 & 0x0F0000)) && Brush;
RoundedRight = BltInfo->DestRect.right -
((BltInfo->DestRect.right - BltInfo->DestRect.left) & 0x1);
SourceY = BltInfo->SourcePoint.y;
DestBits = (PULONG)(
BltInfo->DestSurface->pvScan0 +
(BltInfo->DestRect.left << 1) +
BltInfo->DestRect.top * BltInfo->DestSurface->lDelta);
if (UsesPattern)
{
if (Brush->iSolidColor == 0xFFFFFFFF)
if (BltInfo->PatternSurface)
{
PBITMAPOBJ PatternBitmap;
GdiBrush = CONTAINING_RECORD(
Brush,
GDIBRUSHOBJ,
BrushObject);
PatternSurface = GdiBrush->hbmPattern;
PatternBitmap = BITMAPOBJ_LockBitmap(GdiBrush->hbmPattern);
PatternObj = &PatternBitmap->SurfObj;
PatternWidth = PatternObj->sizlBitmap.cx;
PatternHeight = PatternObj->sizlBitmap.cy;
UsesPattern = TRUE;
PatternY = (BltInfo->DestRect.top + BltInfo->BrushOrigin.y) %
BltInfo->PatternSurface->sizlBitmap.cy;
}
else
{
UsesPattern = FALSE;
Pattern = (Brush->iSolidColor & 0xFFFF) |
((Brush->iSolidColor & 0xFFFF) << 16);
Pattern = BltInfo->Brush->iSolidColor |
(BltInfo->Brush->iSolidColor << 16);
}
}
wd = ((DestRect->right - DestRect->left) << 1) - DestSurf->lDelta;
RoundedRight = DestRect->right - ((DestRect->right - DestRect->left) & 0x1);
SourceY = SourcePoint->y;
DestBits = (PULONG)(
DestSurf->pvScan0 +
(DestRect->left << 1) +
DestRect->top * DestSurf->lDelta);
for (Y = DestRect->top; Y < DestRect->bottom; Y++)
for (DestY = BltInfo->DestRect.top; DestY < BltInfo->DestRect.bottom; DestY++)
{
SourceX = SourcePoint->x;
SourceX = BltInfo->SourcePoint.x;
if(UsesPattern)
PatternY = (Y + BrushOrigin.y) % PatternHeight;
for (X = DestRect->left; X < RoundedRight; X += 2, DestBits++, SourceX += 2)
for (DestX = BltInfo->DestRect.left; DestX < RoundedRight; DestX += 2, DestBits++, SourceX += 2)
{
Dest = *DestBits;
if (UsesSource)
{
Source = DIB_GetSource(SourceSurf, SourceX, SourceY, ColorTranslation);
Source |= DIB_GetSource(SourceSurf, SourceX + 1, SourceY, ColorTranslation) << 16;
Source = DIB_GetSource(BltInfo->SourceSurface, SourceX, SourceY, BltInfo->XlateSourceToDest);
Source |= DIB_GetSource(BltInfo->SourceSurface, SourceX + 1, SourceY, BltInfo->XlateSourceToDest) << 16;
}
if (UsesPattern)
if (BltInfo->PatternSurface)
{
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;
Pattern = DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest);
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 1) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << 16;
}
*DestBits = DIB_DoRop(Rop4, Dest, Source, Pattern);
*DestBits = DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern);
}
if (X < DestRect->right)
if (DestX < BltInfo->DestRect.right)
{
Dest = *((PUSHORT)DestBits);
if (UsesSource)
{
Source = DIB_GetSource(SourceSurf, SourceX, SourceY, ColorTranslation);
Source = DIB_GetSource(BltInfo->SourceSurface, SourceX, SourceY, BltInfo->XlateSourceToDest);
}
if (UsesPattern)
if (BltInfo->PatternSurface)
{
Pattern = DIB_1BPP_GetPixel(PatternObj, (X + BrushOrigin.x) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
Pattern = DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest);
}
DIB_16BPP_PutPixel(DestSurf, X, Y, DIB_DoRop(Rop4, Dest, Source, Pattern) & 0xFFFF);
DIB_16BPP_PutPixel(BltInfo->DestSurface, DestX, DestY, DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern) & 0xFFFF);
DestBits = (PULONG)((ULONG_PTR)DestBits + 2);
}
SourceY++;
DestBits = (PULONG)(
(ULONG_PTR)DestBits - wd);
if (BltInfo->PatternSurface)
{
PatternY++;
PatternY %= BltInfo->PatternSurface->sizlBitmap.cy;
}
DestBits = (PULONG)(
(ULONG_PTR)DestBits -
((BltInfo->DestRect.right - BltInfo->DestRect.left) << 1) +
BltInfo->DestSurface->lDelta);
}
if (PatternSurface != NULL)
BITMAPOBJ_UnlockBitmap(PatternSurface);
return TRUE;
}

View file

@ -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.31 2004/07/03 17:40:24 navaraf Exp $ */
/* $Id: dib1bpp.c,v 1.32 2004/07/14 20:48:56 navaraf Exp $ */
#include <w32k.h>
VOID
@ -227,30 +227,27 @@ DIB_1BPP_BitBltSrcCopy_From1BPP (
}
BOOLEAN
DIB_1BPP_BitBltSrcCopy(
SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
PRECTL DestRect, POINTL *SourcePoint,
XLATEOBJ *ColorTranslation)
DIB_1BPP_BitBltSrcCopy(PBLTINFO BltInfo)
{
LONG i, j, sx, sy = SourcePoint->y;
LONG i, j, sx, sy = BltInfo->SourcePoint.y;
switch ( SourceSurf->iBitmapFormat )
switch ( BltInfo->SourceSurface->iBitmapFormat )
{
case BMF_1BPP:
DIB_1BPP_BitBltSrcCopy_From1BPP ( DestSurf, SourceSurf, DestRect, SourcePoint );
DIB_1BPP_BitBltSrcCopy_From1BPP ( BltInfo->DestSurface, BltInfo->SourceSurface, &BltInfo->DestRect, &BltInfo->SourcePoint );
break;
case BMF_4BPP:
for (j=DestRect->top; j<DestRect->bottom; j++)
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
{
sx = SourcePoint->x;
for (i=DestRect->left; i<DestRect->right; i++)
sx = BltInfo->SourcePoint.x;
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
{
if(XLATEOBJ_iXlate(ColorTranslation, DIB_4BPP_GetPixel(SourceSurf, sx, sy)) == 0)
if(XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, DIB_4BPP_GetPixel(BltInfo->SourceSurface, sx, sy)) == 0)
{
DIB_1BPP_PutPixel(DestSurf, i, j, 0);
DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, 0);
} else {
DIB_1BPP_PutPixel(DestSurf, i, j, 1);
DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, 1);
}
sx++;
}
@ -259,16 +256,16 @@ DIB_1BPP_BitBltSrcCopy(
break;
case BMF_8BPP:
for (j=DestRect->top; j<DestRect->bottom; j++)
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
{
sx = SourcePoint->x;
for (i=DestRect->left; i<DestRect->right; i++)
sx = BltInfo->SourcePoint.x;
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
{
if(XLATEOBJ_iXlate(ColorTranslation, DIB_8BPP_GetPixel(SourceSurf, sx, sy)) == 0)
if(XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, DIB_8BPP_GetPixel(BltInfo->SourceSurface, sx, sy)) == 0)
{
DIB_1BPP_PutPixel(DestSurf, i, j, 0);
DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, 0);
} else {
DIB_1BPP_PutPixel(DestSurf, i, j, 1);
DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, 1);
}
sx++;
}
@ -277,16 +274,16 @@ DIB_1BPP_BitBltSrcCopy(
break;
case BMF_16BPP:
for (j=DestRect->top; j<DestRect->bottom; j++)
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
{
sx = SourcePoint->x;
for (i=DestRect->left; i<DestRect->right; i++)
sx = BltInfo->SourcePoint.x;
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
{
if(XLATEOBJ_iXlate(ColorTranslation, DIB_16BPP_GetPixel(SourceSurf, sx, sy)) == 0)
if(XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, DIB_16BPP_GetPixel(BltInfo->SourceSurface, sx, sy)) == 0)
{
DIB_1BPP_PutPixel(DestSurf, i, j, 0);
DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, 0);
} else {
DIB_1BPP_PutPixel(DestSurf, i, j, 1);
DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, 1);
}
sx++;
}
@ -295,16 +292,16 @@ DIB_1BPP_BitBltSrcCopy(
break;
case BMF_24BPP:
for (j=DestRect->top; j<DestRect->bottom; j++)
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
{
sx = SourcePoint->x;
for (i=DestRect->left; i<DestRect->right; i++)
sx = BltInfo->SourcePoint.x;
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
{
if(XLATEOBJ_iXlate(ColorTranslation, DIB_24BPP_GetPixel(SourceSurf, sx, sy)) == 0)
if(XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, DIB_24BPP_GetPixel(BltInfo->SourceSurface, sx, sy)) == 0)
{
DIB_1BPP_PutPixel(DestSurf, i, j, 0);
DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, 0);
} else {
DIB_1BPP_PutPixel(DestSurf, i, j, 1);
DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, 1);
}
sx++;
}
@ -313,16 +310,16 @@ DIB_1BPP_BitBltSrcCopy(
break;
case BMF_32BPP:
for (j=DestRect->top; j<DestRect->bottom; j++)
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
{
sx = SourcePoint->x;
for (i=DestRect->left; i<DestRect->right; i++)
sx = BltInfo->SourcePoint.x;
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
{
if(XLATEOBJ_iXlate(ColorTranslation, DIB_32BPP_GetPixel(SourceSurf, sx, sy)) == 0)
if(XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, DIB_32BPP_GetPixel(BltInfo->SourceSurface, sx, sy)) == 0)
{
DIB_1BPP_PutPixel(DestSurf, i, j, 0);
DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, 0);
} else {
DIB_1BPP_PutPixel(DestSurf, i, j, 1);
DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, 1);
}
sx++;
}
@ -331,7 +328,7 @@ DIB_1BPP_BitBltSrcCopy(
break;
default:
DbgPrint("DIB_1BPP_BitBlt: Unhandled Source BPP: %u\n", BitsPerFormat(SourceSurf->iBitmapFormat));
DbgPrint("DIB_1BPP_BitBlt: Unhandled Source BPP: %u\n", BitsPerFormat(BltInfo->SourceSurface->iBitmapFormat));
return FALSE;
}
@ -339,99 +336,70 @@ DIB_1BPP_BitBltSrcCopy(
}
BOOLEAN
DIB_1BPP_BitBlt(
SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
PRECTL DestRect, POINTL *SourcePoint,
BRUSHOBJ *Brush, POINTL BrushOrigin,
XLATEOBJ *ColorTranslation, ULONG Rop4)
DIB_1BPP_BitBlt(PBLTINFO BltInfo)
{
ULONG X, Y, SourceX, SourceY, k;
ULONG DestX, DestY;
ULONG SourceX, SourceY;
ULONG PatternY = 0;
ULONG Dest, Source = 0, Pattern = 0;
ULONG Index;
BOOLEAN UsesSource;
BOOLEAN UsesPattern;
PULONG DestBits;
BOOL UsesSource;
BOOL UsesPattern;
ULONG RoundedRight;
BYTE NoBits;
/* Pattern brushes */
PGDIBRUSHOBJ GdiBrush = NULL;
HBITMAP PatternSurface = NULL;
SURFOBJ *PatternObj = NULL;
ULONG PatternWidth = 0, PatternHeight = 0, PatternY = 0;
/* BYTE NoBits;*/
if (Rop4 == SRCCOPY)
{
return DIB_1BPP_BitBltSrcCopy(
DestSurf,
SourceSurf,
DestRect,
SourcePoint,
ColorTranslation);
}
UsesSource = ROP_USES_SOURCE(BltInfo->Rop4);
UsesPattern = ROP_USES_PATTERN(BltInfo->Rop4);
UsesSource = ((Rop4 & 0xCC0000) >> 2) != (Rop4 & 0x330000);
UsesPattern = (((Rop4 & 0xF00000) >> 4) != (Rop4 & 0x0F0000)) && Brush;
RoundedRight = BltInfo->DestRect.right -
((BltInfo->DestRect.right - BltInfo->DestRect.left) & 31);
SourceY = BltInfo->SourcePoint.y;
if (UsesPattern)
{
if (Brush->iSolidColor == 0xFFFFFFFF)
if (BltInfo->PatternSurface)
{
PBITMAPOBJ PatternBitmap;
GdiBrush = CONTAINING_RECORD(
Brush,
GDIBRUSHOBJ,
BrushObject);
PatternSurface = GdiBrush->hbmPattern;
PatternBitmap = BITMAPOBJ_LockBitmap(GdiBrush->hbmPattern);
PatternObj = &PatternBitmap->SurfObj;
PatternWidth = PatternObj->sizlBitmap.cx;
PatternHeight = PatternObj->sizlBitmap.cy;
UsesPattern = TRUE;
PatternY = (BltInfo->DestRect.top + BltInfo->BrushOrigin.y) %
BltInfo->PatternSurface->sizlBitmap.cy;
}
else
{
UsesPattern = FALSE;
Pattern = Brush->iSolidColor;
/* FIXME: Shouldn't it be expanded? */
Pattern = BltInfo->Brush->iSolidColor;
}
}
RoundedRight = DestRect->right - ((DestRect->right - DestRect->left) & 31);
SourceY = SourcePoint->y;
for (Y = DestRect->top; Y < DestRect->bottom; Y++)
for (DestY = BltInfo->DestRect.top; DestY < BltInfo->DestRect.bottom; DestY++)
{
SourceX = SourcePoint->x;
DestX = BltInfo->DestRect.left;
SourceX = BltInfo->SourcePoint.x;
DestBits = (PULONG)(
DestSurf->pvScan0 +
(DestRect->left >> 3) +
Y * DestSurf->lDelta);
BltInfo->DestSurface->pvScan0 +
(BltInfo->DestRect.left >> 3) +
DestY * BltInfo->DestSurface->lDelta);
if(UsesPattern)
PatternY = (Y + BrushOrigin.y) % PatternHeight;
X = DestRect->left;
if (X & 31)
if (DestX & 31)
{
#if 0
/* FIXME: This case is completely untested!!! */
Dest = *((PBYTE)DestBits);
NoBits = 31 - (X & 31);
NoBits = 31 - (DestX & 31);
if (UsesSource)
{
Source = 0;
for (k = 31 - NoBits; k < NoBits; k++)
Source |= (DIB_GetSource(SourceSurf, SourceX + k, SourceY, ColorTranslation) << (31 - k));
/* FIXME: This is incorrect! */
for (Index = 31 - NoBits; Index >= 0; Index++)
Source |= (DIB_GetSource(SourceSurf, SourceX + Index, SourceY, ColorTranslation) << (31 - Index));
}
if (UsesPattern)
if (BltInfo->PatternSurface)
{
Pattern = 0;
for (k = 31 - NoBits; k < NoBits; k++)
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (X + BrushOrigin.x + k) % PatternWidth, PatternY) << (31 - k));
for (k = 31 - NoBits; k >= 0; k++)
Pattern |= (DIB_GetSource(PatternObj, (X + BrushOrigin.x + k) % PatternWidth, PatternY, BltInfo->XlatePatternToDest) << (31 - k));
}
Dest = DIB_DoRop(Rop4, Dest, Source, Pattern);
@ -440,69 +408,72 @@ DIB_1BPP_BitBlt(
*DestBits = Dest;
X += NoBits;
DestX += NoBits;
SourceX += NoBits;
#endif
}
for (; X < RoundedRight; X += 32, DestBits++, SourceX++)
for (; DestX < RoundedRight; DestX += 32, DestBits++, SourceX++)
{
Dest = *DestBits;
if (UsesSource)
{
Source = 0;
for (k = 0; k < 8; k++)
for (Index = 0; Index < 8; Index++)
{
Source |= (DIB_GetSource(SourceSurf, SourceX + k, SourceY, ColorTranslation) << (7 - k));
Source |= (DIB_GetSource(SourceSurf, SourceX + k + 8, SourceY, ColorTranslation) << (8 + (7 - k)));
Source |= (DIB_GetSource(SourceSurf, SourceX + k + 16, SourceY, ColorTranslation) << (16 + (7 - k)));
Source |= (DIB_GetSource(SourceSurf, SourceX + k + 24, SourceY, ColorTranslation) << (24 + (7 - k)));
Source |= DIB_GetSource(BltInfo->SourceSurface, SourceX + Index, SourceY, BltInfo->XlateSourceToDest) << (7 - Index);
Source |= DIB_GetSource(BltInfo->SourceSurface, SourceX + Index + 8, SourceY, BltInfo->XlateSourceToDest) << (8 + (7 - Index));
Source |= DIB_GetSource(BltInfo->SourceSurface, SourceX + Index + 16, SourceY, BltInfo->XlateSourceToDest) << (16 + (7 - Index));
Source |= DIB_GetSource(BltInfo->SourceSurface, SourceX + Index + 24, SourceY, BltInfo->XlateSourceToDest) << (24 + (7 - Index));
}
}
if (UsesPattern)
if (BltInfo->PatternSurface)
{
Pattern = 0;
for (k = 0; k < 8; k++)
for (Index = 0; Index < 8; Index++)
{
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)));
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + Index) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << (7 - Index);
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + Index + 8) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << (8 + (7 - Index));
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + Index + 16) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << (16 + (7 - Index));
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + Index + 24) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << (24 + (7 - Index));
}
}
*DestBits = DIB_DoRop(Rop4, Dest, Source, Pattern);
*DestBits = DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern);
}
if (X < DestRect->right)
if (DestX < BltInfo->DestRect.right)
{
// Dest = *DestBits;
for (; X < DestRect->right; X++, SourceX++)
for (; DestX < BltInfo->DestRect.right; DestX++, SourceX++)
{
// Dest = *DestBits;
Dest = DIB_1BPP_GetPixel(DestSurf, X, Y);
Dest = DIB_1BPP_GetPixel(BltInfo->DestSurface, DestX, DestY);
if (UsesSource)
{
Source = DIB_GetSource(SourceSurf, SourceX, SourceY, ColorTranslation);
Source = DIB_GetSource(BltInfo->SourceSurface, SourceX, SourceY, BltInfo->XlateSourceToDest);
}
if (UsesPattern)
if (BltInfo->PatternSurface)
{
Pattern = DIB_1BPP_GetPixel(PatternObj, (X + BrushOrigin.x) % PatternWidth, PatternY);
Pattern = DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest);
}
DIB_1BPP_PutPixel(DestSurf, X, Y, DIB_DoRop(Rop4, Dest, Source, Pattern) & 0xF);
DIB_1BPP_PutPixel(BltInfo->DestSurface, DestX, DestY, DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern) & 0xF);
// Dest >>= 1;
}
}
SourceY++;
if (BltInfo->PatternSurface)
{
PatternY++;
PatternY %= BltInfo->PatternSurface->sizlBitmap.cy;
}
}
if (PatternSurface != NULL)
BITMAPOBJ_UnlockBitmap(PatternSurface);
return TRUE;
}

View file

@ -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.30 2004/07/03 17:40:24 navaraf Exp $ */
/* $Id: dib24bpp.c,v 1.31 2004/07/14 20:48:56 navaraf Exp $ */
#include <w32k.h>
VOID
@ -66,33 +66,31 @@ DIB_24BPP_VLine(SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
}
BOOLEAN
DIB_24BPP_BitBltSrcCopy( SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
PRECTL DestRect, POINTL *SourcePoint,
XLATEOBJ *ColorTranslation)
DIB_24BPP_BitBltSrcCopy(PBLTINFO BltInfo)
{
LONG i, j, sx, sy, xColor, f1;
PBYTE SourceBits, DestBits, SourceLine, DestLine;
PBYTE SourceBits_4BPP, SourceLine_4BPP;
PWORD SourceBits_16BPP, SourceLine_16BPP;
DestBits = DestSurf->pvScan0 + (DestRect->top * DestSurf->lDelta) + DestRect->left * 3;
DestBits = BltInfo->DestSurface->pvScan0 + (BltInfo->DestRect.top * BltInfo->DestSurface->lDelta) + BltInfo->DestRect.left * 3;
switch(SourceSurf->iBitmapFormat)
switch(BltInfo->SourceSurface->iBitmapFormat)
{
case BMF_1BPP:
sx = SourcePoint->x;
sy = SourcePoint->y;
sx = BltInfo->SourcePoint.x;
sy = BltInfo->SourcePoint.y;
for (j=DestRect->top; j<DestRect->bottom; j++)
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
{
sx = SourcePoint->x;
for (i=DestRect->left; i<DestRect->right; i++)
sx = BltInfo->SourcePoint.x;
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
{
if(DIB_1BPP_GetPixel(SourceSurf, sx, sy) == 0)
if(DIB_1BPP_GetPixel(BltInfo->SourceSurface, sx, sy) == 0)
{
DIB_24BPP_PutPixel(DestSurf, i, j, XLATEOBJ_iXlate(ColorTranslation, 0));
DIB_24BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 0));
} else {
DIB_24BPP_PutPixel(DestSurf, i, j, XLATEOBJ_iXlate(ColorTranslation, 1));
DIB_24BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 1));
}
sx++;
}
@ -101,18 +99,18 @@ DIB_24BPP_BitBltSrcCopy( SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
break;
case BMF_4BPP:
SourceBits_4BPP = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + (SourcePoint->x >> 1);
SourceBits_4BPP = BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + (BltInfo->SourcePoint.x >> 1);
for (j=DestRect->top; j<DestRect->bottom; j++)
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
{
SourceLine_4BPP = SourceBits_4BPP;
DestLine = DestBits;
sx = SourcePoint->x;
sx = BltInfo->SourcePoint.x;
f1 = sx & 1;
for (i=DestRect->left; i<DestRect->right; i++)
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
{
xColor = XLATEOBJ_iXlate(ColorTranslation,
xColor = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest,
(*SourceLine_4BPP & altnotmask[f1]) >> (4 * (1 - f1)));
*DestLine++ = xColor & 0xff;
*(PWORD)DestLine = xColor >> 8;
@ -121,114 +119,114 @@ DIB_24BPP_BitBltSrcCopy( SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
sx++;
}
SourceBits_4BPP += SourceSurf->lDelta;
DestBits += DestSurf->lDelta;
SourceBits_4BPP += BltInfo->SourceSurface->lDelta;
DestBits += BltInfo->DestSurface->lDelta;
}
break;
case BMF_8BPP:
SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + SourcePoint->x;
SourceLine = BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + BltInfo->SourcePoint.x;
DestLine = DestBits;
for (j = DestRect->top; j < DestRect->bottom; j++)
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
{
SourceBits = SourceLine;
DestBits = DestLine;
for (i = DestRect->left; i < DestRect->right; i++)
for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
{
xColor = XLATEOBJ_iXlate(ColorTranslation, *SourceBits);
xColor = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *SourceBits);
*DestBits = xColor & 0xff;
*(PWORD)(DestBits + 1) = xColor >> 8;
SourceBits += 1;
DestBits += 3;
}
SourceLine += SourceSurf->lDelta;
DestLine += DestSurf->lDelta;
SourceLine += BltInfo->SourceSurface->lDelta;
DestLine += BltInfo->DestSurface->lDelta;
}
break;
case BMF_16BPP:
SourceBits_16BPP = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 2 * SourcePoint->x;
SourceBits_16BPP = BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 2 * BltInfo->SourcePoint.x;
for (j=DestRect->top; j<DestRect->bottom; j++)
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
{
SourceLine_16BPP = SourceBits_16BPP;
DestLine = DestBits;
for (i=DestRect->left; i<DestRect->right; i++)
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
{
xColor = XLATEOBJ_iXlate(ColorTranslation, *SourceLine_16BPP);
xColor = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *SourceLine_16BPP);
*DestLine++ = xColor & 0xff;
*(PWORD)DestLine = xColor >> 8;
DestLine += 2;
SourceLine_16BPP++;
}
SourceBits_16BPP = (PWORD)((PBYTE)SourceBits_16BPP + SourceSurf->lDelta);
DestBits += DestSurf->lDelta;
SourceBits_16BPP = (PWORD)((PBYTE)SourceBits_16BPP + BltInfo->SourceSurface->lDelta);
DestBits += BltInfo->DestSurface->lDelta;
}
break;
case BMF_24BPP:
if (NULL == ColorTranslation || 0 != (ColorTranslation->flXlate & XO_TRIVIAL))
if (NULL == BltInfo->XlateSourceToDest || 0 != (BltInfo->XlateSourceToDest->flXlate & XO_TRIVIAL))
{
if (DestRect->top < SourcePoint->y)
if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
{
SourceBits = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 3 * SourcePoint->x;
for (j = DestRect->top; j < DestRect->bottom; j++)
SourceBits = BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 3 * BltInfo->SourcePoint.x;
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
{
RtlMoveMemory(DestBits, SourceBits, 3 * (DestRect->right - DestRect->left));
SourceBits += SourceSurf->lDelta;
DestBits += DestSurf->lDelta;
RtlMoveMemory(DestBits, SourceBits, 3 * (BltInfo->DestRect.right - BltInfo->DestRect.left));
SourceBits += BltInfo->SourceSurface->lDelta;
DestBits += BltInfo->DestSurface->lDelta;
}
}
else
{
SourceBits = SourceSurf->pvScan0 + ((SourcePoint->y + DestRect->bottom - DestRect->top - 1) * SourceSurf->lDelta) + 3 * SourcePoint->x;
DestBits = DestSurf->pvScan0 + ((DestRect->bottom - 1) * DestSurf->lDelta) + 3 * DestRect->left;
for (j = DestRect->bottom - 1; DestRect->top <= j; j--)
SourceBits = BltInfo->SourceSurface->pvScan0 + ((BltInfo->SourcePoint.y + BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta) + 3 * BltInfo->SourcePoint.x;
DestBits = BltInfo->DestSurface->pvScan0 + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta) + 3 * BltInfo->DestRect.left;
for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
{
RtlMoveMemory(DestBits, SourceBits, 3 * (DestRect->right - DestRect->left));
SourceBits -= SourceSurf->lDelta;
DestBits -= DestSurf->lDelta;
RtlMoveMemory(DestBits, SourceBits, 3 * (BltInfo->DestRect.right - BltInfo->DestRect.left));
SourceBits -= BltInfo->SourceSurface->lDelta;
DestBits -= BltInfo->DestSurface->lDelta;
}
}
}
else
{
/* FIXME */
DPRINT1("DIB_24BPP_Bitblt: Unhandled ColorTranslation for 16 -> 16 copy\n");
DPRINT1("DIB_24BPP_Bitblt: Unhandled BltInfo->XlateSourceToDest for 16 -> 16 copy\n");
return FALSE;
}
break;
case BMF_32BPP:
SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 4 * SourcePoint->x;
SourceLine = BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 4 * BltInfo->SourcePoint.x;
DestLine = DestBits;
for (j = DestRect->top; j < DestRect->bottom; j++)
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
{
SourceBits = SourceLine;
DestBits = DestLine;
for (i = DestRect->left; i < DestRect->right; i++)
for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
{
xColor = XLATEOBJ_iXlate(ColorTranslation, *((PDWORD) SourceBits));
xColor = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *((PDWORD) SourceBits));
*DestBits = xColor & 0xff;
*(PWORD)(DestBits + 1) = xColor >> 8;
SourceBits += 4;
DestBits += 3;
}
SourceLine += SourceSurf->lDelta;
DestLine += DestSurf->lDelta;
SourceLine += BltInfo->SourceSurface->lDelta;
DestLine += BltInfo->DestSurface->lDelta;
}
break;
default:
DbgPrint("DIB_24BPP_Bitblt: Unhandled Source BPP: %u\n", BitsPerFormat(SourceSurf->iBitmapFormat));
DbgPrint("DIB_24BPP_Bitblt: Unhandled Source BPP: %u\n", BitsPerFormat(BltInfo->SourceSurface->iBitmapFormat));
return FALSE;
}
@ -236,102 +234,70 @@ DIB_24BPP_BitBltSrcCopy( SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
}
BOOLEAN
DIB_24BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
PRECTL DestRect, POINTL *SourcePoint,
BRUSHOBJ *Brush, POINTL BrushOrigin,
XLATEOBJ *ColorTranslation, ULONG Rop4)
DIB_24BPP_BitBlt(PBLTINFO BltInfo)
{
ULONG X, Y;
ULONG DestX, DestY;
ULONG SourceX, SourceY;
ULONG PatternY = 0;
ULONG Dest, Source = 0, Pattern = 0;
PBYTE DestBits;
BOOL UsesSource;
BOOL UsesPattern;
/* Pattern brushes */
PGDIBRUSHOBJ GdiBrush = NULL;
HBITMAP PatternSurface = NULL;
SURFOBJ *PatternObj = NULL;
ULONG PatternWidth = 0, PatternHeight = 0, PatternY = 0;
PBYTE DestBits;
if (Rop4 == SRCCOPY)
{
return DIB_24BPP_BitBltSrcCopy(
DestSurf,
SourceSurf,
DestRect,
SourcePoint,
ColorTranslation);
}
UsesSource = ROP_USES_SOURCE(BltInfo->Rop4);
UsesPattern = ROP_USES_PATTERN(BltInfo->Rop4);
UsesSource = ((Rop4 & 0xCC0000) >> 2) != (Rop4 & 0x330000);
UsesPattern = (((Rop4 & 0xF00000) >> 4) != (Rop4 & 0x0F0000)) && Brush;
SourceY = BltInfo->SourcePoint.y;
DestBits = (PBYTE)(
BltInfo->DestSurface->pvScan0 +
(BltInfo->DestRect.left << 1) + BltInfo->DestRect.left +
BltInfo->DestRect.top * BltInfo->DestSurface->lDelta);
if (UsesPattern)
{
if (Brush->iSolidColor == 0xFFFFFFFF)
if (BltInfo->PatternSurface)
{
PBITMAPOBJ PatternBitmap;
GdiBrush = CONTAINING_RECORD(
Brush,
GDIBRUSHOBJ,
BrushObject);
PatternSurface = GdiBrush->hbmPattern;
PatternBitmap = BITMAPOBJ_LockBitmap(GdiBrush->hbmPattern);
PatternObj = &PatternBitmap->SurfObj;
PatternWidth = PatternObj->sizlBitmap.cx;
PatternHeight = PatternObj->sizlBitmap.cy;
UsesPattern = TRUE;
PatternY = (BltInfo->DestRect.top + BltInfo->BrushOrigin.y) %
BltInfo->PatternSurface->sizlBitmap.cy;
}
else
{
UsesPattern = FALSE;
Pattern = Brush->iSolidColor;
Pattern = BltInfo->Brush->iSolidColor;
}
}
SourceY = SourcePoint->y;
DestBits = (PBYTE)(
DestSurf->pvScan0 +
(DestRect->left << 1) + DestRect->left +
DestRect->top * DestSurf->lDelta);
for (Y = DestRect->top; Y < DestRect->bottom; Y++)
for (DestY = BltInfo->DestRect.top; DestY < BltInfo->DestRect.bottom; DestY++)
{
SourceX = SourcePoint->x;
SourceX = BltInfo->SourcePoint.x;
if(UsesPattern)
PatternY = (Y + BrushOrigin.y) % PatternHeight;
for (X = DestRect->left; X < DestRect->right; X++, DestBits += 3, SourceX++)
for (DestX = BltInfo->DestRect.left; DestX < BltInfo->DestRect.right; DestX++, DestBits += 3, SourceX++)
{
Dest = *((PUSHORT)DestBits) + (*(DestBits + 2) << 16);
if (UsesSource)
{
Source = DIB_GetSource(SourceSurf, SourceX, SourceY, ColorTranslation);
Source = DIB_GetSource(BltInfo->SourceSurface, SourceX, SourceY, BltInfo->XlateSourceToDest);
}
if (UsesPattern)
if (BltInfo->PatternSurface)
{
Pattern = DIB_1BPP_GetPixel(PatternObj, (X + BrushOrigin.x) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
Pattern = DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest);
}
Dest = DIB_DoRop(Rop4, Dest, Source, Pattern) & 0xFFFFFF;
Dest = DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern) & 0xFFFFFF;
*(PUSHORT)(DestBits) = Dest & 0xFFFF;
*(DestBits + 2) = Dest >> 16;
}
SourceY++;
DestBits -= (DestRect->right - DestRect->left) * 3;
DestBits += DestSurf->lDelta;
if (BltInfo->PatternSurface)
{
PatternY++;
PatternY %= BltInfo->PatternSurface->sizlBitmap.cy;
}
DestBits -= (BltInfo->DestRect.right - BltInfo->DestRect.left) * 3;
DestBits += BltInfo->DestSurface->lDelta;
}
if (PatternSurface != NULL)
BITMAPOBJ_UnlockBitmap(PatternSurface);
return TRUE;
}

View file

@ -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.29 2004/07/03 17:40:24 navaraf Exp $ */
/* $Id: dib32bpp.c,v 1.30 2004/07/14 20:48:56 navaraf Exp $ */
#include <w32k.h>
VOID
@ -67,33 +67,31 @@ DIB_32BPP_VLine(SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
}
BOOLEAN
DIB_32BPP_BitBltSrcCopy(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
PRECTL DestRect, POINTL *SourcePoint,
XLATEOBJ *ColorTranslation)
DIB_32BPP_BitBltSrcCopy(PBLTINFO BltInfo)
{
LONG i, j, sx, sy, xColor, f1;
PBYTE SourceBits, DestBits, SourceLine, DestLine;
PBYTE SourceBits_4BPP, SourceLine_4BPP;
PDWORD Source32, Dest32;
DestBits = DestSurf->pvScan0 + (DestRect->top * DestSurf->lDelta) + 4 * DestRect->left;
DestBits = BltInfo->DestSurface->pvScan0 + (BltInfo->DestRect.top * BltInfo->DestSurface->lDelta) + 4 * BltInfo->DestRect.left;
switch(SourceSurf->iBitmapFormat)
switch(BltInfo->SourceSurface->iBitmapFormat)
{
case BMF_1BPP:
sx = SourcePoint->x;
sy = SourcePoint->y;
sx = BltInfo->SourcePoint.x;
sy = BltInfo->SourcePoint.y;
for (j=DestRect->top; j<DestRect->bottom; j++)
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
{
sx = SourcePoint->x;
for (i=DestRect->left; i<DestRect->right; i++)
sx = BltInfo->SourcePoint.x;
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
{
if(DIB_1BPP_GetPixel(SourceSurf, sx, sy) == 0)
if(DIB_1BPP_GetPixel(BltInfo->SourceSurface, sx, sy) == 0)
{
DIB_32BPP_PutPixel(DestSurf, i, j, XLATEOBJ_iXlate(ColorTranslation, 0));
DIB_32BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 0));
} else {
DIB_32BPP_PutPixel(DestSurf, i, j, XLATEOBJ_iXlate(ColorTranslation, 1));
DIB_32BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 1));
}
sx++;
}
@ -102,182 +100,182 @@ DIB_32BPP_BitBltSrcCopy(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
break;
case BMF_4BPP:
SourceBits_4BPP = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + (SourcePoint->x >> 1);
SourceBits_4BPP = BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + (BltInfo->SourcePoint.x >> 1);
for (j=DestRect->top; j<DestRect->bottom; j++)
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
{
SourceLine_4BPP = SourceBits_4BPP;
sx = SourcePoint->x;
sx = BltInfo->SourcePoint.x;
f1 = sx & 1;
for (i=DestRect->left; i<DestRect->right; i++)
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
{
xColor = XLATEOBJ_iXlate(ColorTranslation,
xColor = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest,
(*SourceLine_4BPP & altnotmask[f1]) >> (4 * (1 - f1)));
DIB_32BPP_PutPixel(DestSurf, i, j, xColor);
DIB_32BPP_PutPixel(BltInfo->DestSurface, i, j, xColor);
if(f1 == 1) { SourceLine_4BPP++; f1 = 0; } else { f1 = 1; }
sx++;
}
SourceBits_4BPP += SourceSurf->lDelta;
SourceBits_4BPP += BltInfo->SourceSurface->lDelta;
}
break;
case BMF_8BPP:
SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + SourcePoint->x;
SourceLine = BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + BltInfo->SourcePoint.x;
DestLine = DestBits;
for (j = DestRect->top; j < DestRect->bottom; j++)
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
{
SourceBits = SourceLine;
DestBits = DestLine;
for (i = DestRect->left; i < DestRect->right; i++)
for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
{
xColor = *SourceBits;
*((PDWORD) DestBits) = (DWORD)XLATEOBJ_iXlate(ColorTranslation, xColor);
*((PDWORD) DestBits) = (DWORD)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
SourceBits += 1;
DestBits += 4;
}
SourceLine += SourceSurf->lDelta;
DestLine += DestSurf->lDelta;
SourceLine += BltInfo->SourceSurface->lDelta;
DestLine += BltInfo->DestSurface->lDelta;
}
break;
case BMF_16BPP:
SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 2 * SourcePoint->x;
SourceLine = BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 2 * BltInfo->SourcePoint.x;
DestLine = DestBits;
for (j = DestRect->top; j < DestRect->bottom; j++)
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
{
SourceBits = SourceLine;
DestBits = DestLine;
for (i = DestRect->left; i < DestRect->right; i++)
for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
{
xColor = *((PWORD) SourceBits);
*((PDWORD) DestBits) = (DWORD)XLATEOBJ_iXlate(ColorTranslation, xColor);
*((PDWORD) DestBits) = (DWORD)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
SourceBits += 2;
DestBits += 4;
}
SourceLine += SourceSurf->lDelta;
DestLine += DestSurf->lDelta;
SourceLine += BltInfo->SourceSurface->lDelta;
DestLine += BltInfo->DestSurface->lDelta;
}
break;
case BMF_24BPP:
SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 3 * SourcePoint->x;
SourceLine = BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 3 * BltInfo->SourcePoint.x;
DestLine = DestBits;
for (j = DestRect->top; j < DestRect->bottom; j++)
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
{
SourceBits = SourceLine;
DestBits = DestLine;
for (i = DestRect->left; i < DestRect->right; i++)
for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
{
xColor = (*(SourceBits + 2) << 0x10) +
(*(SourceBits + 1) << 0x08) +
(*(SourceBits));
*((PDWORD)DestBits) = (DWORD)XLATEOBJ_iXlate(ColorTranslation, xColor);
*((PDWORD)DestBits) = (DWORD)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
SourceBits += 3;
DestBits += 4;
}
SourceLine += SourceSurf->lDelta;
DestLine += DestSurf->lDelta;
SourceLine += BltInfo->SourceSurface->lDelta;
DestLine += BltInfo->DestSurface->lDelta;
}
break;
case BMF_32BPP:
if (NULL == ColorTranslation || 0 != (ColorTranslation->flXlate & XO_TRIVIAL))
if (NULL == BltInfo->XlateSourceToDest || 0 != (BltInfo->XlateSourceToDest->flXlate & XO_TRIVIAL))
{
if (DestRect->top < SourcePoint->y)
if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
{
SourceBits = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 4 * SourcePoint->x;
for (j = DestRect->top; j < DestRect->bottom; j++)
SourceBits = BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 4 * BltInfo->SourcePoint.x;
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
{
RtlMoveMemory(DestBits, SourceBits, 4 * (DestRect->right - DestRect->left));
SourceBits += SourceSurf->lDelta;
DestBits += DestSurf->lDelta;
RtlMoveMemory(DestBits, SourceBits, 4 * (BltInfo->DestRect.right - BltInfo->DestRect.left));
SourceBits += BltInfo->SourceSurface->lDelta;
DestBits += BltInfo->DestSurface->lDelta;
}
}
else
{
SourceBits = SourceSurf->pvScan0 + ((SourcePoint->y + DestRect->bottom - DestRect->top - 1) * SourceSurf->lDelta) + 4 * SourcePoint->x;
DestBits = DestSurf->pvScan0 + ((DestRect->bottom - 1) * DestSurf->lDelta) + 4 * DestRect->left;
for (j = DestRect->bottom - 1; DestRect->top <= j; j--)
SourceBits = BltInfo->SourceSurface->pvScan0 + ((BltInfo->SourcePoint.y + BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta) + 4 * BltInfo->SourcePoint.x;
DestBits = BltInfo->DestSurface->pvScan0 + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta) + 4 * BltInfo->DestRect.left;
for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
{
RtlMoveMemory(DestBits, SourceBits, 4 * (DestRect->right - DestRect->left));
SourceBits -= SourceSurf->lDelta;
DestBits -= DestSurf->lDelta;
RtlMoveMemory(DestBits, SourceBits, 4 * (BltInfo->DestRect.right - BltInfo->DestRect.left));
SourceBits -= BltInfo->SourceSurface->lDelta;
DestBits -= BltInfo->DestSurface->lDelta;
}
}
}
else
{
if (DestRect->top < SourcePoint->y)
if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
{
SourceBits = (SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 4 * SourcePoint->x);
for (j = DestRect->top; j < DestRect->bottom; j++)
SourceBits = (BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 4 * BltInfo->SourcePoint.x);
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
{
if (DestRect->left < SourcePoint->x)
if (BltInfo->DestRect.left < BltInfo->SourcePoint.x)
{
Dest32 = (DWORD *) DestBits;
Source32 = (DWORD *) SourceBits;
for (i = DestRect->left; i < DestRect->right; i++)
for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
{
*Dest32++ = XLATEOBJ_iXlate(ColorTranslation, *Source32++);
*Dest32++ = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *Source32++);
}
}
else
{
Dest32 = (DWORD *) DestBits + (DestRect->right - DestRect->left - 1);
Source32 = (DWORD *) SourceBits + (DestRect->right - DestRect->left - 1);
for (i = DestRect->right - 1; DestRect->left <= i; i--)
Dest32 = (DWORD *) DestBits + (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
Source32 = (DWORD *) SourceBits + (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
for (i = BltInfo->DestRect.right - 1; BltInfo->DestRect.left <= i; i--)
{
*Dest32-- = XLATEOBJ_iXlate(ColorTranslation, *Source32--);
*Dest32-- = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *Source32--);
}
}
SourceBits += SourceSurf->lDelta;
DestBits += DestSurf->lDelta;
SourceBits += BltInfo->SourceSurface->lDelta;
DestBits += BltInfo->DestSurface->lDelta;
}
}
else
{
SourceBits = SourceSurf->pvScan0 + ((SourcePoint->y + DestRect->bottom - DestRect->top - 1) * SourceSurf->lDelta) + 4 * SourcePoint->x;
DestBits = DestSurf->pvScan0 + ((DestRect->bottom - 1) * DestSurf->lDelta) + 4 * DestRect->left;
for (j = DestRect->bottom - 1; DestRect->top <= j; j--)
SourceBits = BltInfo->SourceSurface->pvScan0 + ((BltInfo->SourcePoint.y + BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta) + 4 * BltInfo->SourcePoint.x;
DestBits = BltInfo->DestSurface->pvScan0 + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta) + 4 * BltInfo->DestRect.left;
for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
{
if (DestRect->left < SourcePoint->x)
if (BltInfo->DestRect.left < BltInfo->SourcePoint.x)
{
Dest32 = (DWORD *) DestBits;
Source32 = (DWORD *) SourceBits;
for (i = DestRect->left; i < DestRect->right; i++)
for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
{
*Dest32++ = XLATEOBJ_iXlate(ColorTranslation, *Source32++);
*Dest32++ = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *Source32++);
}
}
else
{
Dest32 = (DWORD *) DestBits + (DestRect->right - DestRect->left - 1);
Source32 = (DWORD *) SourceBits + (DestRect->right - DestRect->left - 1);
for (i = DestRect->right; DestRect->left < i; i--)
Dest32 = (DWORD *) DestBits + (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
Source32 = (DWORD *) SourceBits + (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
for (i = BltInfo->DestRect.right; BltInfo->DestRect.left < i; i--)
{
*Dest32-- = XLATEOBJ_iXlate(ColorTranslation, *Source32--);
*Dest32-- = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *Source32--);
}
}
SourceBits -= SourceSurf->lDelta;
DestBits -= DestSurf->lDelta;
SourceBits -= BltInfo->SourceSurface->lDelta;
DestBits -= BltInfo->DestSurface->lDelta;
}
}
}
break;
default:
DPRINT1("DIB_32BPP_Bitblt: Unhandled Source BPP: %u\n", BitsPerFormat(SourceSurf->iBitmapFormat));
DPRINT1("DIB_32BPP_Bitblt: Unhandled Source BPP: %u\n", BitsPerFormat(BltInfo->SourceSurface->iBitmapFormat));
return FALSE;
}
@ -285,101 +283,70 @@ DIB_32BPP_BitBltSrcCopy(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
}
BOOLEAN
DIB_32BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
PRECTL DestRect, POINTL *SourcePoint,
BRUSHOBJ *Brush, POINTL BrushOrigin,
XLATEOBJ *ColorTranslation, ULONG Rop4)
DIB_32BPP_BitBlt(PBLTINFO BltInfo)
{
ULONG X, Y;
ULONG DestX, DestY;
ULONG SourceX, SourceY;
ULONG Dest, Source = 0, Pattern = 0, wd;
PULONG DestBits;
ULONG PatternY = 0;
ULONG Dest, Source = 0, Pattern = 0;
BOOL UsesSource;
BOOL UsesPattern;
/* Pattern brushes */
PGDIBRUSHOBJ GdiBrush = NULL;
HBITMAP PatternSurface = NULL;
SURFOBJ *PatternObj = NULL;
ULONG PatternWidth = 0, PatternHeight = 0, PatternY = 0;
PULONG DestBits;
if (Rop4 == SRCCOPY)
{
return DIB_32BPP_BitBltSrcCopy(
DestSurf,
SourceSurf,
DestRect,
SourcePoint,
ColorTranslation);
}
UsesSource = ROP_USES_SOURCE(BltInfo->Rop4);
UsesPattern = ROP_USES_PATTERN(BltInfo->Rop4);
UsesSource = ((Rop4 & 0xCC0000) >> 2) != (Rop4 & 0x330000);
UsesPattern = (((Rop4 & 0xF00000) >> 4) != (Rop4 & 0x0F0000)) && Brush;
SourceY = BltInfo->SourcePoint.y;
DestBits = (PULONG)(
BltInfo->DestSurface->pvScan0 +
(BltInfo->DestRect.left << 2) +
BltInfo->DestRect.top * BltInfo->DestSurface->lDelta);
if (UsesPattern)
{
if (Brush->iSolidColor == 0xFFFFFFFF)
if (BltInfo->PatternSurface)
{
PBITMAPOBJ PatternBitmap;
GdiBrush = CONTAINING_RECORD(
Brush,
GDIBRUSHOBJ,
BrushObject);
PatternSurface = GdiBrush->hbmPattern;
PatternBitmap = BITMAPOBJ_LockBitmap(GdiBrush->hbmPattern);
PatternObj = &PatternBitmap->SurfObj;
PatternWidth = PatternObj->sizlBitmap.cx;
PatternHeight = PatternObj->sizlBitmap.cy;
UsesPattern = TRUE;
PatternY = (BltInfo->DestRect.top + BltInfo->BrushOrigin.y) %
BltInfo->PatternSurface->sizlBitmap.cy;
}
else
{
UsesPattern = FALSE;
Pattern = Brush->iSolidColor;
Pattern = BltInfo->Brush->iSolidColor;
}
}
SourceY = SourcePoint->y;
DestBits = (PULONG)(
DestSurf->pvScan0 +
(DestRect->left << 2) +
DestRect->top * DestSurf->lDelta);
wd = ((DestRect->right - DestRect->left) << 2) - DestSurf->lDelta;
for (Y = DestRect->top; Y < DestRect->bottom; Y++)
for (DestY = BltInfo->DestRect.top; DestY < BltInfo->DestRect.bottom; DestY++)
{
SourceX = SourcePoint->x;
SourceX = BltInfo->SourcePoint.x;
if(UsesPattern)
PatternY = (Y + BrushOrigin.y) % PatternHeight;
for (X = DestRect->left; X < DestRect->right; X++, DestBits++, SourceX++)
for (DestX = BltInfo->DestRect.left; DestX < BltInfo->DestRect.right; DestX++, DestBits++, SourceX++)
{
Dest = *DestBits;
if (UsesSource)
{
Source = DIB_GetSource(SourceSurf, SourceX, SourceY, ColorTranslation);
Source = DIB_GetSource(BltInfo->SourceSurface, SourceX, SourceY, BltInfo->XlateSourceToDest);
}
if (UsesPattern)
if (BltInfo->PatternSurface)
{
Pattern = DIB_1BPP_GetPixel(PatternObj, (X + BrushOrigin.x) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
Pattern = DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest);
}
*DestBits = DIB_DoRop(Rop4, Dest, Source, Pattern);
*DestBits = DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern);
}
SourceY++;
DestBits = (PULONG)(
(ULONG_PTR)DestBits - wd);
if (BltInfo->PatternSurface)
{
PatternY++;
PatternY %= BltInfo->PatternSurface->sizlBitmap.cy;
}
DestBits = (PULONG)(
(ULONG_PTR)DestBits -
((BltInfo->DestRect.right - BltInfo->DestRect.left) << 2) -
BltInfo->DestSurface->lDelta);
}
if (PatternSurface != NULL)
BITMAPOBJ_UnlockBitmap(PatternSurface);
return TRUE;
}

View file

@ -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: dib4bpp.c,v 1.37 2004/07/03 17:40:24 navaraf Exp $ */
/* $Id: dib4bpp.c,v 1.38 2004/07/14 20:48:56 navaraf Exp $ */
#include <w32k.h>
VOID
@ -60,34 +60,34 @@ DIB_4BPP_VLine(SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
}
}
BOOLEAN STATIC
DIB_4BPP_BitBltSrcCopy(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
PRECTL DestRect, POINTL *SourcePoint,
XLATEOBJ* ColorTranslation)
BOOLEAN
DIB_4BPP_BitBltSrcCopy(PBLTINFO BltInfo)
{
LONG i, j, sx, sy, f2, xColor;
PBYTE SourceBits_24BPP, SourceLine_24BPP;
PBYTE DestBits, DestLine, SourceBits_8BPP, SourceLine_8BPP;
PBYTE SourceBits, SourceLine;
DestBits = DestSurf->pvScan0 + (DestRect->left>>1) + DestRect->top * DestSurf->lDelta;
DestBits = BltInfo->DestSurface->pvScan0 +
(BltInfo->DestRect.left >> 1) +
BltInfo->DestRect.top * BltInfo->DestSurface->lDelta;
switch(SourceSurf->iBitmapFormat)
switch (BltInfo->SourceSurface->iBitmapFormat)
{
case BMF_1BPP:
sx = SourcePoint->x;
sy = SourcePoint->y;
sx = BltInfo->SourcePoint.x;
sy = BltInfo->SourcePoint.y;
for (j=DestRect->top; j<DestRect->bottom; j++)
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
{
sx = SourcePoint->x;
for (i=DestRect->left; i<DestRect->right; i++)
sx = BltInfo->SourcePoint.x;
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
{
if(DIB_1BPP_GetPixel(SourceSurf, sx, sy) == 0)
if(DIB_1BPP_GetPixel(BltInfo->SourceSurface, sx, sy) == 0)
{
DIB_4BPP_PutPixel(DestSurf, i, j, XLATEOBJ_iXlate(ColorTranslation, 0));
DIB_4BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 0));
} else {
DIB_4BPP_PutPixel(DestSurf, i, j, XLATEOBJ_iXlate(ColorTranslation, 1));
DIB_4BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 1));
}
sx++;
}
@ -96,21 +96,21 @@ DIB_4BPP_BitBltSrcCopy(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
break;
case BMF_4BPP:
sy = SourcePoint->y;
sy = BltInfo->SourcePoint.y;
for (j=DestRect->top; j<DestRect->bottom; j++)
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
{
sx = SourcePoint->x;
sx = BltInfo->SourcePoint.x;
for (i=DestRect->left; i<DestRect->right; i++)
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
{
if (NULL != ColorTranslation)
if (NULL != BltInfo->XlateSourceToDest)
{
DIB_4BPP_PutPixel(DestSurf, i, j, XLATEOBJ_iXlate(ColorTranslation, DIB_4BPP_GetPixel(SourceSurf, sx, sy)));
DIB_4BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, DIB_4BPP_GetPixel(BltInfo->SourceSurface, sx, sy)));
}
else
{
DIB_4BPP_PutPixel(DestSurf, i, j, DIB_4BPP_GetPixel(SourceSurf, sx, sy));
DIB_4BPP_PutPixel(BltInfo->DestSurface, i, j, DIB_4BPP_GetPixel(BltInfo->SourceSurface, sx, sy));
}
sx++;
}
@ -119,124 +119,118 @@ DIB_4BPP_BitBltSrcCopy(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
break;
case BMF_8BPP:
SourceBits_8BPP = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + SourcePoint->x;
SourceBits_8BPP = BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + BltInfo->SourcePoint.x;
for (j=DestRect->top; j<DestRect->bottom; j++)
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
{
SourceLine_8BPP = SourceBits_8BPP;
DestLine = DestBits;
f2 = DestRect->left & 1;
f2 = BltInfo->DestRect.left & 1;
for (i=DestRect->left; i<DestRect->right; i++)
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
{
*DestLine = (*DestLine & notmask[f2]) |
((XLATEOBJ_iXlate(ColorTranslation, *SourceLine_8BPP)) << ((4 * (1 - f2))));
((XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *SourceLine_8BPP)) << ((4 * (1 - f2))));
if(f2 == 1) { DestLine++; f2 = 0; } else { f2 = 1; }
SourceLine_8BPP++;
}
SourceBits_8BPP += SourceSurf->lDelta;
DestBits += DestSurf->lDelta;
SourceBits_8BPP += BltInfo->SourceSurface->lDelta;
DestBits += BltInfo->DestSurface->lDelta;
}
break;
case BMF_16BPP:
SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 2 * SourcePoint->x;
SourceLine = BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 2 * BltInfo->SourcePoint.x;
DestLine = DestBits;
for (j = DestRect->top; j < DestRect->bottom; j++)
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
{
SourceBits = SourceLine;
DestBits = DestLine;
f2 = DestRect->left & 1;
f2 = BltInfo->DestRect.left & 1;
for (i = DestRect->left; i < DestRect->right; i++)
for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
{
xColor = *((PWORD) SourceBits);
*DestBits = (*DestBits & notmask[f2]) |
((XLATEOBJ_iXlate(ColorTranslation, xColor)) << ((4 * (1 - f2))));
((XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor)) << ((4 * (1 - f2))));
if(f2 == 1) { DestBits++; f2 = 0; } else { f2 = 1; }
SourceBits += 2;
}
SourceLine += SourceSurf->lDelta;
DestLine += DestSurf->lDelta;
SourceLine += BltInfo->SourceSurface->lDelta;
DestLine += BltInfo->DestSurface->lDelta;
}
break;
case BMF_24BPP:
SourceBits_24BPP = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + SourcePoint->x * 3;
SourceBits_24BPP = BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + BltInfo->SourcePoint.x * 3;
for (j=DestRect->top; j<DestRect->bottom; j++)
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
{
SourceLine_24BPP = SourceBits_24BPP;
DestLine = DestBits;
f2 = DestRect->left & 1;
f2 = BltInfo->DestRect.left & 1;
for (i=DestRect->left; i<DestRect->right; i++)
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
{
xColor = (*(SourceLine_24BPP + 2) << 0x10) +
(*(SourceLine_24BPP + 1) << 0x08) +
(*(SourceLine_24BPP));
*DestLine = (*DestLine & notmask[f2]) |
((XLATEOBJ_iXlate(ColorTranslation, xColor)) << ((4 * (1 - f2))));
((XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor)) << ((4 * (1 - f2))));
if(f2 == 1) { DestLine++; f2 = 0; } else { f2 = 1; }
SourceLine_24BPP+=3;
}
SourceBits_24BPP += SourceSurf->lDelta;
DestBits += DestSurf->lDelta;
SourceBits_24BPP += BltInfo->SourceSurface->lDelta;
DestBits += BltInfo->DestSurface->lDelta;
}
break;
case BMF_32BPP:
SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 4 * SourcePoint->x;
SourceLine = BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 4 * BltInfo->SourcePoint.x;
DestLine = DestBits;
for (j = DestRect->top; j < DestRect->bottom; j++)
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
{
SourceBits = SourceLine;
DestBits = DestLine;
f2 = DestRect->left & 1;
f2 = BltInfo->DestRect.left & 1;
for (i = DestRect->left; i < DestRect->right; i++)
for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
{
xColor = *((PDWORD) SourceBits);
*DestBits = (*DestBits & notmask[f2]) |
((XLATEOBJ_iXlate(ColorTranslation, xColor)) << ((4 * (1 - f2))));
((XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor)) << ((4 * (1 - f2))));
if(f2 == 1) { DestBits++; f2 = 0; } else { f2 = 1; }
SourceBits += 4;
}
SourceLine += SourceSurf->lDelta;
DestLine += DestSurf->lDelta;
SourceLine += BltInfo->SourceSurface->lDelta;
DestLine += BltInfo->DestSurface->lDelta;
}
break;
default:
DbgPrint("DIB_4BPP_Bitblt: Unhandled Source BPP: %u\n", BitsPerFormat(SourceSurf->iBitmapFormat));
DbgPrint("DIB_4BPP_Bitblt: Unhandled Source BPP: %u\n", BitsPerFormat(BltInfo->SourceSurface->iBitmapFormat));
return FALSE;
}
return(TRUE);
}
BOOLEAN
DIB_4BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
PRECTL DestRect, POINTL *SourcePoint,
BRUSHOBJ *Brush, POINTL BrushOrigin,
XLATEOBJ *ColorTranslation, ULONG Rop4)
DIB_4BPP_BitBlt(PBLTINFO BltInfo)
{
LONG i, j, sx, sy;
ULONG DestX, DestY;
ULONG SourceX, SourceY;
ULONG PatternY = 0;
ULONG Dest, Source = 0, Pattern = 0;
BOOLEAN UsesSource;
BOOLEAN UsesPattern;
PULONG DestBits;
BOOL UsesSource;
BOOL UsesPattern;
LONG RoundedRight;
/* Pattern brushes */
PGDIBRUSHOBJ GdiBrush = NULL;
HBITMAP PatternSurface = NULL;
SURFOBJ *PatternObj = NULL;
ULONG PatternWidth = 0, PatternHeight = 0, PatternY = 0;
static const ULONG ExpandSolidColor[16] =
{
0x00000000 /* 0 */,
@ -257,126 +251,107 @@ DIB_4BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
0xFFFFFFFF /* 15 */,
};
if (Rop4 == SRCCOPY)
{
return DIB_4BPP_BitBltSrcCopy(
DestSurf,
SourceSurf,
DestRect,
SourcePoint,
ColorTranslation);
}
UsesSource = ROP_USES_SOURCE(BltInfo->Rop4);
UsesPattern = ROP_USES_PATTERN(BltInfo->Rop4);
UsesSource = ((Rop4 & 0xCC0000) >> 2) != (Rop4 & 0x330000);
UsesPattern = (((Rop4 & 0xF00000) >> 4) != (Rop4 & 0x0F0000)) && Brush;
SourceY = BltInfo->SourcePoint.y;
RoundedRight = BltInfo->DestRect.right -
((BltInfo->DestRect.right - BltInfo->DestRect.left) & 0x7);
if (UsesPattern)
{
if (Brush->iSolidColor == 0xFFFFFFFF)
if (BltInfo->PatternSurface)
{
PBITMAPOBJ PatternBitmap;
GdiBrush = CONTAINING_RECORD(
Brush,
GDIBRUSHOBJ,
BrushObject);
PatternSurface = GdiBrush->hbmPattern;
PatternBitmap = BITMAPOBJ_LockBitmap(GdiBrush->hbmPattern);
PatternObj = &PatternBitmap->SurfObj;
PatternWidth = PatternObj->sizlBitmap.cx;
PatternHeight = PatternObj->sizlBitmap.cy;
UsesPattern = TRUE;
PatternY = (BltInfo->DestRect.top + BltInfo->BrushOrigin.y) %
BltInfo->PatternSurface->sizlBitmap.cy;
}
else
{
UsesPattern = FALSE;
Pattern = ExpandSolidColor[Brush->iSolidColor & 0xF];
Pattern = ExpandSolidColor[BltInfo->Brush->iSolidColor];
}
}
sy = SourcePoint->y;
RoundedRight = DestRect->right - ((DestRect->right - DestRect->left) & 0x7);
for (j = DestRect->top; j < DestRect->bottom; j++, sy++)
for (DestY = BltInfo->DestRect.top; DestY < BltInfo->DestRect.bottom; DestY++)
{
DestBits = (PULONG)(DestSurf->pvScan0 + (DestRect->left >> 1) + j * DestSurf->lDelta);
sx = SourcePoint->x;
i = DestRect->left;
DestBits = (PULONG)(
BltInfo->DestSurface->pvScan0 +
(BltInfo->DestRect.left >> 1) +
DestY * BltInfo->DestSurface->lDelta);
SourceX = BltInfo->SourcePoint.x;
DestX = BltInfo->DestRect.left;
if (UsesPattern)
PatternY = (j + BrushOrigin.y) % PatternHeight;
if (i & 0x1)
if (DestX & 0x1)
{
Dest = DIB_4BPP_GetPixel(DestSurf, i, j);
Dest = DIB_4BPP_GetPixel(BltInfo->DestSurface, DestX, DestY);
if (UsesSource)
{
Source = DIB_GetSource(SourceSurf, sx, sy, ColorTranslation);
Source = DIB_GetSource(BltInfo->SourceSurface, SourceX, SourceY, BltInfo->XlateSourceToDest);
}
if (UsesPattern)
if (BltInfo->PatternSurface)
{
Pattern = DIB_1BPP_GetPixel(PatternObj, (i + BrushOrigin.x) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
Pattern = DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest);
}
DIB_4BPP_PutPixel(DestSurf, i, j, DIB_DoRop(Rop4, Dest, Source, Pattern) & 0xF);
DIB_4BPP_PutPixel(BltInfo->DestSurface, DestX, DestY, DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern) & 0xF);
i++;
sx++;
DestX++;
SourceX++;
DestBits = (PULONG)((ULONG_PTR)DestBits + 1);
}
for (; i < RoundedRight; i += 8, sx += 8, DestBits++)
for (; DestX < RoundedRight; DestX += 8, SourceX += 8, DestBits++)
{
Dest = *DestBits;
if (UsesSource)
{
Source =
(DIB_GetSource(SourceSurf, sx + 1, sy, ColorTranslation)) |
(DIB_GetSource(SourceSurf, sx + 0, sy, ColorTranslation) << 4) |
(DIB_GetSource(SourceSurf, sx + 3, sy, ColorTranslation) << 8) |
(DIB_GetSource(SourceSurf, sx + 2, sy, ColorTranslation) << 12) |
(DIB_GetSource(SourceSurf, sx + 5, sy, ColorTranslation) << 16) |
(DIB_GetSource(SourceSurf, sx + 4, sy, ColorTranslation) << 20) |
(DIB_GetSource(SourceSurf, sx + 7, sy, ColorTranslation) << 24) |
(DIB_GetSource(SourceSurf, sx + 6, sy, ColorTranslation) << 28);
(DIB_GetSource(BltInfo->SourceSurface, SourceX + 1, SourceY, BltInfo->XlateSourceToDest)) |
(DIB_GetSource(BltInfo->SourceSurface, SourceX + 0, SourceY, BltInfo->XlateSourceToDest) << 4) |
(DIB_GetSource(BltInfo->SourceSurface, SourceX + 3, SourceY, BltInfo->XlateSourceToDest) << 8) |
(DIB_GetSource(BltInfo->SourceSurface, SourceX + 2, SourceY, BltInfo->XlateSourceToDest) << 12) |
(DIB_GetSource(BltInfo->SourceSurface, SourceX + 5, SourceY, BltInfo->XlateSourceToDest) << 16) |
(DIB_GetSource(BltInfo->SourceSurface, SourceX + 4, SourceY, BltInfo->XlateSourceToDest) << 20) |
(DIB_GetSource(BltInfo->SourceSurface, SourceX + 7, SourceY, BltInfo->XlateSourceToDest) << 24) |
(DIB_GetSource(BltInfo->SourceSurface, SourceX + 6, SourceY, BltInfo->XlateSourceToDest) << 28);
}
if (UsesPattern)
if (BltInfo->PatternSurface)
{
Pattern = DIB_1BPP_GetPixel(PatternObj, (i + BrushOrigin.x + 1) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + BrushOrigin.x + 0) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 4;
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + BrushOrigin.x + 3) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 8;
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + BrushOrigin.x + 2) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 12;
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + BrushOrigin.x + 5) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 16;
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + BrushOrigin.x + 4) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 20;
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + BrushOrigin.x + 7) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 24;
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + BrushOrigin.x + 6) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 28;
Pattern = DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 1) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest);
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 0) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << 4;
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 3) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << 8;
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 2) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << 12;
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 5) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << 16;
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 4) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << 20;
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 7) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << 24;
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 6) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << 28;
}
*DestBits = DIB_DoRop(Rop4, Dest, Source, Pattern);
*DestBits = DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern);
}
/* Process the rest of pixel on the line */
for (; i < DestRect->right; i++, sx++)
for (; DestX < BltInfo->DestRect.right; DestX++, SourceX++)
{
Dest = DIB_4BPP_GetPixel(DestSurf, i, j);
Dest = DIB_4BPP_GetPixel(BltInfo->DestSurface, DestX, DestY);
if (UsesSource)
{
Source = DIB_GetSource(SourceSurf, sx, sy, ColorTranslation);
Source = DIB_GetSource(BltInfo->SourceSurface, SourceX, SourceY, BltInfo->XlateSourceToDest);
}
if (UsesPattern)
if (BltInfo->PatternSurface)
{
Pattern = DIB_1BPP_GetPixel(PatternObj, (i + BrushOrigin.x) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
}
DIB_4BPP_PutPixel(DestSurf, i, j, DIB_DoRop(Rop4, Dest, Source, Pattern) & 0xF);
Pattern = DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest);
}
DIB_4BPP_PutPixel(BltInfo->DestSurface, DestX, DestY, DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern) & 0xF);
}
if (PatternSurface != NULL)
BITMAPOBJ_UnlockBitmap(PatternSurface);
SourceY++;
if (BltInfo->PatternSurface)
{
PatternY++;
PatternY %= BltInfo->PatternSurface->sizlBitmap.cy;
}
}
return TRUE;
}

View file

@ -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.28 2004/07/03 17:40:24 navaraf Exp $ */
/* $Id: dib8bpp.c,v 1.29 2004/07/14 20:48:56 navaraf Exp $ */
#include <w32k.h>
VOID
@ -65,32 +65,30 @@ DIB_8BPP_VLine(SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
}
BOOLEAN
DIB_8BPP_BitBltSrcCopy(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
PRECTL DestRect, POINTL *SourcePoint,
XLATEOBJ *ColorTranslation)
DIB_8BPP_BitBltSrcCopy(PBLTINFO BltInfo)
{
LONG i, j, sx, sy, xColor, f1;
PBYTE SourceBits, DestBits, SourceLine, DestLine;
PBYTE SourceBits_4BPP, SourceLine_4BPP;
DestBits = DestSurf->pvScan0 + (DestRect->top * DestSurf->lDelta) + DestRect->left;
DestBits = BltInfo->DestSurface->pvScan0 + (BltInfo->DestRect.top * BltInfo->DestSurface->lDelta) + BltInfo->DestRect.left;
switch(SourceSurf->iBitmapFormat)
switch(BltInfo->SourceSurface->iBitmapFormat)
{
case BMF_1BPP:
sx = SourcePoint->x;
sy = SourcePoint->y;
sx = BltInfo->SourcePoint.x;
sy = BltInfo->SourcePoint.y;
for (j=DestRect->top; j<DestRect->bottom; j++)
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
{
sx = SourcePoint->x;
for (i=DestRect->left; i<DestRect->right; i++)
sx = BltInfo->SourcePoint.x;
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
{
if(DIB_1BPP_GetPixel(SourceSurf, sx, sy) == 0)
if(DIB_1BPP_GetPixel(BltInfo->SourceSurface, sx, sy) == 0)
{
DIB_8BPP_PutPixel(DestSurf, i, j, XLATEOBJ_iXlate(ColorTranslation, 0));
DIB_8BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 0));
} else {
DIB_8BPP_PutPixel(DestSurf, i, j, XLATEOBJ_iXlate(ColorTranslation, 1));
DIB_8BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 1));
}
sx++;
}
@ -99,159 +97,159 @@ DIB_8BPP_BitBltSrcCopy(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
break;
case BMF_4BPP:
SourceBits_4BPP = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + (SourcePoint->x >> 1);
SourceBits_4BPP = BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + (BltInfo->SourcePoint.x >> 1);
for (j=DestRect->top; j<DestRect->bottom; j++)
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
{
SourceLine_4BPP = SourceBits_4BPP;
sx = SourcePoint->x;
sx = BltInfo->SourcePoint.x;
f1 = sx & 1;
for (i=DestRect->left; i<DestRect->right; i++)
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
{
xColor = XLATEOBJ_iXlate(ColorTranslation,
xColor = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest,
(*SourceLine_4BPP & altnotmask[f1]) >> (4 * (1 - f1)));
DIB_8BPP_PutPixel(DestSurf, i, j, xColor);
DIB_8BPP_PutPixel(BltInfo->DestSurface, i, j, xColor);
if(f1 == 1) { SourceLine_4BPP++; f1 = 0; } else { f1 = 1; }
sx++;
}
SourceBits_4BPP += SourceSurf->lDelta;
SourceBits_4BPP += BltInfo->SourceSurface->lDelta;
}
break;
case BMF_8BPP:
if (NULL == ColorTranslation || 0 != (ColorTranslation->flXlate & XO_TRIVIAL))
if (NULL == BltInfo->XlateSourceToDest || 0 != (BltInfo->XlateSourceToDest->flXlate & XO_TRIVIAL))
{
if (DestRect->top < SourcePoint->y)
if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
{
SourceBits = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + SourcePoint->x;
for (j = DestRect->top; j < DestRect->bottom; j++)
SourceBits = BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + BltInfo->SourcePoint.x;
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
{
RtlMoveMemory(DestBits, SourceBits, DestRect->right - DestRect->left);
SourceBits += SourceSurf->lDelta;
DestBits += DestSurf->lDelta;
RtlMoveMemory(DestBits, SourceBits, BltInfo->DestRect.right - BltInfo->DestRect.left);
SourceBits += BltInfo->SourceSurface->lDelta;
DestBits += BltInfo->DestSurface->lDelta;
}
}
else
{
SourceBits = SourceSurf->pvScan0 + ((SourcePoint->y + DestRect->bottom - DestRect->top - 1) * SourceSurf->lDelta) + SourcePoint->x;
DestBits = DestSurf->pvScan0 + ((DestRect->bottom - 1) * DestSurf->lDelta) + DestRect->left;
for (j = DestRect->bottom - 1; DestRect->top <= j; j--)
SourceBits = BltInfo->SourceSurface->pvScan0 + ((BltInfo->SourcePoint.y + BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta) + BltInfo->SourcePoint.x;
DestBits = BltInfo->DestSurface->pvScan0 + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta) + BltInfo->DestRect.left;
for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
{
RtlMoveMemory(DestBits, SourceBits, DestRect->right - DestRect->left);
SourceBits -= SourceSurf->lDelta;
DestBits -= DestSurf->lDelta;
RtlMoveMemory(DestBits, SourceBits, BltInfo->DestRect.right - BltInfo->DestRect.left);
SourceBits -= BltInfo->SourceSurface->lDelta;
DestBits -= BltInfo->DestSurface->lDelta;
}
}
}
else
{
if (DestRect->top < SourcePoint->y)
if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
{
SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + SourcePoint->x;
SourceLine = BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + BltInfo->SourcePoint.x;
DestLine = DestBits;
for (j = DestRect->top; j < DestRect->bottom; j++)
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
{
SourceBits = SourceLine;
DestBits = DestLine;
for (i=DestRect->left; i<DestRect->right; i++)
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
{
*DestBits++ = XLATEOBJ_iXlate(ColorTranslation, *SourceBits++);
*DestBits++ = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *SourceBits++);
}
SourceLine += SourceSurf->lDelta;
DestLine += DestSurf->lDelta;
SourceLine += BltInfo->SourceSurface->lDelta;
DestLine += BltInfo->DestSurface->lDelta;
}
}
else
{
SourceLine = SourceSurf->pvScan0 + ((SourcePoint->y + DestRect->bottom - DestRect->top - 1) * SourceSurf->lDelta) + SourcePoint->x;
DestLine = DestSurf->pvScan0 + ((DestRect->bottom - 1) * DestSurf->lDelta) + DestRect->left;
for (j = DestRect->bottom - 1; DestRect->top <= j; j--)
SourceLine = BltInfo->SourceSurface->pvScan0 + ((BltInfo->SourcePoint.y + BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta) + BltInfo->SourcePoint.x;
DestLine = BltInfo->DestSurface->pvScan0 + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta) + BltInfo->DestRect.left;
for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
{
SourceBits = SourceLine;
DestBits = DestLine;
for (i=DestRect->left; i<DestRect->right; i++)
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
{
*DestBits++ = XLATEOBJ_iXlate(ColorTranslation, *SourceBits++);
*DestBits++ = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *SourceBits++);
}
SourceLine -= SourceSurf->lDelta;
DestLine -= DestSurf->lDelta;
SourceLine -= BltInfo->SourceSurface->lDelta;
DestLine -= BltInfo->DestSurface->lDelta;
}
}
}
break;
case BMF_16BPP:
SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 2 * SourcePoint->x;
SourceLine = BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 2 * BltInfo->SourcePoint.x;
DestLine = DestBits;
for (j = DestRect->top; j < DestRect->bottom; j++)
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
{
SourceBits = SourceLine;
DestBits = DestLine;
for (i = DestRect->left; i < DestRect->right; i++)
for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
{
xColor = *((PWORD) SourceBits);
*DestBits = XLATEOBJ_iXlate(ColorTranslation, xColor);
*DestBits = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
SourceBits += 2;
DestBits += 1;
}
SourceLine += SourceSurf->lDelta;
DestLine += DestSurf->lDelta;
SourceLine += BltInfo->SourceSurface->lDelta;
DestLine += BltInfo->DestSurface->lDelta;
}
break;
case BMF_24BPP:
SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 3 * SourcePoint->x;
SourceLine = BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 3 * BltInfo->SourcePoint.x;
DestLine = DestBits;
for (j = DestRect->top; j < DestRect->bottom; j++)
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
{
SourceBits = SourceLine;
DestBits = DestLine;
for (i = DestRect->left; i < DestRect->right; i++)
for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
{
xColor = (*(SourceBits + 2) << 0x10) +
(*(SourceBits + 1) << 0x08) +
(*(SourceBits));
*DestBits = XLATEOBJ_iXlate(ColorTranslation, xColor);
*DestBits = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
SourceBits += 3;
DestBits += 1;
}
SourceLine += SourceSurf->lDelta;
DestLine += DestSurf->lDelta;
SourceLine += BltInfo->SourceSurface->lDelta;
DestLine += BltInfo->DestSurface->lDelta;
}
break;
case BMF_32BPP:
SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 4 * SourcePoint->x;
SourceLine = BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 4 * BltInfo->SourcePoint.x;
DestLine = DestBits;
for (j = DestRect->top; j < DestRect->bottom; j++)
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
{
SourceBits = SourceLine;
DestBits = DestLine;
for (i = DestRect->left; i < DestRect->right; i++)
for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
{
xColor = *((PDWORD) SourceBits);
*DestBits = XLATEOBJ_iXlate(ColorTranslation, xColor);
*DestBits = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
SourceBits += 4;
DestBits += 1;
}
SourceLine += SourceSurf->lDelta;
DestLine += DestSurf->lDelta;
SourceLine += BltInfo->SourceSurface->lDelta;
DestLine += BltInfo->DestSurface->lDelta;
}
break;
default:
DPRINT1("DIB_8BPP_Bitblt: Unhandled Source BPP: %u\n", BitsPerFormat(SourceSurf->iBitmapFormat));
DPRINT1("DIB_8BPP_Bitblt: Unhandled Source BPP: %u\n", BitsPerFormat(BltInfo->SourceSurface->iBitmapFormat));
return FALSE;
}
@ -259,123 +257,98 @@ DIB_8BPP_BitBltSrcCopy(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
}
BOOLEAN
DIB_8BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
PRECTL DestRect, POINTL *SourcePoint,
BRUSHOBJ *Brush, POINTL BrushOrigin,
XLATEOBJ *ColorTranslation, ULONG Rop4)
DIB_8BPP_BitBlt(PBLTINFO BltInfo)
{
LONG i, j, k, sx, sy;
ULONG DestX, DestY;
ULONG SourceX, SourceY;
ULONG PatternY = 0;
ULONG Dest, Source = 0, Pattern = 0;
PULONG DestBits;
BOOL UsesSource;
BOOL UsesPattern;
PULONG DestBits;
LONG RoundedRight;
/* Pattern brushes */
PGDIBRUSHOBJ GdiBrush = NULL;
HBITMAP PatternSurface = NULL;
SURFOBJ *PatternObj = NULL;
ULONG PatternWidth = 0, PatternHeight = 0, PatternY = 0;
if (Rop4 == SRCCOPY)
{
return DIB_8BPP_BitBltSrcCopy(
DestSurf,
SourceSurf,
DestRect,
SourcePoint,
ColorTranslation);
}
UsesSource = ROP_USES_SOURCE(BltInfo->Rop4);
UsesPattern = ROP_USES_PATTERN(BltInfo->Rop4);
UsesSource = ((Rop4 & 0xCC0000) >> 2) != (Rop4 & 0x330000);
UsesPattern = (((Rop4 & 0xF00000) >> 4) != (Rop4 & 0x0F0000)) && Brush;
SourceY = BltInfo->SourcePoint.y;
RoundedRight = BltInfo->DestRect.right -
((BltInfo->DestRect.right - BltInfo->DestRect.left) & 0x7);
if (UsesPattern)
{
if (Brush->iSolidColor == 0xFFFFFFFF)
if (BltInfo->PatternSurface)
{
PBITMAPOBJ PatternBitmap;
GdiBrush = CONTAINING_RECORD(
Brush,
GDIBRUSHOBJ,
BrushObject);
PatternSurface = GdiBrush->hbmPattern;
PatternBitmap = BITMAPOBJ_LockBitmap(GdiBrush->hbmPattern);
PatternObj = &PatternBitmap->SurfObj;
PatternWidth = PatternObj->sizlBitmap.cx;
PatternHeight = PatternObj->sizlBitmap.cy;
UsesPattern = TRUE;
PatternY = (BltInfo->DestRect.top + BltInfo->BrushOrigin.y) %
BltInfo->PatternSurface->sizlBitmap.cy;
}
else
{
UsesPattern = FALSE;
Pattern = (Brush->iSolidColor & 0xFF) |
((Brush->iSolidColor & 0xFF) << 8) |
((Brush->iSolidColor & 0xFF) << 16) |
((Brush->iSolidColor & 0xFF) << 24);
Pattern = BltInfo->Brush->iSolidColor |
(BltInfo->Brush->iSolidColor << 8) |
(BltInfo->Brush->iSolidColor << 16) |
(BltInfo->Brush->iSolidColor << 24);
}
}
RoundedRight = DestRect->right - ((DestRect->right - DestRect->left) & 0x3);
sy = SourcePoint->y;
for (j = DestRect->top; j < DestRect->bottom; j++)
for (DestY = BltInfo->DestRect.top; DestY < BltInfo->DestRect.bottom; DestY++)
{
sx = SourcePoint->x;
DestBits = (PULONG)(DestSurf->pvScan0 + DestRect->left + j * DestSurf->lDelta);
SourceX = BltInfo->SourcePoint.x;
DestBits = (PULONG)(
BltInfo->DestSurface->pvScan0 +
BltInfo->DestRect.left +
DestY * BltInfo->DestSurface->lDelta);
if(UsesPattern)
PatternY = (j + BrushOrigin.y) % PatternHeight;
for (i = DestRect->left; i < RoundedRight; i += 4, DestBits++)
for (DestX = BltInfo->DestRect.left; DestX < RoundedRight; DestX += 4, DestBits++)
{
Dest = *DestBits;
if (UsesSource)
{
Source = 0;
for (k = 0; k < 4; k++)
Source |= (DIB_GetSource(SourceSurf, sx + (i - DestRect->left) + k, sy, ColorTranslation) << (k * 8));
Source = DIB_GetSource(BltInfo->SourceSurface, SourceX + (DestX - BltInfo->DestRect.left), SourceY, BltInfo->XlateSourceToDest);
Source |= DIB_GetSource(BltInfo->SourceSurface, SourceX + (DestX - BltInfo->DestRect.left) + 1, SourceY, BltInfo->XlateSourceToDest) << 8;
Source |= DIB_GetSource(BltInfo->SourceSurface, SourceX + (DestX - BltInfo->DestRect.left) + 2, SourceY, BltInfo->XlateSourceToDest) << 16;
Source |= DIB_GetSource(BltInfo->SourceSurface, SourceX + (DestX - BltInfo->DestRect.left) + 3, SourceY, BltInfo->XlateSourceToDest) << 24;
}
if (UsesPattern)
if (BltInfo->PatternSurface)
{
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);
Pattern = DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest);
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 1) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << 8;
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 2) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << 16;
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 3) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << 24;
}
if (i < DestRect->right)
*DestBits = DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern);
}
if (DestX < BltInfo->DestRect.right)
{
for (; i < DestRect->right; i++)
for (; DestX < BltInfo->DestRect.right; DestX++)
{
Dest = DIB_8BPP_GetPixel(DestSurf, i, j);
Dest = DIB_8BPP_GetPixel(BltInfo->DestSurface, DestX, DestY);
if (UsesSource)
{
Source = DIB_GetSource(SourceSurf, sx + (i - DestRect->left), sy, ColorTranslation);
Source = DIB_GetSource(BltInfo->SourceSurface, SourceX + (DestX - BltInfo->DestRect.left), SourceY, BltInfo->XlateSourceToDest);
}
if (UsesPattern)
if (BltInfo->PatternSurface)
{
Pattern = DIB_1BPP_GetPixel(PatternObj, (i + BrushOrigin.x) % PatternWidth,PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
Pattern = DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest);
}
DIB_8BPP_PutPixel(DestSurf, i, j, DIB_DoRop(Rop4, Dest, Source, Pattern) & 0xFFFF);
DIB_8BPP_PutPixel(BltInfo->DestSurface, DestX, DestY, DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern) & 0xFFFF);
}
}
sy++;
SourceY++;
if (BltInfo->PatternSurface)
{
PatternY++;
PatternY %= BltInfo->PatternSurface->sizlBitmap.cy;
}
}
if (PatternSurface != NULL)
BITMAPOBJ_UnlockBitmap(PatternSurface);
return TRUE;
}

View file

@ -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.57 2004/07/03 17:40:25 navaraf Exp $
/* $Id: bitblt.c,v 1.58 2004/07/14 20:48:57 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -88,7 +88,7 @@ BltMask(SURFOBJ* Dest,
BYTE *tMask, *lMask;
static BYTE maskbit[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
/* Pattern brushes */
PGDIBRUSHOBJ GdiBrush = NULL;
PGDIBRUSHINST GdiBrush = NULL;
HBITMAP PatternSurface = NULL;
SURFOBJ *PatternObj = NULL;
ULONG PatternWidth = 0, PatternHeight = 0, PatternY = 0;
@ -107,11 +107,11 @@ BltMask(SURFOBJ* Dest,
GdiBrush = CONTAINING_RECORD(
Brush,
GDIBRUSHOBJ,
GDIBRUSHINST,
BrushObject);
PatternSurface = GdiBrush->hbmPattern;
PatternBitmap = BITMAPOBJ_LockBitmap(GdiBrush->hbmPattern);
PatternSurface = GdiBrush->GdiBrushObject->hbmPattern;
PatternBitmap = BITMAPOBJ_LockBitmap(GdiBrush->GdiBrushObject->hbmPattern);
PatternObj = &PatternBitmap->SurfObj;
PatternWidth = PatternObj->sizlBitmap.cx;
@ -140,7 +140,7 @@ BltMask(SURFOBJ* Dest,
{
DibFunctionsForBitmapFormat[Dest->iBitmapFormat].DIB_PutPixel(
Dest, DestRect->left + i, DestRect->top + j,
DIB_1BPP_GetPixel(PatternObj, (DestRect->left + i) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack);
DIB_GetSource(PatternObj, (DestRect->left + i) % PatternWidth, PatternY, GdiBrush->XlateObject));
}
}
c8++;
@ -198,18 +198,44 @@ CallDibBitBlt(SURFOBJ* OutputObj,
POINTL* BrushOrigin,
ROP4 Rop4)
{
POINTL RealBrushOrigin;
if (BrushOrigin == NULL)
BLTINFO BltInfo;
PGDIBRUSHINST GdiBrush = NULL;
BITMAPOBJ *bmPattern;
BOOLEAN Result;
BltInfo.DestSurface = OutputObj;
BltInfo.SourceSurface = InputObj;
BltInfo.PatternSurface = NULL;
BltInfo.XlateSourceToDest = ColorTranslation;
BltInfo.DestRect = *OutputRect;
BltInfo.SourcePoint = *InputPoint;
if (Rop4 == SRCCOPY)
return DibFunctionsForBitmapFormat[OutputObj->iBitmapFormat].DIB_BitBltSrcCopy(&BltInfo);
BltInfo.XlatePatternToDest = NULL;
BltInfo.Brush = Brush;
BltInfo.BrushOrigin = *BrushOrigin;
BltInfo.Rop4 = Rop4;
/* Pattern brush */
if (ROP_USES_PATTERN(Rop4) && Brush->iSolidColor == 0xFFFFFFFF)
{
RealBrushOrigin.x = RealBrushOrigin.y = 0;
}
else
{
RealBrushOrigin = *BrushOrigin;
GdiBrush = CONTAINING_RECORD(Brush, GDIBRUSHINST, BrushObject);
bmPattern = BITMAPOBJ_LockBitmap(GdiBrush->GdiBrushObject->hbmPattern);
BltInfo.PatternSurface = &bmPattern->SurfObj;
BltInfo.XlatePatternToDest = GdiBrush->XlateObject;
}
return DibFunctionsForBitmapFormat[OutputObj->iBitmapFormat].DIB_BitBlt(
OutputObj, InputObj, OutputRect, InputPoint, Brush, RealBrushOrigin, ColorTranslation, Rop4);
Result = DibFunctionsForBitmapFormat[OutputObj->iBitmapFormat].DIB_BitBlt(&BltInfo);
/* Pattern brush */
if (ROP_USES_PATTERN(Rop4) && Brush->iSolidColor == 0xFFFFFFFF)
{
BITMAPOBJ_UnlockBitmap(BltInfo.PatternSurface->hsurf);
}
return Result;
}
INT abs(INT nm);

View file

@ -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: copybits.c,v 1.25 2004/07/03 13:55:35 navaraf Exp $
/* $Id: copybits.c,v 1.26 2004/07/14 20:48:57 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -41,11 +41,9 @@ EngCopyBits(SURFOBJ *Dest,
{
BOOLEAN ret;
BYTE clippingType;
RECTL rclTmp;
POINTL ptlTmp;
RECT_ENUM RectEnum;
BOOL EnumMore;
POINTL BrushOrigin;
BLTINFO BltInfo;
MouseSafetyOnDrawStart(Source, SourcePoint->x, SourcePoint->y,
(SourcePoint->x + abs(DestRect->right - DestRect->left)),
@ -114,13 +112,20 @@ EngCopyBits(SURFOBJ *Dest,
clippingType = Clip->iDComplexity;
}
BrushOrigin.x = BrushOrigin.y = 0;
BltInfo.DestSurface = Dest;
BltInfo.SourceSurface = Source;
BltInfo.PatternSurface = NULL;
BltInfo.XlateSourceToDest = ColorTranslation;
BltInfo.XlatePatternToDest = NULL;
BltInfo.Rop4 = SRCCOPY;
switch(clippingType)
{
case DC_TRIVIAL:
DibFunctionsForBitmapFormat[Dest->iBitmapFormat].DIB_BitBlt(
Dest, Source, DestRect, SourcePoint, NULL, BrushOrigin, ColorTranslation, SRCCOPY);
BltInfo.DestRect = *DestRect;
BltInfo.SourcePoint = *SourcePoint;
DibFunctionsForBitmapFormat[Dest->iBitmapFormat].DIB_BitBltSrcCopy(&BltInfo);
MouseSafetyOnDrawEnd(Dest);
MouseSafetyOnDrawEnd(Source);
@ -129,13 +134,12 @@ EngCopyBits(SURFOBJ *Dest,
case DC_RECT:
// Clip the blt to the clip rectangle
EngIntersectRect(&rclTmp, DestRect, &Clip->rclBounds);
EngIntersectRect(&BltInfo.DestRect, DestRect, &Clip->rclBounds);
ptlTmp.x = SourcePoint->x + rclTmp.left - DestRect->left;
ptlTmp.y = SourcePoint->y + rclTmp.top - DestRect->top;
BltInfo.SourcePoint.x = SourcePoint->x + BltInfo.DestRect.left - DestRect->left;
BltInfo.SourcePoint.y = SourcePoint->y + BltInfo.DestRect.top - DestRect->top;
DibFunctionsForBitmapFormat[Dest->iBitmapFormat].DIB_BitBlt(
Dest, Source, &rclTmp, &ptlTmp, NULL, BrushOrigin, ColorTranslation, SRCCOPY);
DibFunctionsForBitmapFormat[Dest->iBitmapFormat].DIB_BitBltSrcCopy(&BltInfo);
MouseSafetyOnDrawEnd(Dest);
MouseSafetyOnDrawEnd(Source);
@ -155,13 +159,13 @@ EngCopyBits(SURFOBJ *Dest,
RECTL* prcl = &RectEnum.arcl[0];
do {
EngIntersectRect(prcl, prcl, DestRect);
EngIntersectRect(&BltInfo.DestRect, prcl, DestRect);
ptlTmp.x = SourcePoint->x + prcl->left - DestRect->left;
ptlTmp.y = SourcePoint->y + prcl->top - DestRect->top;
BltInfo.SourcePoint.x = SourcePoint->x + prcl->left - DestRect->left;
BltInfo.SourcePoint.y = SourcePoint->y + prcl->top - DestRect->top;
if(!DibFunctionsForBitmapFormat[Dest->iBitmapFormat].DIB_BitBlt(
Dest, Source, prcl, &ptlTmp, NULL, BrushOrigin, ColorTranslation, SRCCOPY)) return FALSE;
if(!DibFunctionsForBitmapFormat[Dest->iBitmapFormat].DIB_BitBltSrcCopy(&BltInfo))
return FALSE;
prcl++;

View file

@ -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: lineto.c,v 1.34 2004/07/03 13:55:35 navaraf Exp $
* $Id: lineto.c,v 1.35 2004/07/14 20:48:57 navaraf Exp $
*/
#include <w32k.h>
@ -40,7 +40,7 @@ TranslateRects(RECT_ENUM *RectEnum, POINTL* Translate)
/*
* Draw a line from top-left to bottom-right
*/
static void FASTCALL
void FASTCALL
NWtoSE(SURFOBJ* OutputObj, CLIPOBJ* Clip,
BRUSHOBJ* Brush, LONG x, LONG y, LONG deltax, LONG deltay,
POINTL* Translate)
@ -111,7 +111,7 @@ NWtoSE(SURFOBJ* OutputObj, CLIPOBJ* Clip,
}
}
static void FASTCALL
void FASTCALL
SWtoNE(SURFOBJ* OutputObj, CLIPOBJ* Clip,
BRUSHOBJ* Brush, LONG x, LONG y, LONG deltax, LONG deltay,
POINTL* Translate)
@ -181,7 +181,7 @@ SWtoNE(SURFOBJ* OutputObj, CLIPOBJ* Clip,
}
}
static void FASTCALL
void FASTCALL
NEtoSW(SURFOBJ* OutputObj, CLIPOBJ* Clip,
BRUSHOBJ* Brush, LONG x, LONG y, LONG deltax, LONG deltay,
POINTL* Translate)
@ -251,7 +251,7 @@ NEtoSW(SURFOBJ* OutputObj, CLIPOBJ* Clip,
}
}
static void FASTCALL
void FASTCALL
SEtoNW(SURFOBJ* OutputObj, CLIPOBJ* Clip,
BRUSHOBJ* Brush, LONG x, LONG y, LONG deltax, LONG deltay,
POINTL* Translate)
@ -492,15 +492,15 @@ IntEngLineTo(BITMAPOBJ *DestObj,
{
BOOLEAN ret;
SURFOBJ *DestSurf = &DestObj->SurfObj;
PGDIBRUSHOBJ GdiBrush;
PGDIBRUSHINST GdiBrush;
RECTL b;
GdiBrush = CONTAINING_RECORD(
Brush,
GDIBRUSHOBJ,
GDIBRUSHINST,
BrushObject);
if (GdiBrush->flAttrs & GDIBRUSH_IS_NULL)
if (GdiBrush->GdiBrushObject->flAttrs & GDIBRUSH_IS_NULL)
return TRUE;
/* No success yet */

View file

@ -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: mouse.c,v 1.75 2004/07/03 17:40:25 navaraf Exp $
/* $Id: mouse.c,v 1.76 2004/07/14 20:48:57 navaraf Exp $
*
* PROJECT: ReactOS kernel
* PURPOSE: Mouse
@ -591,18 +591,13 @@ EngSetPointerShape(
HPALETTE BWPalette, DestPalette;
ULONG BWColors[] = {0, 0xFFFFFF};
PDC Dc;
PPALGDI PalObj;
LONG DestMode;
BWPalette = EngCreatePalette(PAL_INDEXED, sizeof(BWColors) / sizeof(ULONG),
BWColors, 0, 0, 0);
Dc = DC_LockDc(IntGetScreenDC());
DestPalette = Dc->w.hPalette;
PalObj = PALETTE_LockPalette(DestPalette);
DestMode = PalObj->Mode;
PALETTE_UnlockPalette(DestPalette);
DC_UnlockDc(IntGetScreenDC());
ppdev->PointerXlateObject = IntEngCreateXlate(DestMode, PAL_INDEXED,
ppdev->PointerXlateObject = IntEngCreateXlate(0, PAL_INDEXED,
DestPalette, BWPalette);
EngDeletePalette(BWPalette);
}

View file

@ -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: xlate.c,v 1.40 2004/07/04 17:09:45 navaraf Exp $
/* $Id: xlate.c,v 1.41 2004/07/14 20:48:57 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -162,6 +162,11 @@ IntEngCreateXlate(USHORT DestPalType, USHORT SourcePalType,
else if (PaletteDest != NULL)
DestPalGDI = PALETTE_LockPalette(PaletteDest);
if (SourcePalType == 0)
SourcePalType = SourcePalGDI->Mode;
if (DestPalType == 0)
DestPalType = DestPalGDI->Mode;
XlateObj->iSrcType = SourcePalType;
XlateObj->iDstType = DestPalType;
XlateObj->flXlate = 0;
@ -269,15 +274,21 @@ XLATEOBJ * STDCALL IntEngCreateMonoXlate(
USHORT SourcePalType, HPALETTE PaletteDest, HPALETTE PaletteSource,
ULONG BackgroundColor)
{
HPALETTE NewXlate;
ULONG NewXlate;
XLATEOBJ *XlateObj;
XLATEGDI *XlateGDI;
PALGDI *SourcePalGDI;
NewXlate = (HPALETTE)CreateGDIHandle(sizeof(XLATEGDI), sizeof(XLATEOBJ), (PVOID*)&XlateGDI, (PVOID*)&XlateObj);
NewXlate = CreateGDIHandle(sizeof(XLATEGDI), sizeof(XLATEOBJ), (PVOID*)&XlateGDI, (PVOID*)&XlateObj);
if (!ValidEngHandle(NewXlate))
return NULL;
SourcePalGDI = PALETTE_LockPalette(PaletteSource);
ASSERT(SourcePalGDI);
if (SourcePalType == 0)
SourcePalType = SourcePalGDI->Mode;
XlateObj->iSrcType = SourcePalType;
XlateObj->iDstType = PAL_INDEXED;
@ -303,18 +314,69 @@ XLATEOBJ * STDCALL IntEngCreateMonoXlate(
break;
case PAL_BITFIELDS:
{
SourcePalGDI = PALETTE_LockPalette(PaletteSource);
BitMasksFromPal(SourcePalType, SourcePalGDI, &XlateGDI->RedMask,
&XlateGDI->BlueMask, &XlateGDI->GreenMask);
XlateGDI->RedShift = CalculateShift(0xFF) - CalculateShift(XlateGDI->RedMask);
XlateGDI->GreenShift = CalculateShift(0xFF00) - CalculateShift(XlateGDI->GreenMask);
XlateGDI->BlueShift = CalculateShift(0xFF0000) - CalculateShift(XlateGDI->BlueMask);
XlateGDI->BackgroundColor = ShiftAndMask(XlateGDI, BackgroundColor);
PALETTE_UnlockPalette(PaletteSource);
}
break;
}
PALETTE_UnlockPalette(PaletteSource);
return XlateObj;
}
XLATEOBJ * STDCALL
IntEngCreateSrcMonoXlate(HPALETTE PaletteDest,
ULONG ForegroundColor,
ULONG BackgroundColor)
{
ULONG NewXlate;
XLATEOBJ *XlateObj;
XLATEGDI *XlateGDI;
PALGDI *DestPalGDI;
DestPalGDI = PALETTE_LockPalette(PaletteDest);
if (DestPalGDI == NULL)
return NULL;
NewXlate = CreateGDIHandle(sizeof(XLATEGDI), sizeof(XLATEOBJ), (PVOID*)&XlateGDI, (PVOID*)&XlateObj);
if (!ValidEngHandle(NewXlate))
return NULL;
XlateGDI->translationTable = EngAllocMem(0, sizeof(ULONG) * 2, 0);
if (XlateGDI->translationTable == NULL)
{
FreeGDIHandle(NewXlate);
return NULL;
}
XlateObj->pulXlate = XlateGDI->translationTable;
XlateObj->iSrcType = PAL_INDEXED;
XlateObj->iDstType = DestPalGDI->Mode;
/* Store handles of palettes in internal Xlate GDI object (or NULLs) */
XlateGDI->SourcePal = NULL;
XlateGDI->DestPal = PaletteDest;
XlateObj->flXlate = XO_TABLE;
BitMasksFromPal(DestPalGDI->Mode, DestPalGDI, &XlateGDI->RedMask,
&XlateGDI->BlueMask, &XlateGDI->GreenMask);
XlateGDI->RedShift = CalculateShift(RGB(255, 0, 0)) - CalculateShift(XlateGDI->RedMask);
XlateGDI->GreenShift = CalculateShift(RGB(0, 255, 0)) - CalculateShift(XlateGDI->GreenMask);
XlateGDI->BlueShift = CalculateShift(RGB(0, 0, 255)) - CalculateShift(XlateGDI->BlueMask);
XlateGDI->translationTable[0] = ShiftAndMask(XlateGDI, BackgroundColor);
XlateGDI->translationTable[1] = ShiftAndMask(XlateGDI, ForegroundColor);
PALETTE_UnlockPalette(PaletteDest);
return XlateObj;
}

View file

@ -66,6 +66,11 @@ IntEngCreateMonoXlate(USHORT SourcePalType,
HPALETTE PaletteSource,
ULONG BackgroundColor);
XLATEOBJ * STDCALL
IntEngCreateSrcMonoXlate(HPALETTE PaletteDest,
ULONG ForegroundColor,
ULONG BackgroundColor);
BOOL STDCALL
IntEngPolyline(BITMAPOBJ *DestSurf,
CLIPOBJ *Clip,

View file

@ -3,6 +3,12 @@
/* Brush functions */
XLATEOBJ* FASTCALL
IntGdiCreateBrushXlate(PDC Dc, GDIBRUSHOBJ *BrushObj, BOOLEAN *Failed);
VOID FASTCALL
IntGdiInitBrushInstance(GDIBRUSHINST *BrushInst, PGDIBRUSHOBJ BrushObj, XLATEOBJ *XlateObj);
HBRUSH FASTCALL
IntGdiCreateBrushIndirect(PLOGBRUSH lb);

View file

@ -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: winpos.c,v 1.118 2004/06/20 22:27:19 gvg Exp $
/* $Id: winpos.c,v 1.119 2004/07/14 20:48:57 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -98,6 +98,22 @@ NtUserGetClientOrigin(HWND hWnd, LPPOINT Point)
return Ret;
}
/*******************************************************************
* WinPosCanActivateWindow
*
* Check if we can activate the specified window.
*/
static BOOL WinPosCanActivateWindow(HWND hWnd)
{
LONG Style;
if (!hWnd) return FALSE;
Style = NtUserGetWindowLong(hWnd, GWL_STYLE, FALSE);
if (!(Style & WS_VISIBLE)) return FALSE;
if ((Style & (WS_POPUP | WS_CHILD)) == WS_CHILD) return FALSE;
return !(Style & WS_DISABLED);
}
/*******************************************************************
* WinPosActivateOtherWindow
*
@ -106,63 +122,37 @@ NtUserGetClientOrigin(HWND hWnd, LPPOINT Point)
VOID FASTCALL
WinPosActivateOtherWindow(PWINDOW_OBJECT Window)
{
PWINDOW_OBJECT Wnd, Old;
int TryTopmost;
HWND hwndTo = NULL, fg;
PWINDOW_OBJECT wndTo;
if (!Window || IntIsDesktopWindow(Window))
if ((Window->Style & WS_POPUP) && (hwndTo = Window->Owner))
{
IntSetFocusMessageQueue(NULL);
hwndTo = NtUserGetAncestor(hwndTo, GA_ROOT);
if (WinPosCanActivateWindow(hwndTo))
goto done;
}
for (hwndTo = NtUserGetWindow(Window->Self, GW_HWNDNEXT);
hwndTo != NULL;
hwndTo = NtUserGetWindow(hwndTo, GW_HWNDNEXT))
{
if (WinPosCanActivateWindow(hwndTo)) break;
}
done:
fg = NtUserGetForegroundWindow();
if (!fg || (Window->Self == fg))
{
wndTo = IntGetWindowObject(hwndTo);
if (wndTo != NULL && IntSetForegroundWindow(wndTo))
{
IntReleaseWindowObject(wndTo);
return;
}
Wnd = Window;
for(;;)
{
HWND *List, *phWnd;
Old = Wnd;
Wnd = IntGetParentObject(Wnd);
if(Old != Window)
{
IntReleaseWindowObject(Old);
IntReleaseWindowObject(wndTo);
}
if(!Wnd)
{
IntSetFocusMessageQueue(NULL);
return;
}
if((List = IntWinListChildren(Wnd)))
{
for(TryTopmost = 0; TryTopmost <= 1; TryTopmost++)
{
for(phWnd = List; *phWnd; phWnd++)
{
PWINDOW_OBJECT Child;
if((*phWnd) == Window->Self)
{
continue;
}
if((Child = IntGetWindowObject(*phWnd)))
{
if(((! TryTopmost && (0 == (Child->ExStyle & WS_EX_TOPMOST)))
|| (TryTopmost && (0 != (Child->ExStyle & WS_EX_TOPMOST))))
&& IntSetForegroundWindow(Child))
{
ExFreePool(List);
IntReleaseWindowObject(Wnd);
IntReleaseWindowObject(Child);
return;
}
IntReleaseWindowObject(Child);
}
}
}
ExFreePool(List);
}
}
IntReleaseWindowObject(Wnd);
if (!NtUserSetActiveWindow(hwndTo))
NtUserSetActiveWindow(0);
}
VOID STATIC FASTCALL

View file

@ -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.78 2004/07/07 16:36:08 navaraf Exp $ */
/* $Id: bitmaps.c,v 1.79 2004/07/14 20:48:57 navaraf Exp $ */
#include <w32k.h>
#define IN_RECT(r,x,y) \
@ -45,14 +45,12 @@ NtGdiBitBlt(
RECTL DestRect;
POINTL SourcePoint, BrushOrigin;
BOOL Status;
PPALGDI PalDestGDI, PalSourceGDI;
XLATEOBJ *XlateObj = NULL;
HPALETTE SourcePalette = 0, DestPalette = 0;
ULONG SourceMode, DestMode;
PGDIBRUSHOBJ BrushObj;
BOOL UsesSource = ((ROP & 0xCC0000) >> 2) != (ROP & 0x330000);
BOOL UsesPattern = TRUE;//((ROP & 0xF00000) >> 4) != (ROP & 0x0F0000);
HPALETTE Mono = NULL;
GDIBRUSHINST BrushInst;
BOOL UsesSource = ROP_USES_SOURCE(ROP);
BOOL UsesPattern = ROP_USES_PATTERN(ROP);
DCDest = DC_LockDc(hDCDest);
if (NULL == DCDest)
@ -133,6 +131,7 @@ NtGdiBitBlt(
return FALSE;
}
BrushOrigin = BrushObj->ptOrigin;
IntGdiInitBrushInstance(&BrushInst, BrushObj, DCDest->XlateBrush);
}
else
{
@ -148,73 +147,27 @@ NtGdiBitBlt(
if (DCSrc->w.hPalette != 0)
SourcePalette = DCSrc->w.hPalette;
PalSourceGDI = PALETTE_LockPalette(SourcePalette);
if (NULL == PalSourceGDI)
{
if (UsesSource && hDCSrc != hDCDest)
{
DC_UnlockDc(hDCSrc);
}
DC_UnlockDc(hDCDest);
SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE;
}
SourceMode = PalSourceGDI->Mode;
PALETTE_UnlockPalette(SourcePalette);
if (DestPalette == SourcePalette)
{
DestMode = SourceMode;
}
else
{
PalDestGDI = PALETTE_LockPalette(DestPalette);
if (NULL == PalDestGDI)
{
if (UsesSource && hDCSrc != hDCDest)
{
DC_UnlockDc(hDCSrc);
}
DC_UnlockDc(hDCDest);
SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE;
}
DestMode = PalDestGDI->Mode;
PALETTE_UnlockPalette(DestPalette);
}
/* KB41464 details how to convert between mono and color */
if (DCDest->w.bitsPerPixel == 1)
{
XlateObj = (XLATEOBJ*)IntEngCreateMonoXlate(SourceMode, DestPalette,
SourcePalette, DCSrc->w.backgroundColor);
}
else if (DCSrc->w.bitsPerPixel == 1)
{
ULONG Colors[2];
Colors[0] = DCSrc->w.textColor;
Colors[1] = DCSrc->w.backgroundColor;
Mono = PALETTE_AllocPaletteIndexedRGB(2, (RGBQUAD*)Colors);
if (NULL != Mono)
{
XlateObj = (XLATEOBJ*)IntEngCreateXlate(DestMode, PAL_INDEXED, DestPalette, Mono);
}
else
if (DCDest->w.bitsPerPixel == DCSrc->w.bitsPerPixel == 1)
{
XlateObj = NULL;
}
else
{
if (DCDest->w.bitsPerPixel == 1)
{
XlateObj = IntEngCreateMonoXlate(0, DestPalette, SourcePalette, DCSrc->w.backgroundColor);
}
else if (DCSrc->w.bitsPerPixel == 1)
{
XlateObj = IntEngCreateSrcMonoXlate(DestPalette, DCSrc->w.backgroundColor, DCSrc->w.textColor);
}
else
{
XlateObj = (XLATEOBJ*)IntEngCreateXlate(DestMode, SourceMode, DestPalette, SourcePalette);
XlateObj = IntEngCreateXlate(0, 0, DestPalette, SourcePalette);
}
if (NULL == XlateObj)
{
if (NULL != Mono)
{
EngDeletePalette(Mono);
}
if (UsesSource && hDCSrc != hDCDest)
{
DC_UnlockDc(hDCSrc);
@ -224,22 +177,19 @@ NtGdiBitBlt(
return FALSE;
}
}
}
/* Perform the bitblt operation */
Status = IntEngBitBlt(BitmapDest, BitmapSrc, NULL, DCDest->CombinedClip, XlateObj,
&DestRect, &SourcePoint, NULL, &BrushObj->BrushObject, &BrushOrigin, ROP);
&DestRect, &SourcePoint, NULL, BrushObj ? &BrushInst.BrushObject : NULL, &BrushOrigin, ROP);
if (UsesSource)
if (UsesSource && XlateObj != NULL)
EngDeleteXlate(XlateObj);
BITMAPOBJ_UnlockBitmap(DCDest->w.hBitmap);
if (UsesSource && DCSrc->w.hBitmap != DCDest->w.hBitmap)
{
BITMAPOBJ_UnlockBitmap(DCSrc->w.hBitmap);
}
if (NULL != Mono)
{
EngDeletePalette(Mono);
}
if (UsesPattern)
{
BRUSHOBJ_UnlockBrush(DCDest->w.hBrush);
@ -547,6 +497,7 @@ NtGdiExtFloodFill(
UINT FillType)
{
UNIMPLEMENTED;
return FALSE;
}
BOOL STDCALL
@ -588,8 +539,6 @@ NtGdiGetPixel(HDC hDC, INT XPos, INT YPos)
BITMAPOBJ *BitmapObject;
SURFOBJ *SurfaceObject;
HPALETTE Pal = 0;
PPALGDI PalGDI;
USHORT PalMode;
XLATEOBJ *XlateObj;
dc = DC_LockDc (hDC);
@ -608,14 +557,8 @@ NtGdiGetPixel(HDC hDC, INT XPos, INT YPos)
{
if ( dc->w.hPalette != 0 )
Pal = dc->w.hPalette;
PalGDI = PALETTE_LockPalette(Pal);
if ( PalGDI )
{
PalMode = PalGDI->Mode;
PALETTE_UnlockPalette(Pal);
/* FIXME: Verify if it shouldn't be PAL_BGR! */
XlateObj = (XLATEOBJ*)IntEngCreateXlate ( PAL_RGB, PalMode, NULL, Pal );
XlateObj = (XLATEOBJ*)IntEngCreateXlate ( PAL_RGB, 0, NULL, Pal );
if ( XlateObj )
{
// check if this DC has a DIB behind it...
@ -628,7 +571,6 @@ NtGdiGetPixel(HDC hDC, INT XPos, INT YPos)
EngDeleteXlate(XlateObj);
}
}
}
BITMAPOBJ_UnlockBitmap(dc->w.hBitmap);
}
DC_UnlockDc(hDC);
@ -897,6 +839,7 @@ NtGdiPlgBlt(
INT yMask)
{
UNIMPLEMENTED;
return FALSE;
}
LONG STDCALL
@ -1049,10 +992,8 @@ NtGdiStretchBlt(
RECTL DestRect;
RECTL SourceRect;
BOOL Status;
PPALGDI PalDestGDI, PalSourceGDI;
XLATEOBJ *XlateObj = NULL;
HPALETTE SourcePalette = 0, DestPalette = 0;
ULONG SourceMode, DestMode;
PGDIBRUSHOBJ BrushObj;
BOOL UsesSource = ((ROP & 0xCC0000) >> 2) != (ROP & 0x330000);
BOOL UsesPattern = ((ROP & 0xF00000) >> 4) != (ROP & 0x0F0000);
@ -1154,43 +1095,8 @@ NtGdiStretchBlt(
if (DCSrc->w.hPalette != 0)
SourcePalette = DCSrc->w.hPalette;
PalSourceGDI = PALETTE_LockPalette(SourcePalette);
if (NULL == PalSourceGDI)
{
if (UsesSource && hDCSrc != hDCDest)
{
DC_UnlockDc(hDCSrc);
}
DC_UnlockDc(hDCDest);
SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE;
}
SourceMode = PalSourceGDI->Mode;
PALETTE_UnlockPalette(SourcePalette);
if (DestPalette == SourcePalette)
{
DestMode = SourceMode;
}
else
{
PalDestGDI = PALETTE_LockPalette(DestPalette);
if (NULL == PalDestGDI)
{
if (UsesSource && hDCSrc != hDCDest)
{
DC_UnlockDc(hDCSrc);
}
DC_UnlockDc(hDCDest);
SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE;
}
DestMode = PalDestGDI->Mode;
PALETTE_UnlockPalette(DestPalette);
}
/* FIXME: Use the same logic for create XLATEOBJ as in NtGdiBitBlt. */
XlateObj = (XLATEOBJ*)IntEngCreateXlate(DestMode, SourceMode, DestPalette, SourcePalette);
XlateObj = (XLATEOBJ*)IntEngCreateXlate(0, 0, DestPalette, SourcePalette);
if (NULL == XlateObj)
{
if (UsesSource && hDCSrc != hDCDest)

View file

@ -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.39 2004/07/03 17:40:27 navaraf Exp $
* $Id: brush.c,v 1.40 2004/07/14 20:48:57 navaraf Exp $
*/
#include <w32k.h>
@ -45,6 +45,56 @@ Brush_InternalDelete( PGDIBRUSHOBJ pBrush )
return TRUE;
}
XLATEOBJ* FASTCALL
IntGdiCreateBrushXlate(PDC Dc, GDIBRUSHOBJ *BrushObj, BOOLEAN *Failed)
{
XLATEOBJ *Result = NULL;
if (BrushObj->flAttrs & GDIBRUSH_IS_NULL)
{
Result = NULL;
*Failed = FALSE;
}
else if (BrushObj->flAttrs & GDIBRUSH_IS_SOLID)
{
Result = IntEngCreateXlate(0, PAL_RGB, Dc->w.hPalette, NULL);
*Failed = FALSE;
}
else
{
BITMAPOBJ *Pattern = BITMAPOBJ_LockBitmap(BrushObj->hbmPattern);
if (Pattern == NULL)
return NULL;
/* Special case: 1bpp pattern */
if (Pattern->SurfObj.iBitmapFormat == BMF_1BPP)
{
if (Dc->w.bitsPerPixel != 1)
Result = IntEngCreateSrcMonoXlate(Dc->w.hPalette, Dc->w.textColor, Dc->w.backgroundColor);
}
BITMAPOBJ_UnlockBitmap(BrushObj->hbmPattern);
*Failed = FALSE;
}
return Result;
}
VOID FASTCALL
IntGdiInitBrushInstance(GDIBRUSHINST *BrushInst, PGDIBRUSHOBJ BrushObj, XLATEOBJ *XlateObj)
{
if (BrushObj->flAttrs & GDIBRUSH_IS_NULL)
BrushInst->BrushObject.iSolidColor = 0;
else if (BrushObj->flAttrs & GDIBRUSH_IS_SOLID)
BrushInst->BrushObject.iSolidColor = XLATEOBJ_iXlate(XlateObj, BrushObj->BrushAttr.lbColor);
else
BrushInst->BrushObject.iSolidColor = 0xFFFFFFFF;
BrushInst->BrushObject.pvRbrush = BrushObj->ulRealization;
BrushInst->BrushObject.flColorType = 0;
BrushInst->GdiBrushObject = BrushObj;
BrushInst->XlateObject = XlateObj;
}
HBRUSH FASTCALL
IntGdiCreateBrushIndirect(PLOGBRUSH LogBrush)
{
@ -55,7 +105,8 @@ IntGdiCreateBrushIndirect(PLOGBRUSH LogBrush)
switch (LogBrush->lbStyle)
{
case BS_HATCHED:
if(!(hPattern = NtGdiCreateBitmap(8, 8, 1, 1, HatchBrushes[LogBrush->lbHatch])))
hPattern = NtGdiCreateBitmap(8, 8, 1, 1, HatchBrushes[LogBrush->lbHatch]);
if (hPattern == NULL)
{
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
return NULL;
@ -63,7 +114,8 @@ IntGdiCreateBrushIndirect(PLOGBRUSH LogBrush)
break;
case BS_PATTERN:
if(!(hPattern = BITMAPOBJ_CopyBitmap((HBITMAP)LogBrush->lbHatch)))
hPattern = BITMAPOBJ_CopyBitmap((HBITMAP)LogBrush->lbHatch);
if (hPattern == NULL)
{
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
return NULL;
@ -89,7 +141,6 @@ IntGdiCreateBrushIndirect(PLOGBRUSH LogBrush)
case BS_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;
@ -97,13 +148,11 @@ IntGdiCreateBrushIndirect(PLOGBRUSH LogBrush)
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 = hPattern;
BrushObject->BrushObject.iSolidColor = 0xFFFFFFFF;
/* FIXME: Fill in the rest of fields!!! */
break;
@ -128,6 +177,7 @@ IntPatBlt(
{
RECTL DestRect;
BITMAPOBJ *BitmapObj;
GDIBRUSHINST BrushInst;
POINTL BrushOrigin;
BOOL ret = TRUE;
@ -166,6 +216,8 @@ IntPatBlt(
BrushOrigin.x = BrushObj->ptOrigin.x + dc->w.DCOrgX;
BrushOrigin.y = BrushObj->ptOrigin.y + dc->w.DCOrgY;
IntGdiInitBrushInstance(&BrushInst, BrushObj, dc->XlateBrush);
ret = IntEngBitBlt(
BitmapObj,
NULL,
@ -175,7 +227,7 @@ IntPatBlt(
&DestRect,
NULL,
NULL,
&BrushObj->BrushObject,
&BrushInst.BrushObject,
&BrushOrigin,
ROP);
}

View file

@ -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: cliprgn.c,v 1.41 2004/07/07 16:34:33 navaraf Exp $ */
/* $Id: cliprgn.c,v 1.42 2004/07/14 20:48:58 navaraf Exp $ */
#include <w32k.h>
int FASTCALL
@ -220,6 +220,7 @@ int STDCALL NtGdiGetMetaRgn(HDC hDC,
HRGN hrgn)
{
UNIMPLEMENTED;
return 0;
}
int STDCALL NtGdiExcludeClipRect(HDC hDC,
@ -328,6 +329,7 @@ int STDCALL NtGdiOffsetClipRgn(HDC hDC,
int YOffset)
{
UNIMPLEMENTED;
return 0;
}
BOOL STDCALL NtGdiPtVisible(HDC hDC,
@ -389,6 +391,7 @@ BOOL STDCALL NtGdiSelectClipPath(HDC hDC,
int Mode)
{
UNIMPLEMENTED;
return FALSE;
}
INT STDCALL
@ -400,6 +403,7 @@ NtGdiSelectClipRgn(HDC hDC, HRGN hRgn)
int STDCALL NtGdiSetMetaRgn(HDC hDC)
{
UNIMPLEMENTED;
return 0;
}
/* EOF */

View file

@ -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: color.c,v 1.49 2004/07/04 17:09:45 navaraf Exp $ */
/* $Id: color.c,v 1.50 2004/07/14 20:48:58 navaraf Exp $ */
#include <w32k.h>
// FIXME: Use PXLATEOBJ logicalToSystem instead of int *mapping
@ -136,6 +136,7 @@ BOOL STDCALL NtGdiGetColorAdjustment(HDC hDC,
LPCOLORADJUSTMENT ca)
{
UNIMPLEMENTED;
return FALSE;
}
unsigned short GetNumberOfBits(unsigned int dwMask)
@ -422,6 +423,7 @@ BOOL STDCALL NtGdiResizePalette(HPALETTE hpal,
return TRUE; */
UNIMPLEMENTED;
return FALSE;
}
/*!
@ -479,6 +481,7 @@ BOOL STDCALL NtGdiSetColorAdjustment(HDC hDC,
CONST LPCOLORADJUSTMENT ca)
{
UNIMPLEMENTED;
return FALSE;
}
UINT STDCALL NtGdiSetPaletteEntries(HPALETTE hpal,
@ -515,12 +518,14 @@ UINT STDCALL
NtGdiSetSystemPaletteUse(HDC hDC, UINT Usage)
{
UNIMPLEMENTED;
return 0;
}
BOOL STDCALL
NtGdiUnrealizeObject(HGDIOBJ hgdiobj)
{
UNIMPLEMENTED;
return FALSE;
}
BOOL STDCALL

View file

@ -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: coord.c,v 1.25 2004/06/18 15:18:54 navaraf Exp $
/* $Id: coord.c,v 1.26 2004/07/14 20:48:58 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -482,6 +482,7 @@ NtGdiScaleViewportExtEx(HDC hDC,
LPSIZE Size)
{
UNIMPLEMENTED;
return FALSE;
}
BOOL
@ -494,6 +495,7 @@ NtGdiScaleWindowExtEx(HDC hDC,
LPSIZE Size)
{
UNIMPLEMENTED;
return FALSE;
}
int

View file

@ -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.143 2004/07/03 17:40:27 navaraf Exp $
/* $Id: dc.c,v 1.144 2004/07/14 20:48:58 navaraf Exp $
*
* DC.C - Device context functions
*
@ -120,6 +120,7 @@ BOOL STDCALL
NtGdiCancelDC(HDC hDC)
{
UNIMPLEMENTED;
return FALSE;
}
HDC STDCALL
@ -869,6 +870,10 @@ NtGdiDeleteDC(HDC DCHandle)
{
NtGdiDeleteObject (DCToDelete->w.hFirstBitmap);
}
if (DCToDelete->XlateBrush != NULL)
EngDeleteXlate(DCToDelete->XlateBrush);
if (DCToDelete->XlatePen != NULL)
EngDeleteXlate(DCToDelete->XlatePen);
}
if (DCToDelete->w.hClipRgn)
{
@ -902,6 +907,7 @@ NtGdiDrawEscape(HDC hDC,
LPCSTR lpszInData)
{
UNIMPLEMENTED;
return 0;
}
INT STDCALL
@ -911,6 +917,7 @@ NtGdiEnumObjects(HDC hDC,
LPARAM lParam)
{
UNIMPLEMENTED;
return 0;
}
DC_GET_VAL( COLORREF, NtGdiGetBkColor, w.backgroundColor )
@ -1613,6 +1620,7 @@ HDC STDCALL
NtGdiResetDC(HDC hDC, CONST DEVMODEW *InitData)
{
UNIMPLEMENTED;
return 0;
}
BOOL STDCALL
@ -1741,12 +1749,10 @@ NtGdiSelectObject(HDC hDC, HGDIOBJ hGDIObj)
PGDIBRUSHOBJ pen;
PGDIBRUSHOBJ brush;
XLATEOBJ *XlateObj;
PPALGDI PalGDI;
DWORD objectType;
COLORREF MonoColorMap[2];
ULONG NumColors = 0;
HRGN hVisRgn;
USHORT Mode;
BOOLEAN Failed;
if(!hDC || !hGDIObj) return NULL;
@ -1762,101 +1768,49 @@ NtGdiSelectObject(HDC hDC, HGDIOBJ hGDIObj)
switch (objectType)
{
case GDI_OBJECT_TYPE_PEN:
objOrg = NULL;
/* Convert the color of the pen to the format of the DC */
PalGDI = PALETTE_LockPalette(dc->w.hPalette);
if (NULL != PalGDI)
{
Mode = PalGDI->Mode;
PALETTE_UnlockPalette(dc->w.hPalette);
XlateObj = (XLATEOBJ*)IntEngCreateXlate(Mode, PAL_RGB, dc->w.hPalette, NULL);
if (NULL != XlateObj)
{
pen = PENOBJ_LockPen((HPEN) hGDIObj);
if (NULL != pen)
{
if (pen->flAttrs & GDIBRUSH_IS_SOLID)
{
pen->BrushObject.iSolidColor =
XLATEOBJ_iXlate(XlateObj, pen->BrushAttr.lbColor);
}
else
{
pen->BrushObject.iSolidColor = 0xFFFFFFFF;
}
pen->crBack = XLATEOBJ_iXlate(XlateObj, dc->w.backgroundColor);
pen->crFore = XLATEOBJ_iXlate(XlateObj, dc->w.textColor);
PENOBJ_UnlockPen((HPEN) hGDIObj);
objOrg = (HGDIOBJ)dc->w.hPen;
dc->w.hPen = hGDIObj;
}
else
if (pen == NULL)
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
break;
}
EngDeleteXlate(XlateObj);
}
else
XlateObj = IntGdiCreateBrushXlate(dc, pen, &Failed);
PENOBJ_UnlockPen((HPEN) hGDIObj);
if (Failed)
{
SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES);
break;
}
}
else
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
}
objOrg = (HGDIOBJ)dc->w.hPen;
dc->w.hPen = hGDIObj;
if (dc->XlatePen != NULL)
EngDeleteXlate(dc->XlatePen);
dc->XlatePen = XlateObj;
break;
case GDI_OBJECT_TYPE_BRUSH:
objOrg = NULL;
/* Convert the color of the brush to the format of the DC */
PalGDI = PALETTE_LockPalette(dc->w.hPalette);
if (NULL != PalGDI)
{
Mode = PalGDI->Mode;
PALETTE_UnlockPalette(dc->w.hPalette);
XlateObj = (XLATEOBJ*)IntEngCreateXlate(Mode, PAL_RGB, dc->w.hPalette, NULL);
if (NULL != XlateObj)
{
brush = BRUSHOBJ_LockBrush((HBRUSH) hGDIObj);
if (NULL != brush)
{
if (brush->flAttrs & GDIBRUSH_IS_SOLID)
{
brush->BrushObject.iSolidColor =
XLATEOBJ_iXlate(XlateObj, brush->BrushAttr.lbColor);
}
else
{
brush->BrushObject.iSolidColor = 0xFFFFFFFF;
}
brush->crBack = XLATEOBJ_iXlate(XlateObj, dc->w.backgroundColor);
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;
}
else
brush = BRUSHOBJ_LockBrush((HPEN) hGDIObj);
if (brush == NULL)
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
break;
}
EngDeleteXlate(XlateObj);
}
else
XlateObj = IntGdiCreateBrushXlate(dc, brush, &Failed);
BRUSHOBJ_UnlockBrush((HPEN) hGDIObj);
if (Failed)
{
SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES);
break;
}
}
else
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
}
objOrg = (HGDIOBJ)dc->w.hBrush;
dc->w.hBrush = hGDIObj;
if (dc->XlateBrush != NULL)
EngDeleteXlate(dc->XlateBrush);
dc->XlateBrush = XlateObj;
break;
case GDI_OBJECT_TYPE_FONT:
@ -1907,17 +1861,12 @@ NtGdiSelectObject(HDC hDC, HGDIOBJ hGDIObj)
else
{
dc->w.bitsPerPixel = BitsPerFormat(pb->SurfObj.iBitmapFormat);
if (1 == dc->w.bitsPerPixel)
{
MonoColorMap[0] = RGB(0, 0, 0);
MonoColorMap[1] = RGB(255, 255, 255);
dc->w.hPalette = PALETTE_AllocPaletteIndexedRGB(2, (RGBQUAD*)MonoColorMap);
}
else
{
dc->w.hPalette = dc->DevInfo->hpalDefault;
}
}
/* Reselect brush and pen to regenerate the XLATEOBJs. */
NtGdiSelectObject ( hDC, dc->w.hBrush );
NtGdiSelectObject ( hDC, dc->w.hPen );
DC_UnlockDc ( hDC );
hVisRgn = NtGdiCreateRectRgn ( 0, 0, pb->SurfObj.sizlBitmap.cx, pb->SurfObj.sizlBitmap.cy );
@ -2034,6 +1983,8 @@ DC_AllocDC(PUNICODE_STRING Driver)
NewDC->wndExtY = 1.0f;
NewDC->vportExtX = 1.0f;
NewDC->vportExtY = 1.0f;
NewDC->w.textColor = 0;
NewDC->w.backgroundColor = 0xffffff;
NewDC->w.hFont = NtGdiGetStockObject(SYSTEM_FONT);
TextIntRealizeFont(NewDC->w.hFont);
@ -2183,89 +2134,20 @@ IntIsPrimarySurface(SURFOBJ *SurfObj)
COLORREF FASTCALL
IntGetDCColor(HDC hDC, ULONG Object)
{
COLORREF Result;
DC *dc;
PPALGDI PalGDI;
PGDIBRUSHOBJ pen;
PGDIBRUSHOBJ brush;
XLATEOBJ *XlateObj;
HPALETTE Pal = 0;
USHORT Mode;
ULONG iColor;
/*
* The previous implementation was completly incorrect. It modified the
* brush that was currently selected into the device context, but in fact
* the DC pen/brush color should be stored directly in the device context
* (at address 0x2C of the user mode DC object memory on Windows 2K/XP).
* The actual color is then used when DC_BRUSH/DC_PEN object is selected
* into the device context and BRUSHOBJ for drawing is composed (belongs
* to IntGdiInitBrushInstance in the current ReactOS implementation). Also
* the implementation should be moved to user mode GDI32.dll when UM
* mapped GDI objects will be implemented.
*/
if(!(dc = DC_LockDc(hDC)))
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
return CLR_INVALID;
}
switch(Object)
{
case OBJ_PEN:
{
if(!(pen = PENOBJ_LockPen(dc->w.hPen)))
{
DC_UnlockDc(hDC);
return CLR_INVALID;
}
if(!(pen->flAttrs & GDIBRUSH_IS_SOLID))
{
/* FIXME - just bail here? */
PENOBJ_UnlockPen(dc->w.hPen);
DC_UnlockDc(hDC);
return CLR_INVALID;
}
iColor = pen->BrushObject.iSolidColor;
PENOBJ_UnlockPen(dc->w.hPen);
break;
}
case OBJ_BRUSH:
{
if(!(brush = BRUSHOBJ_LockBrush(dc->w.hBrush)))
{
DC_UnlockDc(hDC);
return CLR_INVALID;
}
if(!(brush->flAttrs & GDIBRUSH_IS_SOLID))
{
/* FIXME - just bail here? */
BRUSHOBJ_UnlockBrush(dc->w.hBrush);
DC_UnlockDc(hDC);
return CLR_INVALID;
}
iColor = brush->BrushObject.iSolidColor;
BRUSHOBJ_UnlockBrush(dc->w.hBrush);
break;
}
default:
{
DC_UnlockDc(hDC);
SetLastWin32Error(ERROR_INVALID_PARAMETER);
return CLR_INVALID;
}
}
/* translate the color into RGB */
if(dc->w.hPalette)
Pal = dc->w.hPalette;
Result = CLR_INVALID;
if((PalGDI = PALETTE_LockPalette(dc->w.hPalette)))
{
Mode = PalGDI->Mode;
PALETTE_UnlockPalette(dc->w.hPalette);
XlateObj = (XLATEOBJ*)IntEngCreateXlate(PAL_RGB, Mode, NULL, Pal);
if(XlateObj)
{
Result = XLATEOBJ_iXlate(XlateObj, iColor);
EngDeleteXlate(XlateObj);
}
}
DC_UnlockDc(hDC);
return Result;
DPRINT("WIN32K:IntGetDCColor is unimplemented\n");
return 0xFFFFFF; /* The default DC color. */
}
/*
@ -2275,133 +2157,10 @@ IntGetDCColor(HDC hDC, ULONG Object)
COLORREF FASTCALL
IntSetDCColor(HDC hDC, ULONG Object, COLORREF Color)
{
COLORREF Result;
DC *dc;
PPALGDI PalGDI;
PGDIBRUSHOBJ pen;
PGDIBRUSHOBJ brush;
XLATEOBJ *XlateObj;
HPALETTE Pal = 0;
USHORT Mode;
ULONG iColor;
/* See the comment in IntGetDCColor. */
if(Color == CLR_INVALID)
{
SetLastWin32Error(ERROR_INVALID_PARAMETER);
DPRINT("WIN32K:IntSetDCColor is unimplemented\n");
return CLR_INVALID;
}
if(!(dc = DC_LockDc(hDC)))
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
return CLR_INVALID;
}
switch(Object)
{
case OBJ_PEN:
{
if(!(pen = PENOBJ_LockPen(dc->w.hPen)))
{
DC_UnlockDc(hDC);
return CLR_INVALID;
}
if(!(pen->flAttrs & GDIBRUSH_IS_SOLID))
{
/* FIXME - just bail here? */
PENOBJ_UnlockPen(dc->w.hPen);
DC_UnlockDc(hDC);
return CLR_INVALID;
}
/* save old color index, translate it to RGB later */
iColor = pen->BrushObject.iSolidColor;
if(!(PalGDI = PALETTE_LockPalette(dc->w.hPalette)))
{
PENOBJ_UnlockPen(dc->w.hPen);
DC_UnlockDc(hDC);
return CLR_INVALID;
}
Mode = PalGDI->Mode;
PALETTE_UnlockPalette(dc->w.hPalette);
if(!(XlateObj = (XLATEOBJ*)IntEngCreateXlate(Mode, PAL_RGB, dc->w.hPalette, NULL)))
{
PENOBJ_UnlockPen(dc->w.hPen);
DC_UnlockDc(hDC);
return CLR_INVALID;
}
pen->BrushObject.iSolidColor = XLATEOBJ_iXlate(XlateObj, (ULONG)Color);
EngDeleteXlate(XlateObj);
PENOBJ_UnlockPen(dc->w.hPen);
break;
}
case OBJ_BRUSH:
{
if(!(brush = BRUSHOBJ_LockBrush(dc->w.hBrush)))
{
DC_UnlockDc(hDC);
return CLR_INVALID;
}
if(!(brush->flAttrs & GDIBRUSH_IS_SOLID))
{
/* FIXME - just bail here? */
BRUSHOBJ_UnlockBrush(dc->w.hBrush);
DC_UnlockDc(hDC);
return CLR_INVALID;
}
/* save old color index, translate it to RGB later */
iColor = brush->BrushObject.iSolidColor;
if(!(PalGDI = PALETTE_LockPalette(dc->w.hPalette)))
{
PENOBJ_UnlockPen(dc->w.hPen);
DC_UnlockDc(hDC);
return CLR_INVALID;
}
Mode = PalGDI->Mode;
PALETTE_UnlockPalette(dc->w.hPalette);
if(!(XlateObj = (XLATEOBJ*)IntEngCreateXlate(Mode, PAL_RGB, dc->w.hPalette, NULL)))
{
PENOBJ_UnlockPen(dc->w.hPen);
DC_UnlockDc(hDC);
return CLR_INVALID;
}
brush->BrushObject.iSolidColor = XLATEOBJ_iXlate(XlateObj, (ULONG)Color);
EngDeleteXlate(XlateObj);
BRUSHOBJ_UnlockBrush(dc->w.hBrush);
break;
}
default:
{
DC_UnlockDc(hDC);
SetLastWin32Error(ERROR_INVALID_PARAMETER);
return CLR_INVALID;
}
}
/* translate the old color into RGB */
if(dc->w.hPalette)
Pal = dc->w.hPalette;
Result = CLR_INVALID;
if((PalGDI = PALETTE_LockPalette(dc->w.hPalette)))
{
Mode = PalGDI->Mode;
PALETTE_UnlockPalette(dc->w.hPalette);
XlateObj = (XLATEOBJ*)IntEngCreateXlate(PAL_RGB, Mode, NULL, Pal);
if(XlateObj)
{
Result = XLATEOBJ_iXlate(XlateObj, iColor);
EngDeleteXlate(XlateObj);
}
}
DC_UnlockDc(hDC);
return Result;
}
/* EOF */

View file

@ -16,24 +16,24 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: fillshap.c,v 1.51 2004/07/03 13:55:36 navaraf Exp $ */
/* $Id: fillshap.c,v 1.52 2004/07/14 20:48:58 navaraf Exp $ */
#include <w32k.h>
/*
* a couple macros to fill a single pixel or a line
*/
#define PUTPIXEL(x,y,brushObj) \
#define PUTPIXEL(x,y,BrushInst) \
ret = ret && IntEngLineTo(BitmapObj, \
dc->CombinedClip, \
&brushObj->BrushObject, \
&BrushInst.BrushObject, \
x, y, (x)+1, y, \
&RectBounds, \
dc->w.ROPmode);
#define PUTLINE(x1,y1,x2,y2,brushObj) \
#define PUTLINE(x1,y1,x2,y2,BrushInst) \
ret = ret && IntEngLineTo(BitmapObj, \
dc->CombinedClip, \
&brushObj->BrushObject, \
&BrushInst.BrushObject, \
x1, y1, x2, y2, \
&RectBounds, \
dc->w.ROPmode);
@ -45,6 +45,7 @@ IntGdiPolygon(PDC dc,
{
BITMAPOBJ *BitmapObj;
PGDIBRUSHOBJ PenBrushObj, FillBrushObj;
GDIBRUSHINST PenBrushInst, FillBrushInst;
BOOL ret = FALSE; // default to failure
RECTL DestRect;
int CurrentPoint;
@ -88,11 +89,15 @@ IntGdiPolygon(PDC dc,
FillBrushObj = BRUSHOBJ_LockBrush(dc->w.hBrush);
ASSERT(FillBrushObj);
if (!(FillBrushObj->flAttrs & GDIBRUSH_IS_NULL))
ret = FillPolygon ( dc, BitmapObj, &FillBrushObj->BrushObject, dc->w.ROPmode, UnsafePoints, Count, DestRect );
{
IntGdiInitBrushInstance(&FillBrushInst, FillBrushObj, dc->XlateBrush);
ret = FillPolygon ( dc, BitmapObj, &FillBrushInst.BrushObject, dc->w.ROPmode, UnsafePoints, Count, DestRect );
}
BRUSHOBJ_UnlockBrush(dc->w.hBrush);
/* get BRUSHOBJ from current pen. */
PenBrushObj = PENOBJ_LockPen(dc->w.hPen);
IntGdiInitBrushInstance(&PenBrushInst, PenBrushObj, dc->XlatePen);
// Draw the Polygon Edges with the current pen ( if not a NULL pen )
if (!(PenBrushObj->flAttrs & GDIBRUSH_IS_NULL))
@ -114,7 +119,7 @@ IntGdiPolygon(PDC dc,
//DPRINT("Polygon Making line from (%d,%d) to (%d,%d)\n", From.x, From.y, To.x, To.y );
ret = IntEngLineTo(BitmapObj,
dc->CombinedClip,
&PenBrushObj->BrushObject,
&PenBrushInst.BrushObject,
From.x,
From.y,
To.x,
@ -173,6 +178,7 @@ NtGdiChord(HDC hDC,
int YRadial2)
{
UNIMPLEMENTED;
return FALSE;
}
/*
@ -206,6 +212,7 @@ NtGdiEllipse(
int RadiusX, RadiusY;
int Temp;
PGDIBRUSHOBJ FillBrush, PenBrush;
GDIBRUSHINST FillBrushInst, PenBrushInst;
BITMAPOBJ *BitmapObj;
RECTL RectBounds;
PDC dc;
@ -252,6 +259,9 @@ NtGdiEllipse(
BitmapObj = BITMAPOBJ_LockBitmap(dc->w.hBitmap);
ASSERT(BitmapObj);
IntGdiInitBrushInstance(&FillBrushInst, FillBrush, dc->XlateBrush);
IntGdiInitBrushInstance(&PenBrushInst, PenBrush, dc->XlatePen);
nLeftRect += dc->w.DCOrgX;
nRightRect += dc->w.DCOrgX - 1;
nTopRect += dc->w.DCOrgY;
@ -319,10 +329,10 @@ NtGdiEllipse(
if ((A > da) && (A < db))
{
PUTLINE(CenterX - D, CenterY + A, CenterX + D, CenterY + A, FillBrush);
PUTLINE(CenterX - D, CenterY + A, CenterX + D, CenterY + A, FillBrushInst);
if (A)
{
PUTLINE(CenterX - D, CenterY - A, CenterX + D, CenterY - A, FillBrush);
PUTLINE(CenterX - D, CenterY - A, CenterX + D, CenterY - A, FillBrushInst);
}
da = A;
}
@ -333,8 +343,8 @@ NtGdiEllipse(
if ((B < db) && (B > da))
{
PUTLINE(CenterX - C, CenterY + B, CenterX + C, CenterY + B, FillBrush);
PUTLINE(CenterX - C, CenterY - B, CenterX + C, CenterY - B, FillBrush);
PUTLINE(CenterX - C, CenterY + B, CenterX + C, CenterY + B, FillBrushInst);
PUTLINE(CenterX - C, CenterY - B, CenterX + C, CenterY - B, FillBrushInst);
db = B;
}
@ -344,27 +354,27 @@ NtGdiEllipse(
if (Cond1)
{
PUTPIXEL(CenterX + C, CenterY + B, PenBrush);
PUTPIXEL(CenterX + C, CenterY + B, PenBrushInst);
if (C)
PUTPIXEL(CenterX - C, CenterY + B, PenBrush);
PUTPIXEL(CenterX - C, CenterY + B, PenBrushInst);
if (B)
{
PUTPIXEL(CenterX + C, CenterY - B, PenBrush);
PUTPIXEL(CenterX + C, CenterY - B, PenBrushInst);
if (C)
PUTPIXEL(CenterX - C, CenterY - B, PenBrush);
PUTPIXEL(CenterX - C, CenterY - B, PenBrushInst);
}
}
if (Cond2)
{
PUTPIXEL(CenterX + D, CenterY + A, PenBrush);
PUTPIXEL(CenterX + D, CenterY + A, PenBrushInst);
if (D)
PUTPIXEL(CenterX - D, CenterY + A, PenBrush);
PUTPIXEL(CenterX - D, CenterY + A, PenBrushInst);
if (A)
{
PUTPIXEL(CenterX + D, CenterY - A, PenBrush);
PUTPIXEL(CenterX + D, CenterY - A, PenBrushInst);
if (D)
PUTPIXEL(CenterX - D, CenterY - A, PenBrush);
PUTPIXEL(CenterX - D, CenterY - A, PenBrushInst);
}
}
} while (B > A);
@ -922,6 +932,7 @@ IntRectangle(PDC dc,
{
BITMAPOBJ *BitmapObj = BITMAPOBJ_LockBitmap(dc->w.hBitmap);
PGDIBRUSHOBJ PenBrushObj, FillBrushObj;
GDIBRUSHINST PenBrushInst, FillBrushInst;
BOOL ret = FALSE; // default to failure
RECTL DestRect;
@ -945,6 +956,7 @@ IntRectangle(PDC dc,
DestRect.bottom = BottomRect;
FillBrushObj = BRUSHOBJ_LockBrush(dc->w.hBrush);
IntGdiInitBrushInstance(&FillBrushInst, FillBrushObj, dc->XlateBrush);
if ( FillBrushObj )
{
@ -958,7 +970,7 @@ IntRectangle(PDC dc,
&DestRect,
NULL,
NULL,
&FillBrushObj->BrushObject,
&FillBrushInst.BrushObject,
NULL,
PATCOPY);
}
@ -975,6 +987,8 @@ IntRectangle(PDC dc,
return FALSE;
}
IntGdiInitBrushInstance(&PenBrushInst, PenBrushObj, dc->XlatePen);
// Draw the rectangle with the current pen
ret = TRUE; // change default to success
@ -983,28 +997,28 @@ IntRectangle(PDC dc,
{
ret = ret && IntEngLineTo(BitmapObj,
dc->CombinedClip,
&PenBrushObj->BrushObject,
&PenBrushInst.BrushObject,
LeftRect, TopRect, RightRect, TopRect,
&DestRect, // Bounding rectangle
dc->w.ROPmode); // MIX
ret = ret && IntEngLineTo(BitmapObj,
dc->CombinedClip,
&PenBrushObj->BrushObject,
&PenBrushInst.BrushObject,
RightRect, TopRect, RightRect, BottomRect,
&DestRect, // Bounding rectangle
dc->w.ROPmode); // MIX
ret = ret && IntEngLineTo(BitmapObj,
dc->CombinedClip,
&PenBrushObj->BrushObject,
&PenBrushInst.BrushObject,
RightRect, BottomRect, LeftRect, BottomRect,
&DestRect, // Bounding rectangle
dc->w.ROPmode); // MIX
ret = ret && IntEngLineTo(BitmapObj,
dc->CombinedClip,
&PenBrushObj->BrushObject,
&PenBrushInst.BrushObject,
LeftRect, BottomRect, LeftRect, TopRect,
&DestRect, // Bounding rectangle
dc->w.ROPmode); // MIX */
@ -1059,6 +1073,7 @@ IntRoundRect(
{
BITMAPOBJ *BitmapObj;
PGDIBRUSHOBJ PenBrushObj, FillBrushObj;
GDIBRUSHINST FillBrushInst, PenBrushInst;
RECTL RectBounds;
int i, col, row, width, height, x1, x1start, x2, x2start, y1, y2;
int xradius, yradius;
@ -1108,6 +1123,9 @@ IntRoundRect(
PenBrushObj = NULL;
}
IntGdiInitBrushInstance(&FillBrushInst, FillBrushObj, dc->XlateBrush);
IntGdiInitBrushInstance(&PenBrushInst, PenBrushObj, dc->XlatePen);
right--;
bottom--;
@ -1148,20 +1166,20 @@ IntRoundRect(
if ( d >= 0 )
{
if ( FillBrushObj )
PUTLINE ( x1, y1, x2, y1, FillBrushObj );
PUTLINE ( x1, y1, x2, y1, FillBrushInst );
if ( first )
{
if ( PenBrushObj )
{
if ( x1start > x1 )
{
PUTLINE ( x1, y1, x1start, y1, PenBrushObj );
PUTLINE ( x2start+1, y2, x2+1, y2, PenBrushObj );
PUTLINE ( x1, y1, x1start, y1, PenBrushInst );
PUTLINE ( x2start+1, y2, x2+1, y2, PenBrushInst );
}
else
{
PUTPIXEL ( x1, y1, PenBrushObj );
PUTPIXEL ( x2, y2, PenBrushObj );
PUTPIXEL ( x1, y1, PenBrushInst );
PUTPIXEL ( x2, y2, PenBrushInst );
}
}
first = FALSE;
@ -1169,18 +1187,18 @@ IntRoundRect(
else
{
if ( FillBrushObj )
PUTLINE ( x1, y2, x2, y2, FillBrushObj );
PUTLINE ( x1, y2, x2, y2, FillBrushInst );
if ( PenBrushObj )
{
if ( x1start >= x1 )
{
PUTLINE ( x1, y1, x1start+1, y1, PenBrushObj );
PUTLINE ( x2start, y2, x2+1, y2, PenBrushObj );
PUTLINE ( x1, y1, x1start+1, y1, PenBrushInst );
PUTLINE ( x2start, y2, x2+1, y2, PenBrushInst );
}
else
{
PUTPIXEL ( x1, y1, PenBrushObj );
PUTPIXEL ( x2, y2, PenBrushObj );
PUTPIXEL ( x1, y1, PenBrushInst );
PUTPIXEL ( x2, y2, PenBrushInst );
}
}
}
@ -1188,13 +1206,13 @@ IntRoundRect(
{
if ( x1start > x1 )
{
PUTLINE ( x1, y2, x1start+1, y2, PenBrushObj );
PUTLINE ( x2start, y1, x2+1, y1, PenBrushObj );
PUTLINE ( x1, y2, x1start+1, y2, PenBrushInst );
PUTLINE ( x2start, y1, x2+1, y1, PenBrushInst );
}
else
{
PUTPIXEL ( x1, y2, PenBrushObj );
PUTPIXEL ( x2, y1, PenBrushObj );
PUTPIXEL ( x1, y2, PenBrushInst );
PUTPIXEL ( x2, y1, PenBrushInst );
}
}
x1start = x1-1;
@ -1224,15 +1242,15 @@ IntRoundRect(
{
if ( FillBrushObj )
{
PUTLINE ( x1, y1, x2, y1, FillBrushObj );
PUTLINE ( x1, y2, x2, y2, FillBrushObj );
PUTLINE ( x1, y1, x2, y1, FillBrushInst );
PUTLINE ( x1, y2, x2, y2, FillBrushInst );
}
if ( PenBrushObj )
{
PUTPIXEL ( x2, y1, PenBrushObj );
PUTPIXEL ( x1, y2, PenBrushObj );
PUTPIXEL ( x2, y2, PenBrushObj );
PUTPIXEL ( x1, y1, PenBrushObj );
PUTPIXEL ( x2, y1, PenBrushInst );
PUTPIXEL ( x1, y2, PenBrushInst );
PUTPIXEL ( x2, y2, PenBrushInst );
PUTPIXEL ( x1, y1, PenBrushInst );
}
if ( d <= 0 )
@ -1247,22 +1265,22 @@ IntRoundRect(
if ( FillBrushObj )
{
PUTLINE ( left, y1, right, y1, FillBrushObj );
PUTLINE ( left, y2, right, y2, FillBrushObj );
PUTLINE ( left, y1, right, y1, FillBrushInst );
PUTLINE ( left, y2, right, y2, FillBrushInst );
}
if ( PenBrushObj )
{
if ( x1 > (left+1) )
{
PUTLINE ( left, y1, x1, y1, PenBrushObj );
PUTLINE ( x2+1, y1, right, y1, PenBrushObj );
PUTLINE ( left+1, y2, x1, y2, PenBrushObj );
PUTLINE ( x2+1, y2, right+1, y2, PenBrushObj );
PUTLINE ( left, y1, x1, y1, PenBrushInst );
PUTLINE ( x2+1, y1, right, y1, PenBrushInst );
PUTLINE ( left+1, y2, x1, y2, PenBrushInst );
PUTLINE ( x2+1, y2, right+1, y2, PenBrushInst );
}
else
{
PUTPIXEL ( left, y1, PenBrushObj );
PUTPIXEL ( right, y2, PenBrushObj );
PUTPIXEL ( left, y1, PenBrushInst );
PUTPIXEL ( right, y2, PenBrushInst );
}
}
@ -1274,15 +1292,15 @@ IntRoundRect(
if ( FillBrushObj )
{
for ( i = y1+1; i < y2; i++ )
PUTLINE ( left, i, right, i, FillBrushObj );
PUTLINE ( left, i, right, i, FillBrushInst );
}
if ( PenBrushObj )
{
PUTLINE ( x1, top, x2, top, PenBrushObj );
PUTLINE ( right, y1, right, y2, PenBrushObj );
PUTLINE ( x2, bottom, x1, bottom, PenBrushObj );
PUTLINE ( left, y2, left, y1, PenBrushObj );
PUTLINE ( x1, top, x2, top, PenBrushInst );
PUTLINE ( right, y1, right, y2, PenBrushInst );
PUTLINE ( x2, bottom, x1, bottom, PenBrushInst );
PUTLINE ( left, y2, left, y1, PenBrushInst );
}
BITMAPOBJ_UnlockBitmap(dc->w.hBitmap);

View file

@ -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: icm.c,v 1.10 2004/05/10 17:07:20 weiden Exp $ */
/* $Id: icm.c,v 1.11 2004/07/14 20:48:58 navaraf Exp $ */
#include <w32k.h>
BOOL
@ -27,6 +27,7 @@ NtGdiCheckColorsInGamut(HDC hDC,
UINT Count)
{
UNIMPLEMENTED;
return FALSE;
}
BOOL
@ -36,6 +37,7 @@ NtGdiColorMatchToTarget(HDC hDC,
DWORD Action)
{
UNIMPLEMENTED;
return FALSE;
}
HCOLORSPACE
@ -43,6 +45,7 @@ STDCALL
NtGdiCreateColorSpace(LPLOGCOLORSPACEW LogColorSpace)
{
UNIMPLEMENTED;
return 0;
}
BOOL
@ -50,6 +53,7 @@ STDCALL
NtGdiDeleteColorSpace(HCOLORSPACE hColorSpace)
{
UNIMPLEMENTED;
return FALSE;
}
INT
@ -81,6 +85,7 @@ NtGdiGetDeviceGammaRamp(HDC hDC,
LPVOID Ramp)
{
UNIMPLEMENTED;
return FALSE;
}
BOOL
@ -90,6 +95,7 @@ NtGdiGetICMProfile(HDC hDC,
LPWSTR Filename)
{
UNIMPLEMENTED;
return FALSE;
}
BOOL
@ -99,6 +105,7 @@ NtGdiGetLogColorSpace(HCOLORSPACE hColorSpace,
DWORD Size)
{
UNIMPLEMENTED;
return FALSE;
}
HCOLORSPACE
@ -107,6 +114,7 @@ NtGdiSetColorSpace(HDC hDC,
HCOLORSPACE hColorSpace)
{
UNIMPLEMENTED;
return 0;
}
BOOL
@ -115,6 +123,7 @@ NtGdiSetDeviceGammaRamp(HDC hDC,
LPVOID Ramp)
{
UNIMPLEMENTED;
return FALSE;
}
INT
@ -145,6 +154,7 @@ NtGdiSetICMProfile(HDC hDC,
LPWSTR Filename)
{
UNIMPLEMENTED;
return FALSE;
}
BOOL
@ -155,6 +165,7 @@ NtGdiUpdateICMRegKey(DWORD Reserved,
UINT Command)
{
UNIMPLEMENTED;
return FALSE;
}
/* EOF */

View file

@ -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: line.c,v 1.36 2004/07/03 22:36:01 navaraf Exp $ */
/* $Id: line.c,v 1.37 2004/07/14 20:48:58 navaraf Exp $ */
#include <w32k.h>
// Some code from the WINE project source (www.winehq.com)
@ -54,6 +54,7 @@ IntGdiLineTo(DC *dc,
BITMAPOBJ *BitmapObj;
BOOL Ret = TRUE;
PGDIBRUSHOBJ PenBrushObj;
GDIBRUSHINST PenBrushInst;
RECTL Bounds;
POINT Points[2];
@ -101,9 +102,10 @@ IntGdiLineTo(DC *dc,
if (!(PenBrushObj->flAttrs & GDIBRUSH_IS_NULL))
{
IntGdiInitBrushInstance(&PenBrushInst, PenBrushObj, dc->XlatePen);
Ret = IntEngLineTo(BitmapObj,
dc->CombinedClip,
&PenBrushObj->BrushObject,
&PenBrushInst.BrushObject,
Points[0].x, Points[0].y,
Points[1].x, Points[1].y,
&Bounds,
@ -190,6 +192,7 @@ IntGdiPolyline(DC *dc,
{
BITMAPOBJ *BitmapObj;
GDIBRUSHOBJ *PenBrushObj;
GDIBRUSHINST PenBrushInst;
LPPOINT Points;
BOOL Ret = TRUE;
LONG i;
@ -219,8 +222,9 @@ IntGdiPolyline(DC *dc,
Points[i].y += dc->w.DCOrgY;
}
IntGdiInitBrushInstance(&PenBrushInst, PenBrushObj, dc->XlatePen);
Ret = IntEngPolyline(BitmapObj, dc->CombinedClip,
&PenBrushObj->BrushObject, Points, Count,
&PenBrushInst.BrushObject, Points, Count,
dc->w.ROPmode);
BITMAPOBJ_UnlockBitmap(dc->w.hBitmap);
@ -337,6 +341,7 @@ NtGdiAngleArc(HDC hDC,
FLOAT SweepAngle)
{
UNIMPLEMENTED;
return FALSE;
}
BOOL
@ -611,6 +616,7 @@ NtGdiPolyDraw(HDC hDC,
int Count)
{
UNIMPLEMENTED;
return FALSE;
}
BOOL

View file

@ -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: metafile.c,v 1.10 2004/05/10 17:07:20 weiden Exp $ */
/* $Id: metafile.c,v 1.11 2004/07/14 20:48:58 navaraf Exp $ */
#include <w32k.h>
HENHMETAFILE
@ -24,6 +24,7 @@ STDCALL
NtGdiCloseEnhMetaFile(HDC hDC)
{
UNIMPLEMENTED;
return 0;
}
HMETAFILE
@ -31,6 +32,7 @@ STDCALL
NtGdiCloseMetaFile(HDC hDC)
{
UNIMPLEMENTED;
return 0;
}
HENHMETAFILE
@ -39,6 +41,7 @@ NtGdiCopyEnhMetaFile(HENHMETAFILE Src,
LPCWSTR File)
{
UNIMPLEMENTED;
return 0;
}
HMETAFILE
@ -47,6 +50,7 @@ NtGdiCopyMetaFile(HMETAFILE Src,
LPCWSTR File)
{
UNIMPLEMENTED;
return 0;
}
HDC
@ -57,6 +61,7 @@ NtGdiCreateEnhMetaFile(HDC hDCRef,
LPCWSTR Description)
{
UNIMPLEMENTED;
return 0;
}
HDC
@ -64,6 +69,7 @@ STDCALL
NtGdiCreateMetaFile(LPCWSTR File)
{
UNIMPLEMENTED;
return 0;
}
BOOL
@ -71,6 +77,7 @@ STDCALL
NtGdiDeleteEnhMetaFile(HENHMETAFILE emf)
{
UNIMPLEMENTED;
return FALSE;
}
BOOL
@ -78,6 +85,7 @@ STDCALL
NtGdiDeleteMetaFile(HMETAFILE mf)
{
UNIMPLEMENTED;
return FALSE;
}
BOOL
@ -89,6 +97,7 @@ NtGdiEnumEnhMetaFile(HDC hDC,
CONST LPRECT Rect)
{
UNIMPLEMENTED;
return FALSE;
}
BOOL
@ -99,6 +108,7 @@ NtGdiEnumMetaFile(HDC hDC,
LPARAM lParam)
{
UNIMPLEMENTED;
return FALSE;
}
BOOL
@ -108,6 +118,7 @@ NtGdiGdiComment(HDC hDC,
CONST LPBYTE Data)
{
UNIMPLEMENTED;
return FALSE;
}
HENHMETAFILE
@ -115,6 +126,7 @@ STDCALL
NtGdiGetEnhMetaFile(LPCWSTR MetaFile)
{
UNIMPLEMENTED;
return 0;
}
UINT
@ -124,6 +136,7 @@ NtGdiGetEnhMetaFileBits(HENHMETAFILE hemf,
LPBYTE Buffer)
{
UNIMPLEMENTED;
return 0;
}
UINT
@ -133,6 +146,7 @@ NtGdiGetEnhMetaFileDescription(HENHMETAFILE hemf,
LPWSTR Description)
{
UNIMPLEMENTED;
return 0;
}
UINT
@ -142,6 +156,7 @@ NtGdiGetEnhMetaFileHeader(HENHMETAFILE hemf,
LPENHMETAHEADER emh)
{
UNIMPLEMENTED;
return 0;
}
UINT
@ -151,6 +166,7 @@ NtGdiGetEnhMetaFilePaletteEntries(HENHMETAFILE hemf,
LPPALETTEENTRY pe)
{
UNIMPLEMENTED;
return 0;
}
HMETAFILE
@ -158,6 +174,7 @@ STDCALL
NtGdiGetMetaFile(LPCWSTR MetaFile)
{
UNIMPLEMENTED;
return 0;
}
UINT
@ -167,6 +184,7 @@ NtGdiGetMetaFileBitsEx(HMETAFILE hmf,
LPVOID Data)
{
UNIMPLEMENTED;
return 0;
}
UINT
@ -178,6 +196,7 @@ NtGdiGetWinMetaFileBits(HENHMETAFILE hemf,
HDC Ref)
{
UNIMPLEMENTED;
return 0;
}
BOOL
@ -187,6 +206,7 @@ NtGdiPlayEnhMetaFile(HDC hDC,
CONST PRECT Rect)
{
UNIMPLEMENTED;
return FALSE;
}
BOOL
@ -197,6 +217,7 @@ NtGdiPlayEnhMetaFileRecord(HDC hDC,
UINT Handles)
{
UNIMPLEMENTED;
return FALSE;
}
BOOL
@ -205,6 +226,7 @@ NtGdiPlayMetaFile(HDC hDC,
HMETAFILE hmf)
{
UNIMPLEMENTED;
return FALSE;
}
BOOL
@ -215,6 +237,7 @@ NtGdiPlayMetaFileRecord(HDC hDC,
UINT Handles)
{
UNIMPLEMENTED;
return FALSE;
}
HENHMETAFILE
@ -223,6 +246,7 @@ NtGdiSetEnhMetaFileBits(UINT BufSize,
CONST PBYTE Data)
{
UNIMPLEMENTED;
return 0;
}
HMETAFILE
@ -231,6 +255,7 @@ NtGdiSetMetaFileBitsEx(UINT Size,
CONST PBYTE Data)
{
UNIMPLEMENTED;
return 0;
}
HENHMETAFILE
@ -242,6 +267,7 @@ NtGdiSetWinMetaFileBits(UINT BufSize,
PVOID mfp)
{
UNIMPLEMENTED;
return 0;
}
/* EOF */

View file

@ -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: paint.c,v 1.11 2004/05/10 17:07:20 weiden Exp $ */
/* $Id: paint.c,v 1.12 2004/07/14 20:48:58 navaraf Exp $ */
#include <w32k.h>
BOOL
@ -24,6 +24,7 @@ STDCALL
NtGdiGdiFlush(VOID)
{
UNIMPLEMENTED;
return FALSE;
}
DWORD
@ -31,6 +32,7 @@ STDCALL
NtGdiGdiGetBatchLimit(VOID)
{
UNIMPLEMENTED;
return 0;
}
DWORD
@ -38,6 +40,7 @@ STDCALL
NtGdiGdiSetBatchLimit(DWORD Limit)
{
UNIMPLEMENTED;
return 0;
}
UINT

View file

@ -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: path.c,v 1.23 2004/07/03 17:40:27 navaraf Exp $ */
/* $Id: path.c,v 1.24 2004/07/14 20:48:58 navaraf Exp $ */
#include <w32k.h>
#include <win32k/float.h>
@ -43,6 +43,7 @@ STDCALL
NtGdiAbortPath(HDC hDC)
{
UNIMPLEMENTED;
return FALSE;
}
BOOL
@ -50,6 +51,7 @@ STDCALL
NtGdiBeginPath(HDC hDC)
{
UNIMPLEMENTED;
return FALSE;
}
BOOL
@ -81,6 +83,7 @@ STDCALL
NtGdiEndPath(HDC hDC)
{
UNIMPLEMENTED;
return FALSE;
}
BOOL
@ -88,6 +91,7 @@ STDCALL
NtGdiFillPath(HDC hDC)
{
UNIMPLEMENTED;
return FALSE;
}
BOOL
@ -95,6 +99,7 @@ STDCALL
NtGdiFlattenPath(HDC hDC)
{
UNIMPLEMENTED;
return FALSE;
}
@ -104,6 +109,7 @@ NtGdiGetMiterLimit(HDC hDC,
PFLOAT Limit)
{
UNIMPLEMENTED;
return FALSE;
}
INT
@ -114,6 +120,7 @@ NtGdiGetPath(HDC hDC,
INT nSize)
{
UNIMPLEMENTED;
return 0;
}
HRGN
@ -121,6 +128,7 @@ STDCALL
NtGdiPathToRegion(HDC hDC)
{
UNIMPLEMENTED;
return 0;
}
BOOL
@ -130,6 +138,7 @@ NtGdiSetMiterLimit(HDC hDC,
PFLOAT OldLimit)
{
UNIMPLEMENTED;
return FALSE;
}
BOOL
@ -137,6 +146,7 @@ STDCALL
NtGdiStrokeAndFillPath(HDC hDC)
{
UNIMPLEMENTED;
return FALSE;
}
BOOL
@ -144,6 +154,7 @@ STDCALL
NtGdiStrokePath(HDC hDC)
{
UNIMPLEMENTED;
return FALSE;
}
BOOL
@ -151,6 +162,7 @@ STDCALL
NtGdiWidenPath(HDC hDC)
{
UNIMPLEMENTED;
return FALSE;
}
/***********************************************************************

View file

@ -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: pen.c,v 1.15 2004/05/10 17:07:20 weiden Exp $
* $Id: pen.c,v 1.16 2004/07/14 20:48:58 navaraf Exp $
*/
#include <w32k.h>
@ -45,7 +45,6 @@ IntGdiCreatePenIndirect(PLOGPEN LogPen)
PenObject->ptPenWidth = LogPen->lopnWidth;
PenObject->ulPenStyle = LogPen->lopnStyle;
PenObject->BrushAttr.lbColor = LogPen->lopnColor;
PenObject->BrushObject.iSolidColor = LogPen->lopnColor;
PenObject->flAttrs = GDIBRUSH_IS_OLDSTYLEPEN;
switch (LogPen->lopnStyle)
{
@ -114,6 +113,7 @@ NtGdiExtCreatePen(
CONST PDWORD Style)
{
UNIMPLEMENTED;
return 0;
}
/* EOF */

View file

@ -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: print.c,v 1.19 2004/07/03 13:55:37 navaraf Exp $ */
/* $Id: print.c,v 1.20 2004/07/14 20:48:58 navaraf Exp $ */
#include <w32k.h>
INT
@ -24,6 +24,7 @@ STDCALL
NtGdiAbortDoc(HDC hDC)
{
UNIMPLEMENTED;
return 0;
}
INT
@ -31,6 +32,7 @@ STDCALL
NtGdiEndDoc(HDC hDC)
{
UNIMPLEMENTED;
return 0;
}
INT
@ -38,6 +40,7 @@ STDCALL
NtGdiEndPage(HDC hDC)
{
UNIMPLEMENTED;
return 0;
}
INT
@ -49,6 +52,7 @@ NtGdiEscape(HDC hDC,
LPVOID OutData)
{
UNIMPLEMENTED;
return 0;
}
INT
@ -184,6 +188,7 @@ NtGdiSetAbortProc(HDC hDC,
ABORTPROC AbortProc)
{
UNIMPLEMENTED;
return 0;
}
INT
@ -192,6 +197,7 @@ NtGdiStartDoc(HDC hDC,
CONST LPDOCINFOW di)
{
UNIMPLEMENTED;
return 0;
}
INT
@ -199,5 +205,6 @@ STDCALL
NtGdiStartPage(HDC hDC)
{
UNIMPLEMENTED;
return 0;
}
/* EOF */

View file

@ -113,7 +113,7 @@ SOFTWARE.
* the y-x-banding that's so nice to have...
*/
/* $Id: region.c,v 1.61 2004/07/03 17:40:27 navaraf Exp $ */
/* $Id: region.c,v 1.62 2004/07/14 20:48:58 navaraf Exp $ */
#include <w32k.h>
#include <win32k/float.h>
@ -2396,6 +2396,7 @@ NtGdiPaintRgn(HDC hDC,
CLIPOBJ* ClipRegion;
BOOL bRet = FALSE;
PGDIBRUSHOBJ pBrush;
GDIBRUSHINST BrushInst;
POINTL BrushOrigin;
BITMAPOBJ *BitmapObj;
@ -2432,13 +2433,15 @@ NtGdiPaintRgn(HDC hDC,
ASSERT( ClipRegion );
pBrush = BRUSHOBJ_LockBrush(dc->w.hBrush);
ASSERT(pBrush);
IntGdiInitBrushInstance(&BrushInst, pBrush, dc->XlateBrush);
BrushOrigin.x = dc->w.brushOrgX;
BrushOrigin.y = dc->w.brushOrgY;
BitmapObj = BITMAPOBJ_LockBitmap(dc->w.hBitmap);
bRet = IntEngPaint(BitmapObj,
ClipRegion,
&pBrush->BrushObject,
&BrushInst.BrushObject,
&BrushOrigin,
0xFFFF);//FIXME:don't know what to put here

View file

@ -22,7 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: text.c,v 1.104 2004/07/11 02:10:48 navaraf Exp $ */
/* $Id: text.c,v 1.105 2004/07/14 20:48:58 navaraf Exp $ */
#include <w32k.h>
#include <ft2build.h>
@ -648,6 +648,7 @@ NtGdiCreateScalableFontResource(DWORD Hidden,
LPCWSTR CurrentPath)
{
UNIMPLEMENTED;
return FALSE;
}
/*************************************************************************
@ -1494,6 +1495,7 @@ NtGdiEnumFonts(HDC hDC,
LPARAM lParam)
{
UNIMPLEMENTED;
return 0;
}
BOOL STDCALL
@ -1525,8 +1527,10 @@ NtGdiExtTextOut(
POINTL SourcePoint, BrushOrigin;
HBRUSH hBrushFg = NULL;
PGDIBRUSHOBJ BrushFg = NULL;
GDIBRUSHINST BrushFgInst;
HBRUSH hBrushBg = NULL;
PGDIBRUSHOBJ BrushBg = NULL;
GDIBRUSHINST BrushBgInst;
HBITMAP HSourceGlyph;
SURFOBJ *SourceGlyphSurf;
SIZEL bitSize;
@ -1587,12 +1591,14 @@ NtGdiExtTextOut(
XlateObj = (XLATEOBJ*)IntEngCreateXlate(Mode, PAL_RGB, dc->w.hPalette, NULL);
hBrushFg = NtGdiCreateSolidBrush(XLATEOBJ_iXlate(XlateObj, dc->w.textColor));
BrushFg = BRUSHOBJ_LockBrush(hBrushFg);
IntGdiInitBrushInstance(&BrushFgInst, BrushFg, NULL);
if ((fuOptions & ETO_OPAQUE) || dc->w.backgroundMode == OPAQUE)
{
hBrushBg = NtGdiCreateSolidBrush(XLATEOBJ_iXlate(XlateObj, dc->w.backgroundColor));
if (hBrushBg)
{
BrushBg = BRUSHOBJ_LockBrush(hBrushBg);
IntGdiInitBrushInstance(&BrushBgInst, BrushBg, NULL);
}
else
{
@ -1625,7 +1631,7 @@ NtGdiExtTextOut(
&DestRect,
&SourcePoint,
&SourcePoint,
&BrushBg->BrushObject,
&BrushBgInst.BrushObject,
&BrushOrigin,
PATCOPY);
fuOptions &= ~ETO_OPAQUE;
@ -1839,7 +1845,7 @@ NtGdiExtTextOut(
&DestRect,
&SourcePoint,
&SourcePoint,
&BrushBg->BrushObject,
&BrushBgInst.BrushObject,
&BrushOrigin,
PATCOPY);
BackgroundLeft = DestRect.right;
@ -1878,7 +1884,7 @@ NtGdiExtTextOut(
&DestRect,
&SourcePoint,
(PPOINTL)&MaskRect,
&BrushFg->BrushObject,
&BrushFgInst.BrushObject,
&BrushOrigin);
EngUnlockSurface(SourceGlyphSurf);
@ -1944,6 +1950,7 @@ NtGdiGetAspectRatioFilterEx(HDC hDC,
LPSIZE AspectRatio)
{
UNIMPLEMENTED;
return FALSE;
}
BOOL
@ -1965,6 +1972,7 @@ NtGdiGetCharABCWidthsFloat(HDC hDC,
LPABCFLOAT abcF)
{
UNIMPLEMENTED;
return FALSE;
}
DWORD
@ -1977,6 +1985,7 @@ NtGdiGetCharacterPlacement(HDC hDC,
DWORD Flags)
{
UNIMPLEMENTED;
return 0;
}
BOOL
@ -2090,6 +2099,7 @@ NtGdiGetCharWidthFloat(HDC hDC,
PFLOAT Buffer)
{
UNIMPLEMENTED;
return FALSE;
}
DWORD
@ -2097,6 +2107,7 @@ STDCALL
NtGdiGetFontLanguageInfo(HDC hDC)
{
UNIMPLEMENTED;
return 0;
}
DWORD
@ -2110,8 +2121,7 @@ NtGdiGetGlyphOutline(HDC hDC,
CONST LPMAT2 mat2)
{
UNIMPLEMENTED;
return 0;
}
DWORD
@ -2121,6 +2131,7 @@ NtGdiGetKerningPairs(HDC hDC,
LPKERNINGPAIR krnpair)
{
UNIMPLEMENTED;
return 0;
}
UINT
@ -2130,6 +2141,7 @@ NtGdiGetOutlineTextMetrics(HDC hDC,
LPOUTLINETEXTMETRICW otm)
{
UNIMPLEMENTED;
return 0;
}
BOOL
@ -2138,6 +2150,7 @@ NtGdiGetRasterizerCaps(LPRASTERIZER_STATUS rs,
UINT Size)
{
UNIMPLEMENTED;
return FALSE;
}
UINT
@ -2145,6 +2158,7 @@ STDCALL
NtGdiGetTextCharset(HDC hDC)
{
UNIMPLEMENTED;
return 0;
}
UINT
@ -2154,6 +2168,7 @@ NtGdiGetTextCharsetInfo(HDC hDC,
DWORD Flags)
{
UNIMPLEMENTED;
return 0;
}
static BOOL
@ -2625,6 +2640,7 @@ NtGdiPolyTextOut(HDC hDC,
int Count)
{
UNIMPLEMENTED;
return FALSE;
}
BOOL
@ -2632,6 +2648,7 @@ STDCALL
NtGdiRemoveFontResource(LPCWSTR FileName)
{
UNIMPLEMENTED;
return FALSE;
}
DWORD
@ -2640,6 +2657,7 @@ NtGdiSetMapperFlags(HDC hDC,
DWORD Flag)
{
UNIMPLEMENTED;
return 0;
}
UINT
@ -2692,6 +2710,7 @@ NtGdiSetTextJustification(HDC hDC,
int BreakCount)
{
UNIMPLEMENTED;
return FALSE;
}
BOOL STDCALL

View file

@ -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: wingl.c,v 1.8 2004/05/10 17:07:20 weiden Exp $ */
/* $Id: wingl.c,v 1.9 2004/07/14 20:48:58 navaraf Exp $ */
#include <w32k.h>
INT
@ -25,6 +25,7 @@ NtGdiChoosePixelFormat(HDC hDC,
CONST PPIXELFORMATDESCRIPTOR pfd)
{
UNIMPLEMENTED;
return 0;
}
@ -36,6 +37,7 @@ NtGdiDescribePixelFormat(HDC hDC,
LPPIXELFORMATDESCRIPTOR pfd)
{
UNIMPLEMENTED;
return 0;
}
UINT
@ -45,6 +47,7 @@ NtGdiGetEnhMetaFilePixelFormat(HENHMETAFILE hEMF,
CONST PPIXELFORMATDESCRIPTOR pfd)
{
UNIMPLEMENTED;
return 0;
}
INT
@ -52,6 +55,7 @@ STDCALL
NtGdiGetPixelFormat(HDC hDC)
{
UNIMPLEMENTED;
return 0;
}
BOOL
@ -61,6 +65,7 @@ NtGdiSetPixelFormat(HDC hDC,
CONST PPIXELFORMATDESCRIPTOR pfd)
{
UNIMPLEMENTED;
return FALSE;
}
BOOL
@ -68,6 +73,7 @@ STDCALL
NtGdiSwapBuffers(HDC hDC)
{
UNIMPLEMENTED;
return FALSE;
}
/* EOF */