mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 08:55:19 +00:00
Added top level ignore list
svn path=/trunk/; revision=773
This commit is contained in:
parent
6767fd7f43
commit
96d5e2c715
12 changed files with 535 additions and 67 deletions
2
reactos/.cvsignore
Normal file
2
reactos/.cvsignore
Normal file
|
@ -0,0 +1,2 @@
|
|||
dist
|
||||
errors
|
|
@ -445,6 +445,9 @@ typedef struct _BRUSHOBJ
|
|||
{
|
||||
ULONG iSolidColor;
|
||||
PVOID pvRbrush;
|
||||
|
||||
/* remainder of fields are for GDI internal use */
|
||||
LOGBRUSH logbrush;
|
||||
} BRUSHOBJ, *PBRUSHOBJ;
|
||||
|
||||
typedef struct _CLIPOBJ
|
||||
|
|
|
@ -15,7 +15,6 @@ typedef struct _DDBITMAP
|
|||
/* GDI logical bitmap object */
|
||||
typedef struct _BITMAPOBJ
|
||||
{
|
||||
GDIOBJHDR header;
|
||||
BITMAP bitmap;
|
||||
SIZE size; /* For SetBitmapDimension() */
|
||||
|
||||
|
@ -28,16 +27,20 @@ typedef struct _BITMAPOBJ
|
|||
/* Internal interface */
|
||||
|
||||
#define BITMAPOBJ_AllocBitmap() \
|
||||
((PBITMAPOBJ) GDIOBJ_AllocObject(sizeof(BITMAPOBJ), GO_BITMAP_MAGIC))
|
||||
#define BITMAPOBJ_FreeBitmap(hBMObj) GDIOBJ_FreeObject((HGDIOBJ)hBMObj)
|
||||
((PBITMAPOBJ) GDIOBJ_AllocObject (sizeof (BITMAPOBJ), GO_BITMAP_MAGIC))
|
||||
#define BITMAPOBJ_FreeBitmap(hBMObj) GDIOBJ_FreeObject((HGDIOBJ) hBMObj)
|
||||
#define BITMAPOBJ_HandleToPtr(hBMObj) \
|
||||
((PBITMAPOBJ) GDIOBJ_HandleToPtr((HGDIOBJ)hBMObj, GO_BITMAP_MAGIC))
|
||||
((PBITMAPOBJ) GDIOBJ_HandleToPtr ((HGDIOBJ) hBMObj, GO_BITMAP_MAGIC))
|
||||
#define BITMAPOBJ_PtrToHandle(hBMObj) \
|
||||
((HBITMAP) GDIOBJ_HandleToPtr((PGDIOBJ)hBMObj, GO_BITMAP_MAGIC))
|
||||
#define BITMAPOBJ_LockBitmap(hBMObj) GDIOBJ_LockObject((HGDIOBJ)hBMObj)
|
||||
#define BITMAPOBJ_UnlockBitmap(hBMObj) GDIOBJ_UnlockObject((HGDIOBJ)hBMObj)
|
||||
((HBITMAP) GDIOBJ_PtrToHandle ((PGDIOBJ) hBMObj, GO_BITMAP_MAGIC))
|
||||
#define BITMAPOBJ_LockBitmap(hBMObj) GDIOBJ_LockObject ((HGDIOBJ) hBMObj)
|
||||
#define BITMAPOBJ_UnlockBitmap(hBMObj) GDIOBJ_UnlockObject ((HGDIOBJ) hBMObj)
|
||||
|
||||
INT BITMAP_GetWidthBytes (INT bmWidth, INT bpp);
|
||||
INT BITMAPOBJ_GetWidthBytes (INT bmWidth, INT bpp);
|
||||
HBITMAP BITMAPOBJ_CopyBitmap (HBITMAP hBitmap);
|
||||
int DIB_GetDIBWidthBytes (int width, int depth);
|
||||
int DIB_GetDIBImageBytes (int width, int height, int depth);
|
||||
int DIB_BitmapInfoSize (const BITMAPINFO * info, WORD coloruse);
|
||||
|
||||
/* User Entry Points */
|
||||
BOOL W32kBitBlt(HDC hDCDest,
|
||||
|
|
|
@ -2,6 +2,22 @@
|
|||
#ifndef __WIN32K_BRUSH_H
|
||||
#define __WIN32K_BRUSH_H
|
||||
|
||||
#include <win32k/gdiobj.h>
|
||||
|
||||
/* Internal interface */
|
||||
|
||||
#define NB_HATCH_STYLES 6
|
||||
|
||||
#define BRUSHOBJ_AllocBrush() \
|
||||
((PBRUSHOBJ) GDIOBJ_AllocObject (sizeof (BRUSHOBJ), GO_BRUSH_MAGIC))
|
||||
#define BRUSHOBJ_FreeBrush(hBrush) GDIOBJ_FreeObject((HGDIOBJ)hBrush)
|
||||
#define BRUSHOBJ_HandleToPtr(hBrush) \
|
||||
((PBRUSHOBJ) GDIOBJ_HandleToPtr ((HGDIOBJ) hBrush, GO_BRUSH_MAGIC))
|
||||
#define BRUSHOBJ_PtrToHandle(pBrushObj) \
|
||||
((HBRUSH) GDIOBJ_PtrToHandle ((PGDIOBJ) pBrushObj, GO_BRUSH_MAGIC))
|
||||
#define BRUSHOBJ_LockBrush(hBrush) GDIOBJ_LockObject((HGDIOBJ)hBrush)
|
||||
#define BRUSHOBJ_UnlockBrush(hBrush) GDIOBJ_UnlockObject((HGDIOBJ)hBrush)
|
||||
|
||||
HBRUSH W32kCreateBrushIndirect(CONST LOGBRUSH *lb);
|
||||
HBRUSH W32kCreateDIBPatternBrush(HGLOBAL hDIBPacked,
|
||||
UINT ColorSpec);
|
||||
|
|
|
@ -45,14 +45,9 @@ typedef struct _WIN_DC_INFO
|
|||
{
|
||||
int flags;
|
||||
const PDEVICECAPS devCaps;
|
||||
|
||||
HRGN hClipRgn; /* Clip region (may be 0) */
|
||||
|
||||
#if 0
|
||||
HRGN hVisRgn; /* Visible region (must never be 0) */
|
||||
HRGN hGCClipRgn; /* GC clip region (ClipRgn AND VisRgn) */
|
||||
#endif
|
||||
|
||||
HRGN hVisRgn; /* Visible region (must never be 0) */
|
||||
HRGN hGCClipRgn; /* GC clip region (ClipRgn AND VisRgn) */
|
||||
HPEN hPen;
|
||||
HBRUSH hBrush;
|
||||
HFONT hFont;
|
||||
|
@ -116,7 +111,6 @@ typedef struct _WIN_DC_INFO
|
|||
|
||||
typedef struct _DC
|
||||
{
|
||||
GDIOBJHDR header;
|
||||
HDC hSelf;
|
||||
DHPDEV PDev;
|
||||
DEVMODEW DMW;
|
||||
|
@ -146,11 +140,11 @@ typedef struct _DC
|
|||
/* Internal functions */
|
||||
|
||||
#define DC_PtrToHandle(pDC) \
|
||||
((HDC) GDIOBJ_PtrToHandle((PGDIOBJ)pDC, GO_DC_MAGIC))
|
||||
((HDC) GDIOBJ_PtrToHandle ((PGDIOBJ) pDC, GO_DC_MAGIC))
|
||||
#define DC_HandleToPtr(hDC) \
|
||||
((PDC) GDIOBJ_HandleToPtr((HGDIOBJ)hDC, GO_DC_MAGIC))
|
||||
#define DC_LockDC(hDC) GDIOBJ_LockObject((HGDIOBJ)hDC)
|
||||
#define DC_UnlockDC(hDC) GDIOBJ_UnlockObject((HGDIOBJ)hDC)
|
||||
((PDC) GDIOBJ_HandleToPtr ((HGDIOBJ) hDC, GO_DC_MAGIC))
|
||||
#define DC_LockDC(hDC) GDIOBJ_LockObject ((HGDIOBJ) hDC)
|
||||
#define DC_UnlockDC(hDC) GDIOBJ_UnlockObject ((HGDIOBJ) hDC)
|
||||
PDC DC_AllocDC(LPCWSTR Driver);
|
||||
void DC_InitDC(PDC DCToInit);
|
||||
PDC DC_FindOpenDC(LPCWSTR Driver);
|
||||
|
|
|
@ -25,6 +25,34 @@
|
|||
#define GO_ENHMETAFILE_DC_MAGIC 0x4f53
|
||||
#define GO_MAGIC_DONTCARE 0xffff
|
||||
|
||||
/* (RJJ) swiped stock handles from wine */
|
||||
/* First handle possible for stock objects (must be >= GDI_HEAP_SIZE) */
|
||||
#define FIRST_STOCK_HANDLE 0xffffff00
|
||||
|
||||
/* Stock objects handles */
|
||||
#define NB_STOCK_OBJECTS (DEFAULT_GUI_FONT + 1)
|
||||
#define STOCK_WHITE_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+WHITE_BRUSH))
|
||||
#define STOCK_LTGRAY_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+LTGRAY_BRUSH))
|
||||
#define STOCK_GRAY_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+GRAY_BRUSH))
|
||||
#define STOCK_DKGRAY_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+DKGRAY_BRUSH))
|
||||
#define STOCK_BLACK_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+BLACK_BRUSH))
|
||||
#define STOCK_NULL_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+NULL_BRUSH))
|
||||
#define STOCK_HOLLOW_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+HOLLOW_BRUSH))
|
||||
#define STOCK_WHITE_PEN ((HPEN)(FIRST_STOCK_HANDLE+WHITE_PEN))
|
||||
#define STOCK_BLACK_PEN ((HPEN)(FIRST_STOCK_HANDLE+BLACK_PEN))
|
||||
#define STOCK_NULL_PEN ((HPEN)(FIRST_STOCK_HANDLE+NULL_PEN))
|
||||
#define STOCK_OEM_FIXED_FONT ((HFONT)(FIRST_STOCK_HANDLE+OEM_FIXED_FONT))
|
||||
#define STOCK_ANSI_FIXED_FONT ((HFONT)(FIRST_STOCK_HANDLE+ANSI_FIXED_FONT))
|
||||
#define STOCK_ANSI_VAR_FONT ((HFONT)(FIRST_STOCK_HANDLE+ANSI_VAR_FONT))
|
||||
#define STOCK_SYSTEM_FONT ((HFONT)(FIRST_STOCK_HANDLE+SYSTEM_FONT))
|
||||
#define STOCK_DEVICE_DEFAULT_FONT ((HFONT)(FIRST_STOCK_HANDLE+DEVICE_DEFAULT_FONT))
|
||||
#define STOCK_DEFAULT_PALETTE ((HPALETTE)(FIRST_STOCK_HANDLE+DEFAULT_PALETTE))
|
||||
#define STOCK_SYSTEM_FIXED_FONT ((HFONT)(FIRST_STOCK_HANDLE+SYSTEM_FIXED_FONT))
|
||||
#define STOCK_DEFAULT_GUI_FONT ((HFONT)(FIRST_STOCK_HANDLE+DEFAULT_GUI_FONT))
|
||||
#define FIRST_STOCK_FONT STOCK_OEM_FIXED_FONT
|
||||
#define LAST_STOCK_FONT STOCK_DEFAULT_GUI_FONT
|
||||
#define LAST_STOCK_HANDLE ((DWORD)STOCK_DEFAULT_GUI_FONT)
|
||||
|
||||
typedef struct _GDIOBJHDR
|
||||
{
|
||||
HANDLE hNext;
|
||||
|
@ -40,6 +68,8 @@ HGDIOBJ GDIOBJ_PtrToHandle (PGDIOBJ Obj, WORD Magic);
|
|||
PGDIOBJ GDIOBJ_HandleToPtr (HGDIOBJ Obj, WORD Magic);
|
||||
BOOL GDIOBJ_LockObject (HGDIOBJ Obj);
|
||||
BOOL GDIOBJ_UnlockObject (HGDIOBJ Obj);
|
||||
HGDIOBJ GDIOBJ_GetNextObject (HGDIOBJ Obj, WORD Magic);
|
||||
HGDIOBJ GDIOBJ_SetNextObject (HGDIOBJ Obj, WORD Magic, HGDIOBJ NextObj);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <win32k/color.h>
|
||||
#include <win32k/coord.h>
|
||||
#include <win32k/dc.h>
|
||||
#include <win32k/debug.h>
|
||||
#include <win32k/fillshap.h>
|
||||
#include <win32k/icm.h>
|
||||
#include <win32k/line.h>
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <stdlib.h>
|
||||
#include <win32k/bitmaps.h>
|
||||
#include <win32k/debug.h>
|
||||
|
||||
// #define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
@ -68,7 +70,7 @@ HBITMAP W32kCreateBitmap(INT Width,
|
|||
bmp->bitmap.bmHeight = Height;
|
||||
bmp->bitmap.bmPlanes = Planes;
|
||||
bmp->bitmap.bmBitsPixel = BitsPerPel;
|
||||
bmp->bitmap.bmWidthBytes = BITMAP_GetWidthBytes (Width, BitsPerPel);
|
||||
bmp->bitmap.bmWidthBytes = BITMAPOBJ_GetWidthBytes (Width, BitsPerPel);
|
||||
bmp->bitmap.bmBits = NULL;
|
||||
bmp->DDBitmap = NULL;
|
||||
bmp->dib = NULL;
|
||||
|
@ -158,7 +160,8 @@ HBITMAP W32kCreateDiscardableBitmap(HDC hDC,
|
|||
INT Width,
|
||||
INT Height)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
/* FIXME: this probably should do something else */
|
||||
return W32kCreateCompatibleBitmap(hDC, Width, Height);
|
||||
}
|
||||
|
||||
BOOL W32kExtFloodFill(HDC hDC,
|
||||
|
@ -258,7 +261,18 @@ LONG W32kGetBitmapBits(HBITMAP hBitmap,
|
|||
BOOL W32kGetBitmapDimensionEx(HBITMAP hBitmap,
|
||||
LPSIZE Dimension)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
PBITMAPOBJ bmp;
|
||||
|
||||
bmp = BITMAPOBJ_HandleToPtr (hBitmap);
|
||||
if (bmp == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*Dimension = bmp->size;
|
||||
BITMAPOBJ_UnlockBitmap (hBitmap);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
UINT W32kGetDIBColorTable(HDC hDC,
|
||||
|
@ -321,7 +335,77 @@ LONG W32kSetBitmapBits(HBITMAP hBitmap,
|
|||
DWORD Bytes,
|
||||
CONST VOID *Bits)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
DWORD height, ret;
|
||||
PBITMAPOBJ bmp;
|
||||
|
||||
bmp = BITMAPOBJ_HandleToPtr (hBitmap);
|
||||
if (bmp == NULL || Bits == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (Bytes < 0)
|
||||
{
|
||||
DPRINT ("(%ld): Negative number of bytes passed???\n", Bytes );
|
||||
Bytes = -Bytes;
|
||||
}
|
||||
|
||||
/* Only get entire lines */
|
||||
height = Bytes / bmp->bitmap.bmWidthBytes;
|
||||
if (height > bmp->bitmap.bmHeight)
|
||||
{
|
||||
height = bmp->bitmap.bmHeight;
|
||||
}
|
||||
Bytes = height * bmp->bitmap.bmWidthBytes;
|
||||
DPRINT ("(%08x, %ld, %p) %dx%d %d colors fetched height: %ld\n",
|
||||
hBitmap,
|
||||
Bytes,
|
||||
Bits,
|
||||
bmp->bitmap.bmWidth,
|
||||
bmp->bitmap.bmHeight,
|
||||
1 << bmp->bitmap.bmBitsPixel,
|
||||
height);
|
||||
|
||||
#if 0
|
||||
/* FIXME: call DDI specific function here if available */
|
||||
if(bmp->DDBitmap)
|
||||
{
|
||||
DPRINT ("Calling device specific BitmapBits\n");
|
||||
if (bmp->DDBitmap->funcs->pBitmapBits)
|
||||
{
|
||||
ret = bmp->DDBitmap->funcs->pBitmapBits(hBitmap,
|
||||
(void *) Bits,
|
||||
Bytes,
|
||||
DDB_SET);
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT ("BitmapBits == NULL??\n");
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/* FIXME: Alloc enough for entire bitmap */
|
||||
if (bmp->bitmap.bmBits == NULL)
|
||||
{
|
||||
bmp->bitmap.bmBits = ExAllocatePool (NonPagedPool, Bytes);
|
||||
}
|
||||
if(!bmp->bitmap.bmBits)
|
||||
{
|
||||
DPRINT ("Unable to allocate bit buffer\n");
|
||||
ret = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(bmp->bitmap.bmBits, Bits, Bytes);
|
||||
ret = Bytes;
|
||||
}
|
||||
}
|
||||
BITMAPOBJ_UnlockBitmap (hBitmap);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL W32kSetBitmapDimensionEx(HBITMAP hBitmap,
|
||||
|
@ -329,7 +413,23 @@ BOOL W32kSetBitmapDimensionEx(HBITMAP hBitmap,
|
|||
INT Height,
|
||||
LPSIZE Size)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
PBITMAPOBJ bmp;
|
||||
|
||||
bmp = BITMAPOBJ_HandleToPtr (hBitmap);
|
||||
if (bmp == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (Size)
|
||||
{
|
||||
*Size = bmp->size;
|
||||
}
|
||||
bmp->size.cx = Width;
|
||||
bmp->size.cy = Height;
|
||||
BITMAPOBJ_UnlockBitmap (hBitmap);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
UINT W32kSetDIBColorTable(HDC hDC,
|
||||
|
@ -418,7 +518,7 @@ INT W32kStretchDIBits(HDC hDC,
|
|||
/* Internal Functions */
|
||||
|
||||
INT
|
||||
BITMAP_GetWidthBytes (INT bmWidth, INT bpp)
|
||||
BITMAPOBJ_GetWidthBytes (INT bmWidth, INT bpp)
|
||||
{
|
||||
switch(bpp)
|
||||
{
|
||||
|
@ -441,9 +541,108 @@ BITMAP_GetWidthBytes (INT bmWidth, INT bpp)
|
|||
return 2 * ((bmWidth+3) >> 2);
|
||||
|
||||
default:
|
||||
UNIMPLEMENTED;
|
||||
FIXME ("stub");
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
HBITMAP BITMAPOBJ_CopyBitmap(HBITMAP hBitmap)
|
||||
{
|
||||
PBITMAPOBJ bmp;
|
||||
HBITMAP res;
|
||||
BITMAP bm;
|
||||
|
||||
bmp = BITMAPOBJ_HandleToPtr (hBitmap);
|
||||
if (bmp == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
res = 0;
|
||||
|
||||
bm = bmp->bitmap;
|
||||
bm.bmBits = NULL;
|
||||
res = W32kCreateBitmapIndirect(&bm);
|
||||
if(res)
|
||||
{
|
||||
char *buf;
|
||||
|
||||
buf = ExAllocatePool (NonPagedPool, bm.bmWidthBytes * bm.bmHeight);
|
||||
W32kGetBitmapBits (hBitmap, bm.bmWidthBytes * bm.bmHeight, buf);
|
||||
W32kSetBitmapBits (res, bm.bmWidthBytes * bm.bmHeight, buf);
|
||||
ExFreePool (buf);
|
||||
}
|
||||
BITMAPOBJ_UnlockBitmap (hBitmap);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* DIB_GetDIBWidthBytes
|
||||
*
|
||||
* Return the width of a DIB bitmap in bytes. DIB bitmap data is 32-bit aligned.
|
||||
* http://www.microsoft.com/msdn/sdk/platforms/doc/sdk/win32/struc/src/str01.htm
|
||||
* 11/16/1999 (RJJ) lifted from wine
|
||||
*/
|
||||
int DIB_GetDIBWidthBytes(int width, int depth)
|
||||
{
|
||||
int words;
|
||||
|
||||
switch(depth)
|
||||
{
|
||||
case 1: words = (width + 31) / 32; break;
|
||||
case 4: words = (width + 7) / 8; break;
|
||||
case 8: words = (width + 3) / 4; break;
|
||||
case 15:
|
||||
case 16: words = (width + 1) / 2; break;
|
||||
case 24: words = (width * 3 + 3)/4; break;
|
||||
|
||||
default:
|
||||
DPRINT("(%d): Unsupported depth\n", depth );
|
||||
/* fall through */
|
||||
case 32:
|
||||
words = width;
|
||||
}
|
||||
return 4 * words;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* DIB_GetDIBImageBytes
|
||||
*
|
||||
* Return the number of bytes used to hold the image in a DIB bitmap.
|
||||
* 11/16/1999 (RJJ) lifted from wine
|
||||
*/
|
||||
|
||||
int DIB_GetDIBImageBytes (int width, int height, int depth)
|
||||
{
|
||||
return DIB_GetDIBWidthBytes( width, depth ) * abs( height );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* DIB_BitmapInfoSize
|
||||
*
|
||||
* Return the size of the bitmap info structure including color table.
|
||||
* 11/16/1999 (RJJ) lifted from wine
|
||||
*/
|
||||
|
||||
int DIB_BitmapInfoSize (const BITMAPINFO * info, WORD coloruse)
|
||||
{
|
||||
int colors;
|
||||
|
||||
if (info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
|
||||
{
|
||||
BITMAPCOREHEADER *core = (BITMAPCOREHEADER *)info;
|
||||
colors = (core->bcBitCount <= 8) ? 1 << core->bcBitCount : 0;
|
||||
return sizeof(BITMAPCOREHEADER) + colors *
|
||||
((coloruse == DIB_RGB_COLORS) ? sizeof(RGBTRIPLE) : sizeof(WORD));
|
||||
}
|
||||
else /* assume BITMAPINFOHEADER */
|
||||
{
|
||||
colors = info->bmiHeader.biClrUsed;
|
||||
if (!colors && (info->bmiHeader.biBitCount <= 8))
|
||||
colors = 1 << info->bmiHeader.biBitCount;
|
||||
return sizeof(BITMAPINFOHEADER) + colors *
|
||||
((coloruse == DIB_RGB_COLORS) ? sizeof(RGBQUAD) : sizeof(WORD));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,41 +1,165 @@
|
|||
/* $Id: brush.c,v 1.5 1999/10/28 23:37:14 rex Exp $
|
||||
/* $Id: brush.c,v 1.6 1999/11/17 20:54:05 rex Exp $
|
||||
*/
|
||||
|
||||
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <ddk/ntddk.h>
|
||||
#include <win32k/bitmaps.h>
|
||||
#include <win32k/brush.h>
|
||||
#include <win32k/debug.h>
|
||||
|
||||
// #define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
HBRUSH W32kCreateBrushIndirect(CONST LOGBRUSH *lb)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
PBRUSHOBJ brushPtr;
|
||||
HBRUSH hBrush;
|
||||
|
||||
hBrush = BRUSHOBJ_AllocBrush ();
|
||||
if (hBrush == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
brushPtr = BRUSHOBJ_HandleToPtr (hBrush);
|
||||
brushPtr->logbrush.lbStyle = lb->lbStyle;
|
||||
brushPtr->logbrush.lbColor = lb->lbColor;
|
||||
brushPtr->logbrush.lbHatch = lb->lbHatch;
|
||||
BRUSHOBJ_UnlockBrush (hBrush);
|
||||
DPRINT("%08x\n", hBrush);
|
||||
|
||||
return hBrush;
|
||||
}
|
||||
|
||||
HBRUSH W32kCreateDIBPatternBrush(HGLOBAL hDIBPacked,
|
||||
UINT ColorSpec)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
#if 0
|
||||
LOGBRUSH logbrush;
|
||||
PBITMAPINFO info, newInfo;
|
||||
INT size;
|
||||
|
||||
DPRINT("%04x\n", hbitmap );
|
||||
|
||||
logbrush.lbStyle = BS_DIBPATTERN;
|
||||
logbrush.lbColor = coloruse;
|
||||
logbrush.lbHatch = 0;
|
||||
|
||||
/* Make a copy of the bitmap */
|
||||
if (!(info = (BITMAPINFO *)GlobalLock( hbitmap )))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if (info->bmiHeader.biCompression)
|
||||
size = info->bmiHeader.biSizeImage;
|
||||
else
|
||||
size = DIB_GetDIBImageBytes(info->bmiHeader.biWidth,
|
||||
info->bmiHeader.biHeight,
|
||||
info->bmiHeader.biBitCount);
|
||||
size += DIB_BitmapInfoSize( info, coloruse );
|
||||
|
||||
if (!(logbrush.lbHatch = (INT)GlobalAlloc16( GMEM_MOVEABLE, size )))
|
||||
{
|
||||
GlobalUnlock16( hbitmap );
|
||||
return 0;
|
||||
}
|
||||
newInfo = (BITMAPINFO *) GlobalLock16( (HGLOBAL16)logbrush.lbHatch );
|
||||
memcpy( newInfo, info, size );
|
||||
GlobalUnlock16( (HGLOBAL16)logbrush.lbHatch );
|
||||
GlobalUnlock( hbitmap );
|
||||
return W32kCreateBrushIndirect( &logbrush );
|
||||
#endif
|
||||
}
|
||||
|
||||
HBRUSH W32kCreateDIBPatternBrushPt(CONST VOID *PackedDIB,
|
||||
UINT Usage)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
INT size;
|
||||
LOGBRUSH logbrush;
|
||||
PBITMAPINFO info;
|
||||
PBITMAPINFO newInfo;
|
||||
|
||||
info = (BITMAPINFO *) PackedDIB;
|
||||
if (info == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
DPRINT ("%p %ldx%ld %dbpp\n",
|
||||
info,
|
||||
info->bmiHeader.biWidth,
|
||||
info->bmiHeader.biHeight,
|
||||
info->bmiHeader.biBitCount);
|
||||
|
||||
logbrush.lbStyle = BS_DIBPATTERN;
|
||||
logbrush.lbColor = Usage;
|
||||
logbrush.lbHatch = 0;
|
||||
|
||||
/* Make a copy of the bitmap */
|
||||
|
||||
if (info->bmiHeader.biCompression)
|
||||
{
|
||||
size = info->bmiHeader.biSizeImage;
|
||||
}
|
||||
else
|
||||
{
|
||||
size = DIB_GetDIBImageBytes (info->bmiHeader.biWidth,
|
||||
info->bmiHeader.biHeight,
|
||||
info->bmiHeader.biBitCount);
|
||||
}
|
||||
size += DIB_BitmapInfoSize (info, Usage);
|
||||
|
||||
logbrush.lbHatch = (INT)
|
||||
GDIOBJ_PtrToHandle (GDIOBJ_AllocObject (size, GO_MAGIC_DONTCARE),
|
||||
GO_MAGIC_DONTCARE);
|
||||
if (logbrush.lbHatch == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
newInfo = (PBITMAPINFO) GDIOBJ_HandleToPtr ((HGDIOBJ) logbrush.lbHatch,
|
||||
GO_MAGIC_DONTCARE);
|
||||
memcpy (newInfo, info, size);
|
||||
GDIOBJ_UnlockObject ((HGDIOBJ) logbrush.lbHatch);
|
||||
|
||||
return W32kCreateBrushIndirect (&logbrush);
|
||||
}
|
||||
|
||||
HBRUSH W32kCreateHatchBrush(INT Style,
|
||||
COLORREF Color)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
LOGBRUSH logbrush;
|
||||
|
||||
DPRINT("%d %06lx\n", Style, Color);
|
||||
|
||||
if (Style < 0 || Style >= NB_HATCH_STYLES)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
logbrush.lbStyle = BS_HATCHED;
|
||||
logbrush.lbColor = Color;
|
||||
logbrush.lbHatch = Style;
|
||||
|
||||
return W32kCreateBrushIndirect (&logbrush);
|
||||
}
|
||||
|
||||
HBRUSH W32kCreatePatternBrush(HBITMAP hBitmap)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
LOGBRUSH logbrush = { BS_PATTERN, 0, 0 };
|
||||
|
||||
DPRINT ("%04x\n", hBitmap);
|
||||
logbrush.lbHatch = (INT) BITMAPOBJ_CopyBitmap (hBitmap);
|
||||
if(!logbrush.lbHatch)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return W32kCreateBrushIndirect( &logbrush );
|
||||
}
|
||||
}
|
||||
|
||||
HBRUSH W32kCreateSolidBrush(COLORREF Color)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: dc.c,v 1.8 1999/10/31 22:43:40 ea Exp $
|
||||
/* $Id: dc.c,v 1.9 1999/11/17 20:54:05 rex Exp $
|
||||
*
|
||||
* DC.C - Device context functions
|
||||
*
|
||||
|
@ -92,7 +92,11 @@ HDC STDCALL W32kCreateCompatableDC(HDC hDC)
|
|||
HBITMAP hBitmap;
|
||||
|
||||
OrigDC = DC_HandleToPtr(hDC);
|
||||
|
||||
if (OrigDC == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Allocate a new DC based on the original DC's device */
|
||||
NewDC = DC_AllocDC(OrigDC->DriverName);
|
||||
if (NewDC == NULL)
|
||||
|
@ -268,13 +272,62 @@ BOOL STDCALL W32kDeleteDC(HDC DCHandle)
|
|||
UNIMPLEMENTED;
|
||||
|
||||
DCToDelete = DC_HandleToPtr(DCHandle);
|
||||
|
||||
/* FIXME: Verify that is is a valid handle */
|
||||
if (DCToDelete == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DCToDelete->DriverFunctions.DisableSurface(DCToDelete->PDev);
|
||||
DCToDelete->DriverFunctions.DisablePDev(DCToDelete->PDev);
|
||||
|
||||
DC_FreeDC(DCToDelete);
|
||||
/* First delete all saved DCs */
|
||||
while (DCToDelete->saveLevel)
|
||||
{
|
||||
PDC savedDC;
|
||||
HDC savedHDC;
|
||||
|
||||
savedHDC = GDIOBJ_GetNextObject (DCHandle, GO_DC_MAGIC);
|
||||
savedDC = DC_HandleToPtr (savedHDC);
|
||||
if (savedDC == NULL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
GDIOBJ_SetNextObject (DCHandle, GO_DC_MAGIC, GDIOBJ_GetNextObject (savedHDC, GO_DC_MAGIC));
|
||||
DCToDelete->saveLevel--;
|
||||
DC_UnlockDC (savedDC);
|
||||
W32kDeleteDC (savedHDC);
|
||||
}
|
||||
|
||||
/* Free GDI resources allocated to this DC */
|
||||
if (!(DCToDelete->w.flags & DC_SAVED))
|
||||
{
|
||||
DC_UnlockDC (DCToDelete);
|
||||
SelectObject (DCHandle, STOCK_BLACK_PEN);
|
||||
SelectObject (DCHandle, STOCK_WHITE_BRUSH);
|
||||
SelectObject (DCHandle, STOCK_SYSTEM_FONT);
|
||||
DC_LockDC (DCHandle);
|
||||
if (DCToDelete->w.flags & DC_MEMORY)
|
||||
{
|
||||
W32kDeleteObject (DCToDelete->w.hFirstBitmap);
|
||||
}
|
||||
}
|
||||
if (DCToDelete->w.hClipRgn)
|
||||
{
|
||||
W32kDeleteObject (DCToDelete->w.hClipRgn);
|
||||
}
|
||||
if (DCToDelete->w.hVisRgn)
|
||||
{
|
||||
W32kDeleteObject (DCToDelete->w.hVisRgn);
|
||||
}
|
||||
if (DCToDelete->w.hGCClipRgn)
|
||||
{
|
||||
W32kDeleteObject (DCToDelete->w.hGCClipRgn);
|
||||
}
|
||||
#if 0 /* FIXME */
|
||||
PATH_DestroyGdiPath (&DCToDelete->w.path);
|
||||
#endif
|
||||
|
||||
DC_FreeDC (DCToDelete);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -570,19 +623,19 @@ BOOL STDCALL W32kRestoreDC(HDC hDC, INT SaveLevel)
|
|||
success = TRUE;
|
||||
while (dc->saveLevel >= SaveLevel)
|
||||
{
|
||||
HDC hdcs = dc->header.hNext;
|
||||
HDC hdcs = GDIOBJ_GetNextObject (hDC, GO_DC_MAGIC);
|
||||
|
||||
dcs = DC_HandleToPtr(hdcs);
|
||||
dcs = DC_HandleToPtr (hdcs);
|
||||
if (dcs == NULL)
|
||||
{
|
||||
DC_UnlockDC(hDC);
|
||||
DC_UnlockDC (hDC);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
dc->header.hNext = dcs->header.hNext;
|
||||
GDIOBJ_SetNextObject (hDC, GO_DC_MAGIC, GDIOBJ_GetNextObject (hdcs, GO_DC_MAGIC));
|
||||
if (--dc->saveLevel < SaveLevel)
|
||||
{
|
||||
W32kSetDCState16(hDC, hdcs);
|
||||
W32kSetDCState16 (hDC, hdcs);
|
||||
#if 0
|
||||
if (!PATH_AssignGdiPath( &dc->w.path, &dcs->w.path ))
|
||||
{
|
||||
|
@ -592,9 +645,9 @@ BOOL STDCALL W32kRestoreDC(HDC hDC, INT SaveLevel)
|
|||
}
|
||||
#endif
|
||||
}
|
||||
W32kDeleteDC(hdcs);
|
||||
W32kDeleteDC (hdcs);
|
||||
}
|
||||
DC_UnlockDC(hDC);
|
||||
DC_UnlockDC (hDC);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
@ -605,19 +658,19 @@ INT STDCALL W32kSaveDC(HDC hDC)
|
|||
PDC dc, dcs;
|
||||
INT ret;
|
||||
|
||||
dc = DC_HandleToPtr(hDC);
|
||||
dc = DC_HandleToPtr (hDC);
|
||||
if (dc == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!(hdcs = W32kGetDCState16(hDC)))
|
||||
if (!(hdcs = W32kGetDCState16 (hDC)))
|
||||
{
|
||||
DC_UnlockDC(hDC);
|
||||
DC_UnlockDC (hDC);
|
||||
|
||||
return 0;
|
||||
}
|
||||
dcs = DC_HandleToPtr(hdcs);
|
||||
dcs = DC_HandleToPtr (hdcs);
|
||||
|
||||
#if 0
|
||||
/* Copy path. The reason why path saving / restoring is in SaveDC/
|
||||
|
@ -626,20 +679,20 @@ INT STDCALL W32kSaveDC(HDC hDC)
|
|||
* SetDCState doesn't allow us to signal an error (which can happen
|
||||
* when copying paths).
|
||||
*/
|
||||
if (!PATH_AssignGdiPath(&dcs->w.path, &dc->w.path))
|
||||
if (!PATH_AssignGdiPath (&dcs->w.path, &dc->w.path))
|
||||
{
|
||||
DC_UnlockDC(hdc);
|
||||
DC_UnlockDC(hdcs);
|
||||
W32kDeleteDC(hdcs);
|
||||
DC_UnlockDC (hdc);
|
||||
DC_UnlockDC (hdcs);
|
||||
W32kDeleteDC (hdcs);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
dcs->header.hNext = dc->header.hNext;
|
||||
dc->header.hNext = hdcs;
|
||||
GDIOBJ_SetNextObject (hdcs, GO_DC_MAGIC, GDIOBJ_GetNextObject (hDC, GO_DC_MAGIC));
|
||||
GDIOBJ_SetNextObject (hDC, GO_DC_MAGIC, hdcs);
|
||||
ret = ++dc->saveLevel;
|
||||
DC_UnlockDC(hdcs);
|
||||
DC_UnlockDC(hDC);
|
||||
DC_UnlockDC (hdcs);
|
||||
DC_UnlockDC (hDC);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -810,7 +863,7 @@ PDC DC_AllocDC(LPCWSTR Driver)
|
|||
wcslen(Driver) * sizeof(WCHAR));
|
||||
wcscpy(NewDC->DriverName, Driver);
|
||||
}
|
||||
|
||||
|
||||
return NewDC;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* GDIOBJ.C - GDI object manipulation routines
|
||||
*
|
||||
* $Id: gdiobj.c,v 1.3 1999/10/29 01:58:20 rex Exp $
|
||||
* $Id: gdiobj.c,v 1.4 1999/11/17 20:54:05 rex Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -14,40 +14,48 @@ PGDIOBJ GDIOBJ_AllocObject(WORD Size, WORD Magic)
|
|||
{
|
||||
PGDIOBJHDR NewObj;
|
||||
|
||||
NewObj = ExAllocatePool(NonPagedPool, Size);
|
||||
NewObj = ExAllocatePool(PagedPool, Size + sizeof (GDIOBJHDR));
|
||||
if (NewObj == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RtlZeroMemory(NewObj, Size);
|
||||
RtlZeroMemory(NewObj, Size + sizeof (GDIOBJHDR));
|
||||
NewObj->wMagic = Magic;
|
||||
#if 0
|
||||
KeInitializeSpinlock(&NewObj->Lock);
|
||||
#endif
|
||||
|
||||
return NewObj;
|
||||
return (PGDIOBJ)(((PCHAR) NewObj) + sizeof (GDIOBJHDR));
|
||||
}
|
||||
|
||||
HGDIOBJ GDIOBJ_PtrToHandle (PGDIOBJ Obj, WORD Magic)
|
||||
{
|
||||
if (((PGDIOBJHDR)Obj)->wMagic != Magic)
|
||||
PGDIOBJHDR objHeader;
|
||||
|
||||
objHeader = (PGDIOBJHDR) (((PCHAR)Obj) - sizeof (GDIOBJHDR));
|
||||
if (objHeader->wMagic != Magic)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (HGDIOBJ) Obj;
|
||||
return (HGDIOBJ) objHeader;
|
||||
}
|
||||
|
||||
PGDIOBJ GDIOBJ_HandleToPtr (HGDIOBJ Obj, WORD Magic)
|
||||
{
|
||||
PGDIOBJHDR objHeader;
|
||||
|
||||
objHeader = (PGDIOBJHDR) Obj;
|
||||
|
||||
/* FIXME: Lock object for duration */
|
||||
if (((PGDIOBJHDR)Obj)->wMagic != Magic)
|
||||
|
||||
if (objHeader->wMagic != Magic)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (PGDIOBJ) Obj;
|
||||
return (PGDIOBJ) (((PCHAR)Obj) + sizeof (GDIOBJHDR));
|
||||
}
|
||||
|
||||
BOOL GDIOBJ_LockObject (HGDIOBJ Obj)
|
||||
|
@ -62,3 +70,35 @@ BOOL GDIOBJ_UnlockObject (HGDIOBJ Obj)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
HGDIOBJ GDIOBJ_GetNextObject (HGDIOBJ Obj, WORD Magic)
|
||||
{
|
||||
PGDIOBJHDR objHeader;
|
||||
|
||||
objHeader = (PGDIOBJHDR) ((PCHAR) Obj - sizeof (GDIOBJHDR));
|
||||
if (objHeader->wMagic != Magic)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return objHeader->hNext;
|
||||
}
|
||||
|
||||
HGDIOBJ GDIOBJ_SetNextObject (HGDIOBJ Obj, WORD Magic, HGDIOBJ NextObj)
|
||||
{
|
||||
PGDIOBJHDR objHeader;
|
||||
HGDIOBJ oldNext;
|
||||
|
||||
/* FIXME: should we lock/unlock the object here? */
|
||||
objHeader = (PGDIOBJHDR) ((PCHAR) Obj - sizeof (GDIOBJHDR));
|
||||
if (objHeader->wMagic != Magic)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
oldNext = objHeader->hNext;
|
||||
objHeader->hNext = NextObj;
|
||||
|
||||
return oldNext;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#undef WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <ddk/ntddk.h>
|
||||
#include <win32k/debug.h>
|
||||
#include <win32k/paint.h>
|
||||
|
||||
// #define NDEBUG
|
||||
|
@ -27,7 +28,8 @@ UINT W32kGetBoundsRect(HDC hDC,
|
|||
LPRECT Bounds,
|
||||
UINT Flags)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
FIXME("stub");
|
||||
return DCB_RESET; /* bounding rectangle always empty */
|
||||
}
|
||||
|
||||
COLORREF W32kSetBkColor(HDC hDC,
|
||||
|
@ -40,6 +42,7 @@ UINT W32kSetBoundsRect(HDC hDC,
|
|||
CONST PRECT Bounds,
|
||||
UINT Flags)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
FIXME("stub");
|
||||
return DCB_DISABLE; /* bounding rectangle always empty */
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue