{
HPEN Pen;
int x, y;
-
+
Pen = CreatePen(PS_SOLID, 1, RGB(64, 64, 128));
SelectObject (Desktop, Pen);
}
}
-int main (void)
-{
+void gditest( void ){
HDC Desktop, MyDC, DC24;
HPEN RedPen, GreenPen, BluePen, WhitePen;
HBITMAP MyBitmap, DIB24;
BITMAPINFOHEADER BitInf;
BITMAPINFO BitPalInf;
- printf("Entering GDITest..\n");
-
- GdiDllInitialize (NULL, DLL_PROCESS_ATTACH, NULL);
-
// Set up a DC called Desktop that accesses DISPLAY
Desktop = CreateDCA("DISPLAY", NULL, NULL, NULL);
- if (Desktop == NULL)
- return 1;
+ if (Desktop == NULL){
+ printf("Can't create desktop\n");
+ return;
+ }
// Background
Background (Desktop);
// Free up everything
DeleteDC(Desktop);
DeleteDC(MyDC);
+}
+
+void DumpRgnData( HRGN hRgn )
+{
+ int size, ret, i;
+ LPRGNDATA rgnData;
+
+ size = GetRegionData( hRgn, 0, NULL );
+ if( size == 0 ){
+ printf("GetRegionData returned 0\n");
+ return;
+ }
+ rgnData = (LPRGNDATA) malloc( size );
+ ret = GetRegionData( hRgn, size, rgnData );
+ if( ret == 0 ){
+ printf("GetRegionData( hRgn, size, rgnData ) returned 0\n");
+ return;
+ }
+ printf("Bounds: left=%d top=%d right=%d bottom=%d, count: %d, type: %i\n\n",
+ rgnData->rdh.rcBound.left, rgnData->rdh.rcBound.top, rgnData->rdh.rcBound.right, rgnData->rdh.rcBound.bottom,
+ rgnData->rdh.nCount, rgnData->rdh.iType);
+ printf("Rects:\t i \t left \t top \t right \t bottom\n");
+ for ( i = 0; i < rgnData->rdh.nCount; i++ ) {
+ PRECT pr = (PRECT) rgnData->Buffer + i;
+ printf("\t %d \t %d \t %d \t %d \t %d\n", i, pr->left, pr->top, pr->right, pr->bottom );
+ }
+ printf("\n");
+}
+
+void rgntest( void )
+{
+ HRGN hRgn1, hRgn2, hRgn3;
+ RECT Rect;
+ int i;
+
+ hRgn1 = CreateRectRgn( 1, 1, 100, 100 );
+ if( hRgn1 == NULL ) {
+ printf("Failed at hRgn1 = CreateRectRgn( 1, 1, 100, 100 )\n");
+ return;
+ }
+ i = GetRgnBox( hRgn1, &Rect );
+ if( i==0 ){
+ printf("Failed GetRgnBox( hRgn1, &Rect )\n");
+ return;
+ }
+ printf("GetRgnBox( hRgn1, &Rect ): i=%d, left=%d top=%d right=%d bottom=%d\n\n",
+ i, Rect.left, Rect.top, Rect.right, Rect.bottom );
+
+ DumpRgnData( hRgn1 );
+
+ hRgn2 = CreateRectRgn( 51, 51, 150, 150 );
+ if( hRgn2 == NULL ) {
+ printf("Failed at hRgn2 = CreateRectRgn( 51, 51, 150, 150 )\n");
+ return;
+ }
+ i = GetRgnBox( hRgn2, &Rect );
+ if( i==0 ){
+ printf("Failed GetRgnBox( hRgn2, &Rect )\n");
+ return;
+ }
+ printf("GetRgnBox( hRgn2, &Rect ): i=%d, left=%d top=%d right=%d bottom=%d\n\n",
+ i, Rect.left, Rect.top, Rect.right, Rect.bottom );
+
+ DumpRgnData( hRgn2 );
+
+ if( EqualRgn( hRgn1, hRgn2 ) == TRUE ){
+ printf("\t hRgn1, hRgn2 are equal\n");
+ }
+ else{
+ printf("\t hRgn1, hRgn2 are NOT equal\n\n");
+ }
+
+ i = OffsetRgn(hRgn1,50,50);
+ if( i==ERROR ){
+ printf("Failed OffsetRgn(hRgn1,50,50)\n");
+ return;
+ }
+
+ i = GetRgnBox( hRgn1, &Rect );
+ if( i==0 ){
+ printf("Failed GetRgnBox( hRgn1, &Rect )\n");
+ return;
+ }
+ printf("After offset\nGetRgnBox( hRgn1, &Rect ): i=%d, left=%d top=%d right=%d bottom=%d\n\n",
+ i, Rect.left, Rect.top, Rect.right, Rect.bottom );
+
+ if( EqualRgn( hRgn1, hRgn2 ) == TRUE ){
+ printf("\t hRgn1, hRgn2 are equal after offset\n");
+ }
+ else{
+ printf("\t hRgn1, hRgn2 are NOT equal after offset!\n\n");
+ }
+
+ i = SetRectRgn(hRgn1, 10, 10, 110, 110 );
+ if( i==0 ){
+ printf("Failed SetRectRgn(hRgn1... )\n");
+ return;
+ }
+ i = GetRgnBox( hRgn1, &Rect );
+ if( i==0 ){
+ printf("Failed GetRgnBox( hRgn1, &Rect )\n");
+ return;
+ }
+ printf("after SetRectRgn(hRgn1, 10, 10, 110, 110 ):\n i=%d, left=%d top=%d right=%d bottom=%d\n\n",
+ i, Rect.left, Rect.top, Rect.right, Rect.bottom );
+
+ hRgn3 = CreateRectRgn( 1, 1, 1, 1);
+ i = CombineRgn( hRgn3, hRgn1, hRgn2, RGN_AND );
+ if( i==ERROR ){
+ printf("Fail: CombineRgn( hRgn3, hRgn1, hRgn2, RGN_AND ). LastError: %d\n", GetLastError);
+ return;
+ }
+
+ if( GetRgnBox( hRgn3, &Rect )==0 ){
+ printf("Failed GetRgnBox( hRgn1, &Rect )\n");
+ return;
+ }
+ printf("After CombineRgn( hRgn3, hRgn1, hRgn2, RGN_AND ): \nGetRgnBox( hRgn3, &Rect ): CR_i=%d, left=%d top=%d right=%d bottom=%d\n\n",
+ i, Rect.left, Rect.top, Rect.right, Rect.bottom );
+ DumpRgnData( hRgn3 );
+/*
+ i = CombineRgn( hRgn3, hRgn1, hRgn2, RGN_OR );
+ if( i==ERROR ){
+ printf("Fail: CombineRgn( hRgn3, hRgn1, hRgn2, RGN_OR ). LastError: %d\n", GetLastError);
+ return;
+ }
+
+ if( GetRgnBox( hRgn3, &Rect )==0 ){
+ printf("Failed GetRgnBox( hRgn1, &Rect )\n");
+ return;
+ }
+ printf("After CombineRgn( hRgn3, hRgn1, hRgn2, RGN_OR ): \nGetRgnBox( hRgn3, &Rect ): CR_i=%d, left=%d top=%d right=%d bottom=%d\n\n",
+ i, Rect.left, Rect.top, Rect.right, Rect.bottom );
+ DumpRgnData( hRgn3 );
+*/
+ DeleteObject( hRgn1 );
+ DeleteObject( hRgn2 );
+ DeleteObject( hRgn3 );
+ printf("region test finished\n");
+}
+
+int main (int argc, char* argv[])
+{
+ printf("Entering GDITest..\n");
+ printf("use gditest for older tests\n");
+ printf("use gditest 1 for region test\n");
+
+ GdiDllInitialize (NULL, DLL_PROCESS_ATTACH, NULL);
+ if( argc < 2 )
+ gditest();
+ else {
+ if( !strncmp( argv[1], "1", 1 ) ) {
+ rgntest();
+ }
+ }
+
return 0;
}
#W32kGetRandomRgn ?
W32kGetRasterizerCaps 2
W32kGetRelAbs 1
+W32kGetRegionData 3
W32kGetRgnBox 2
W32kGetStockObject 1
W32kGetStretchBltMode 1
NtUserWindowFromPoint 2
NtUserYieldTask 0
# ReactOS only system calls
-NtUserAcquireOrReleaseInputOwnership 1
\ No newline at end of file
+NtUserAcquireOrReleaseInputOwnership 1
typedef struct _RGNDATA {
RGNDATAHEADER rdh;
- char* Buffer;
+ char Buffer[1];
} RGNDATA, *PRGNDATA, *LPRGNDATA;
typedef struct tagSCROLLINFO {
#include <win32k/gdiobj.h>
+//Internal region data. Can't use RGNDATA structure because buffer is allocated statically
+typedef struct _ROSRGNDATA {
+ RGNDATAHEADER rdh;
+ char* Buffer;
+} ROSRGNDATA, *PROSRGNDATA, *LPROSRGNDATA;
+
+
#define RGNDATA_FreeRgn(hRgn) GDIOBJ_FreeObj((HGDIOBJ)hRgn, GO_REGION_MAGIC)
-#define RGNDATA_LockRgn(hRgn) ((PRGNDATA)GDIOBJ_LockObj((HGDIOBJ)hRgn, GO_REGION_MAGIC))
+#define RGNDATA_LockRgn(hRgn) ((PROSRGNDATA)GDIOBJ_LockObj((HGDIOBJ)hRgn, GO_REGION_MAGIC))
#define RGNDATA_UnlockRgn(hRgn) GDIOBJ_UnlockObj((HGDIOBJ)hRgn, GO_REGION_MAGIC)
HRGN RGNDATA_AllocRgn(INT n);
-BOOL RGNDATA_InternalDelete( PRGNDATA Obj );
+BOOL RGNDATA_InternalDelete( PROSRGNDATA Obj );
/* User entry points */
HRGN STDCALL
STDCALL
W32kExtCreateRegion(CONST PXFORM Xform,
DWORD Count,
- CONST PRGNDATA RgnData);
+ CONST PROSRGNDATA RgnData);
BOOL
STDCALL
INT RightRect,
INT BottomRect);
+DWORD
+STDCALL
+W32kGetRegionData(HRGN hrgn,
+ DWORD count,
+ LPRGNDATA rgndata);
#endif
-# $Id: makefile,v 1.19 2001/08/21 20:13:06 chorns Exp $
+# $Id: makefile,v 1.20 2002/07/22 07:55:48 ei Exp $
PATH_TO_TOP = ../..
MISC_OBJECTS = misc/stubs.o misc/stubsa.o misc/stubsw.o misc/win32k.o
-OBJECTS_OBJECTS = objects/dc.o objects/line.o objects/pen.o objects/bitblt.o objects/text.o
+OBJECTS_OBJECTS = objects/dc.o objects/line.o objects/pen.o objects/bitblt.o objects/text.o objects/region.o
OBJECTS = $(MAIN_OBJECTS) $(MISC_OBJECTS) $(OBJECTS_OBJECTS)
-/* $Id: stubs.c,v 1.6 2001/08/02 20:20:17 phreak Exp $
+/* $Id: stubs.c,v 1.7 2002/07/22 07:55:48 ei Exp $
*
* reactos/lib/gdi32/misc/stubs.c
*
-int
-STDCALL
-CombineRgn(
- HRGN a0,
- HRGN a1,
- HRGN a2,
- int a3
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
-
-
HBRUSH
STDCALL
CreateBrushIndirect(
-HRGN
-STDCALL
-CreatePolyPolygonRgn(
- CONST POINT *a0,
- CONST INT *a1,
- int a2,
- int a3
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
-
-
-HBRUSH
-STDCALL
-CreatePatternBrush(
- HBITMAP a0
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
-
-
-HRGN
-STDCALL
-CreateRectRgn(
- int a0,
- int a1,
- int a2,
- int a3
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
-
-
-HRGN
-STDCALL
-CreateRectRgnIndirect(
- CONST RECT *a0
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
-
-
-HRGN
-STDCALL
-CreateRoundRectRgn(
- int a0,
- int a1,
- int a2,
- int a3,
- int a4,
- int a5
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
HBRUSH
STDCALL
-BOOL
-STDCALL
-DeleteObject(
- HGDIOBJ a0
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return FALSE;
-}
-
-
-
int
STDCALL
DescribePixelFormat(
-BOOL
-STDCALL
-EqualRgn(
- HRGN a0,
- HRGN a1
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return FALSE;
-}
-
-
-
int
STDCALL
Escape(
-DWORD
-STDCALL
-GetRegionData(
- HRGN a0,
- DWORD a1,
- LPRGNDATA a2
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
-
-
-int
-STDCALL
-GetRgnBox(
- HRGN a0,
- LPRECT a1
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
-
-
HGDIOBJ
STDCALL
GetStockObject(
}
-
-int
-STDCALL
-OffsetRgn(
- HRGN a0,
- int a1,
- int a2
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
-
-
BOOL
STDCALL
PatBlt(
-DWORD
-STDCALL
+DWORD
+STDCALL
SetMapperFlags(
- HDC a0,
+ HDC a0,
DWORD a1
)
{
}
-
-int
-STDCALL
+
+int
+STDCALL
SetGraphicsMode(
- HDC hdc,
+ HDC hdc,
int iMode
)
{
}
-
-HMETAFILE
-STDCALL
+
+HMETAFILE
+STDCALL
SetMetaFileBitsEx(
- UINT a0,
+ UINT a0,
CONST BYTE *a1
)
{
}
-
-UINT
-STDCALL
+
+UINT
+STDCALL
SetPaletteEntries(
- HPALETTE a0,
- UINT a1,
- UINT a2,
+ HPALETTE a0,
+ UINT a1,
+ UINT a2,
CONST PALETTEENTRY *a3
)
{
}
-
-BOOL
-STDCALL
+
+BOOL
+STDCALL
SetPixelV(
HDC a0,
- int a1,
- int a2,
+ int a1,
+ int a2,
COLORREF a3
)
{
}
-
-BOOL
-STDCALL
+
+BOOL
+STDCALL
SetPixelFormat(
- HDC a0,
- int a1,
+ HDC a0,
+ int a1,
CONST PIXELFORMATDESCRIPTOR *a2
)
{
}
-
-int
-STDCALL
+
+int
+STDCALL
SetPolyFillMode(
- HDC a0,
+ HDC a0,
int a1
)
{
}
-
-BOOL
-STDCALL
+
+BOOL
+STDCALL
StretchBlt(
- HDC a0,
- int a1,
- int a2,
- int a3,
- int a4,
- HDC a5,
- int a6,
- int a7,
- int a8,
- int a9,
+ HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ HDC a5,
+ int a6,
+ int a7,
+ int a8,
+ int a9,
DWORD a10
)
{
}
-
-BOOL
-STDCALL
-SetRectRgn(
- HRGN a0,
- int a1,
- int a2,
- int a3,
- int a4
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return FALSE;
-}
-
-
-int
-STDCALL
+int
+STDCALL
SetROP2(
- HDC a0,
+ HDC a0,
int a1
)
{
}
-
-int
-STDCALL
+
+int
+STDCALL
SetStretchBltMode(
- HDC a0,
+ HDC a0,
int a1
)
{
}
-
-UINT
-STDCALL
+
+UINT
+STDCALL
SetSystemPaletteUse(
- HDC a0,
+ HDC a0,
UINT a1
)
{
}
-
-int
-STDCALL
+
+int
+STDCALL
SetTextCharacterExtra(
- HDC a0,
+ HDC a0,
int a1
)
{
}
-
-UINT
-STDCALL
+
+UINT
+STDCALL
SetTextAlign(
- HDC a0,
+ HDC a0,
UINT a1
)
{
}
-
-BOOL
-STDCALL
+
+BOOL
+STDCALL
SetTextJustification(
HDC a0,
int a1,
}
-
-BOOL
-STDCALL
+
+BOOL
+STDCALL
UpdateColors(
HDC hdc
)
}
-
-BOOL
-STDCALL
+
+BOOL
+STDCALL
PlayMetaFileRecord(
- HDC a0,
- LPHANDLETABLE a1,
- LPMETARECORD a2,
+ HDC a0,
+ LPHANDLETABLE a1,
+ LPMETARECORD a2,
UINT a3
)
{
}
-
-BOOL
-STDCALL
+
+BOOL
+STDCALL
EnumMetaFile(
- HDC a0,
- HMETAFILE a1,
- ENUMMETAFILEPROC a2,
+ HDC a0,
+ HMETAFILE a1,
+ ENUMMETAFILEPROC a2,
LPARAM a3
)
{
}
-
-HENHMETAFILE
-STDCALL
+
+HENHMETAFILE
+STDCALL
CloseEnhMetaFile(
HDC hdc
)
}
-
-BOOL
-STDCALL
+
+BOOL
+STDCALL
DeleteEnhMetaFile(
HENHMETAFILE a0
)
}
-
-BOOL
-STDCALL
+
+BOOL
+STDCALL
EnumEnhMetaFile(
HDC a0,
HENHMETAFILE a1,
return W32kSelectObject(hDC, hGDIObj);
}
-int
-STDCALL
+int
+STDCALL
SetMapMode(
- HDC a0,
+ HDC a0,
int a1
)
{
{
return W32kSetWindowOrgEx( a0, a1, a2, a3 );
}
+
+
+BOOL
+STDCALL
+DeleteObject(
+ HGDIOBJ a0
+ )
+{
+ return W32kDeleteObject(a0);
+}
HRGN WINAPI SaveVisRgn(HDC hdc)
{
HRGN copy;
- PRGNDATA obj, copyObj;
+ PROSRGNDATA obj, copyObj;
PDC dc = DC_HandleToPtr(hdc);
if (!dc) return 0;
/*
* GDIOBJ.C - GDI object manipulation routines
*
- * $Id: gdiobj.c,v 1.13 2002/07/18 21:59:18 ei Exp $
+ * $Id: gdiobj.c,v 1.14 2002/07/22 07:55:48 ei Exp $
*
*/
#include <win32k/text.h>
#include <win32k/dc.h>
#include <win32k/bitmaps.h>
-//#define NDEBUG
+#include <win32k/region.h>
+#define NDEBUG
#include <win32k/debug1.h>
// GDI stock objects
{
//DPRINT("GDIOBJ_iGetHandleEntryForIndex: TableIndex: %d,\n handle: %x, ptr: %x\n", TableIndex, HandleTable->Handles [TableIndex], &(HandleTable->Handles [TableIndex]) );
//DPRINT("GIG: HandleTable: %x, Handles: %x, \n TableIndex: %x, pt: %x\n", HandleTable, HandleTable->Handles, TableIndex, ((PGDI_HANDLE_ENTRY)HandleTable->Handles+TableIndex));
- DPRINT("GIG: Hndl: %x, mag: %x\n", ((PGDI_HANDLE_ENTRY)HandleTable->Handles+TableIndex), ((PGDI_HANDLE_ENTRY)HandleTable->Handles+TableIndex)->wMagic);
+ //DPRINT("GIG: Hndl: %x, mag: %x\n", ((PGDI_HANDLE_ENTRY)HandleTable->Handles+TableIndex), ((PGDI_HANDLE_ENTRY)HandleTable->Handles+TableIndex)->wMagic);
return ((PGDI_HANDLE_ENTRY)HandleTable->Handles+TableIndex);
}
Obj = (PGDIOBJ)((PCHAR)handleEntry->pObject + sizeof(GDIOBJHDR));
switch( handleEntry->wMagic ){
case GO_REGION_MAGIC:
- bRet = RGNDATA_InternalDelete( (PRGNDATA) Obj );
+ bRet = RGNDATA_InternalDelete( (PROSRGNDATA) Obj );
break;
case GO_PEN_MAGIC:
case GO_PALETTE_MAGIC:
#include <win32k/line.h>
#include <win32k/path.h>
#include <win32k/pen.h>
+#include <win32k/region.h>
// #define NDEBUG
#include <win32k/debug1.h>
SURFOBJ *SurfObj = (SURFOBJ*)AccessUserObject(dc->Surface);
BOOL ret;
PPENOBJ pen;
- PRGNDATA reg;
+ PROSRGNDATA reg;
if(!dc) return FALSE;
ret = PATH_LineTo(hDC, XEnd, YEnd);
} else {
pen = (PPENOBJ) GDIOBJ_LockObj(dc->w.hPen, GO_PEN_MAGIC);
- reg = (PRGNDATA)GDIOBJ_LockObj(dc->w.hGCClipRgn, GO_REGION_MAGIC);
+ reg = (PROSRGNDATA)GDIOBJ_LockObj(dc->w.hGCClipRgn, GO_REGION_MAGIC);
ASSERT( pen );
// not yet implemented ASSERT( reg );
/*
* Check to see if there is enough memory in the present region.
*/
-static inline int xmemcheck(RGNDATA *reg, LPRECT *rect, LPRECT *firstrect ) {
+static inline int xmemcheck(ROSRGNDATA *reg, LPRECT *rect, LPRECT *firstrect ) {
if ( (reg->rdh.nCount+1)*sizeof( RECT ) >= reg->rdh.nRgnSize ) {
PRECT temp;
temp = ExAllocatePool( PagedPool, (2 * (reg->rdh.nRgnSize)));
struct _POINTBLOCK *next;
} POINTBLOCK;
-static BOOL REGION_CopyRegion(PRGNDATA dst, PRGNDATA src)
+static BOOL REGION_CopyRegion(PROSRGNDATA dst, PROSRGNDATA src)
{
if(dst != src) // don't want to copy to itself
{
return TRUE;
}
-static void REGION_SetExtents (RGNDATA *pReg)
+static void REGION_SetExtents (ROSRGNDATA *pReg)
{
RECT *pRect, *pRectEnd, *pExtents;
/***********************************************************************
* REGION_CropAndOffsetRegion
*/
-static BOOL REGION_CropAndOffsetRegion(const PPOINT off, const PRECT rect, PRGNDATA rgnSrc, PRGNDATA rgnDst)
+static BOOL REGION_CropAndOffsetRegion(const PPOINT off, const PRECT rect, PROSRGNDATA rgnSrc, PROSRGNDATA rgnDst)
{
if(!rect) // just copy and offset
{
INT i;
if(rgnDst != rgnSrc)
- RtlCopyMemory(rgnDst, rgnSrc, sizeof(RGNDATA));
+ RtlCopyMemory(rgnDst, rgnSrc, sizeof(ROSRGNDATA));
if(off->x || off->y)
{
*
* Returns: hDst if success, 0 otherwise.
*/
-HRGN REGION_CropRgn(HRGN hDst, HRGN hSrc, const PRECT lpRect, const PPOINT lpPt)
+HRGN REGION_CropRgn(HRGN hDst, HRGN hSrc, const PRECT lpRect, PPOINT lpPt)
{
- PRGNDATA objSrc = RGNDATA_LockRgn(hSrc);
+ PROSRGNDATA objSrc = RGNDATA_LockRgn(hSrc);
HRGN hNewDst;
if(objSrc)
{
- PRGNDATA rgnDst;
+ PROSRGNDATA rgnDst;
if(hDst)
{
*
*/
static INT REGION_Coalesce (
- PRGNDATA pReg, /* Region to coalesce */
+ PROSRGNDATA pReg, /* Region to coalesce */
INT prevStart, /* Index of start of previous band */
INT curStart /* Index of start of current band */
) {
*
*/
static void REGION_RegionOp(
- RGNDATA *newReg, /* Place to store result */
- RGNDATA *reg1, /* First region in operation */
- RGNDATA *reg2, /* 2nd region in operation */
+ ROSRGNDATA *newReg, /* Place to store result */
+ ROSRGNDATA *reg1, /* First region in operation */
+ ROSRGNDATA *reg2, /* 2nd region in operation */
void (*overlapFunc)(), /* Function to call for over-lapping bands */
void (*nonOverlap1Func)(), /* Function to call for non-overlapping bands in region 1 */
void (*nonOverlap2Func)() /* Function to call for non-overlapping bands in region 2 */
* Rectangles may be added to the region.
*
*/
-static void REGION_IntersectO(RGNDATA *pReg, RECT *r1, RECT *r1End,
+static void REGION_IntersectO(ROSRGNDATA *pReg, RECT *r1, RECT *r1End,
RECT *r2, RECT *r2End, INT top, INT bottom)
{
/***********************************************************************
* REGION_IntersectRegion
*/
-static void REGION_IntersectRegion(RGNDATA *newReg, RGNDATA *reg1,
- RGNDATA *reg2)
+static void REGION_IntersectRegion(ROSRGNDATA *newReg, ROSRGNDATA *reg1,
+ ROSRGNDATA *reg2)
{
/* check for trivial reject */
if ( (!(reg1->rdh.nCount)) || (!(reg2->rdh.nCount)) ||
* with the rectangles we're passed.
*
*/
-static void REGION_UnionNonO (RGNDATA *pReg, RECT *r, RECT *rEnd,
+static void REGION_UnionNonO (ROSRGNDATA *pReg, RECT *r, RECT *rEnd,
INT top, INT bottom)
{
RECT *pNextRect;
* be changed.
*
*/
-static void REGION_UnionO (RGNDATA *pReg, RECT *r1, RECT *r1End,
+static void REGION_UnionO (ROSRGNDATA *pReg, RECT *r1, RECT *r1End,
RECT *r2, RECT *r2End, INT top, INT bottom)
{
RECT *pNextRect;
/***********************************************************************
* REGION_UnionRegion
*/
-static void REGION_UnionRegion(RGNDATA *newReg, RGNDATA *reg1,
- RGNDATA *reg2)
+static void REGION_UnionRegion(ROSRGNDATA *newReg, ROSRGNDATA *reg1,
+ ROSRGNDATA *reg2)
{
/* checks all the simple cases */
* pReg may be affected.
*
*/
-static void REGION_SubtractNonO1 (RGNDATA *pReg, RECT *r, RECT *rEnd,
+static void REGION_SubtractNonO1 (ROSRGNDATA *pReg, RECT *r, RECT *rEnd,
INT top, INT bottom)
{
RECT *pNextRect;
* pReg may have rectangles added to it.
*
*/
-static void REGION_SubtractO (RGNDATA *pReg, RECT *r1, RECT *r1End,
+static void REGION_SubtractO (ROSRGNDATA *pReg, RECT *r1, RECT *r1End,
RECT *r2, RECT *r2End, INT top, INT bottom)
{
RECT *pNextRect;
* regD is overwritten.
*
*/
-static void REGION_SubtractRegion(RGNDATA *regD, RGNDATA *regM,
- RGNDATA *regS )
+static void REGION_SubtractRegion(ROSRGNDATA *regD, ROSRGNDATA *regM,
+ ROSRGNDATA *regS )
{
/* check for trivial reject */
if ( (!(regM->rdh.nCount)) || (!(regS->rdh.nCount)) ||
/***********************************************************************
* REGION_XorRegion
*/
-static void REGION_XorRegion(RGNDATA *dr, RGNDATA *sra,
- RGNDATA *srb)
+static void REGION_XorRegion(ROSRGNDATA *dr, ROSRGNDATA *sra,
+ ROSRGNDATA *srb)
{
HRGN htra, htrb;
- RGNDATA *tra, *trb;
+ ROSRGNDATA *tra, *trb;
if ((! (htra = RGNDATA_AllocRgn(sra->rdh.nCount + 1))) ||
(! (htrb = RGNDATA_AllocRgn(srb->rdh.nCount + 1))))
* REGION_UnionRectWithRegion
* Adds a rectangle to a WINEREGION
*/
-static void REGION_UnionRectWithRegion(const RECT *rect, RGNDATA *rgn)
+static void REGION_UnionRectWithRegion(const RECT *rect, ROSRGNDATA *rgn)
{
- RGNDATA region;
+ ROSRGNDATA region;
region.Buffer = (char*)(&(region.rdh.rcBound));
region.rdh.nCount = 1;
BOOL REGION_LPTODP(HDC hdc, HRGN hDest, HRGN hSrc)
{
RECT *pCurRect, *pEndRect;
- PRGNDATA srcObj = NULL;
- PRGNDATA destObj = NULL;
+ PROSRGNDATA srcObj = NULL;
+ PROSRGNDATA destObj = NULL;
DC * dc = DC_HandleToPtr(hdc);
RECT tmpRect;
goto done;
}
- if(!( srcObj = (PRGNDATA) RGNDATA_LockRgn( hSrc ) ))
+ if(!( srcObj = (PROSRGNDATA) RGNDATA_LockRgn( hSrc ) ))
goto done;
- if(!( destObj = (PRGNDATA) RGNDATA_LockRgn( hDest ) ))
+ if(!( destObj = (PROSRGNDATA) RGNDATA_LockRgn( hDest ) ))
{
RGNDATA_UnlockRgn( hSrc );
goto done;
HRGN RGNDATA_AllocRgn(INT n)
{
HRGN hReg;
- PRGNDATA pReg;
+ PROSRGNDATA pReg;
BOOL bRet;
- if((hReg = (HRGN)GDIOBJ_AllocObj(sizeof(RGNDATA), GO_REGION_MAGIC))){
+ if((hReg = (HRGN)GDIOBJ_AllocObj(sizeof(ROSRGNDATA), GO_REGION_MAGIC))){
if( (pReg = GDIOBJ_LockObj( hReg, GO_REGION_MAGIC )) ){
if ((pReg->Buffer = ExAllocatePool(PagedPool, n * sizeof(RECT)))){
+ EMPTY_REGION(pReg);
pReg->rdh.dwSize = sizeof(RGNDATAHEADER);
pReg->rdh.nCount = n;
pReg->rdh.nRgnSize = n*sizeof(RECT);
- EMPTY_REGION(pReg);
bRet = GDIOBJ_UnlockObj( hReg, GO_REGION_MAGIC );
ASSERT(bRet);
return NULL;
}
-BOOL RGNDATA_InternalDelete( PRGNDATA pRgn )
+BOOL RGNDATA_InternalDelete( PROSRGNDATA pRgn )
{
ASSERT(pRgn);
if(pRgn->Buffer)
INT CombineMode)
{
INT result = ERROR;
- PRGNDATA destRgn = RGNDATA_LockRgn(hDest);
+ PROSRGNDATA destRgn = RGNDATA_LockRgn(hDest);
if( destRgn ){
- PRGNDATA src1Rgn = RGNDATA_LockRgn(hSrc1);
+ PROSRGNDATA src1Rgn = RGNDATA_LockRgn(hSrc1);
if( src1Rgn ){
if (CombineMode == RGN_COPY)
}
else
{
- PRGNDATA src2Rgn = RGNDATA_LockRgn(hSrc2);
+ PROSRGNDATA src2Rgn = RGNDATA_LockRgn(hSrc2);
if( src2Rgn ){
switch (CombineMode)
{
INT BottomRect)
{
HRGN hRgn;
- PRGNDATA pRgnData;
+ PROSRGNDATA pRgnData;
PRECT pRect;
// Allocate region data structure with space for 1 RECT
W32kEqualRgn(HRGN hSrcRgn1,
HRGN hSrcRgn2)
{
- PRGNDATA rgn1, rgn2;
+ PROSRGNDATA rgn1, rgn2;
PRECT tRect1, tRect2;
int i;
BOOL bRet = FALSE;
STDCALL
W32kExtCreateRegion(CONST PXFORM Xform,
DWORD Count,
- CONST PRGNDATA RgnData)
+ CONST PROSRGNDATA RgnData)
{
HRGN hRgn;
W32kGetRgnBox(HRGN hRgn,
LPRECT pRect)
{
- PRGNDATA rgn = RGNDATA_LockRgn(hRgn);
+ PROSRGNDATA rgn = RGNDATA_LockRgn(hRgn);
DWORD ret;
if( rgn ){
INT XOffset,
INT YOffset)
{
- PRGNDATA rgn = RGNDATA_LockRgn(hRgn);
+ PROSRGNDATA rgn = RGNDATA_LockRgn(hRgn);
INT ret;
- if( !rgn )
+ DPRINT("W32kOffsetRgn: hRgn %d Xoffs %d Yoffs %d rgn %x\n", hRgn, XOffset, YOffset, rgn );
+
+ if( !rgn ){
+ DPRINT("W32kOffsetRgn: hRgn error\n");
return ERROR;
+ }
if(XOffset || YOffset) {
int nbox = rgn->rdh.nCount;
PRECT pbox = (PRECT)rgn->Buffer;
+ DPRINT("nbox %d, pbox %x\n", nbox, pbox);
if(nbox && pbox) {
while(nbox--) {
pbox->left += XOffset;
pbox->bottom += YOffset;
pbox++;
}
+ DPRINT("rgn->rdh.rcBound.left %d\n",rgn->rdh.rcBound.left);
rgn->rdh.rcBound.left += XOffset;
rgn->rdh.rcBound.right += XOffset;
rgn->rdh.rcBound.top += YOffset;
rgn->rdh.rcBound.bottom += YOffset;
+ DPRINT("after rgn->rdh.rcBound.left %d\n",rgn->rdh.rcBound.left);
}
}
ret = rgn->rdh.iType;
INT X,
INT Y)
{
- PRGNDATA rgn;
+ PROSRGNDATA rgn;
int i;
if( (rgn = RGNDATA_LockRgn(hRgn) ) )
W32kRectInRegion(HRGN hRgn,
CONST LPRECT unsaferc)
{
- PRGNDATA rgn;
+ PROSRGNDATA rgn;
PRECT pCurRect, pRectEnd;
PRECT rc;
BOOL bRet = FALSE;
INT RightRect,
INT BottomRect)
{
- PRGNDATA rgn;
+ PROSRGNDATA rgn;
PRECT firstRect;
W32kUnionRectWithRgn(HRGN hDest, const RECT* unsafeRect)
{
PRECT pRect;
- PRGNDATA pRgn;
+ PROSRGNDATA pRgn;
if( !NT_SUCCESS( MmCopyFromCaller( pRect, unsafeRect, sizeof( RECT ) ) ) )
return NULL;
RGNDATA_UnlockRgn( hDest );
return hDest;
}
+
+/***********************************************************************
+ * GetRegionData (GDI32.@)
+ *
+ * MSDN: GetRegionData, Return Values:
+ *
+ * "If the function succeeds and dwCount specifies an adequate number of bytes,
+ * the return value is always dwCount. If dwCount is too small or the function
+ * fails, the return value is 0. If lpRgnData is NULL, the return value is the
+ * required number of bytes.
+ *
+ * If the function fails, the return value is zero."
+ */
+DWORD STDCALL W32kGetRegionData(HRGN hrgn, DWORD count, LPRGNDATA rgndata)
+{
+ DWORD size;
+ PROSRGNDATA obj = RGNDATA_LockRgn( hrgn );
+
+ if(!obj)
+ return 0;
+
+ size = obj->rdh.nCount * sizeof(RECT);
+ if(count < (size + sizeof(RGNDATAHEADER)) || rgndata == NULL)
+ {
+ RGNDATA_UnlockRgn( hrgn );
+ if (rgndata) /* buffer is too small, signal it by return 0 */
+ return 0;
+ else /* user requested buffer size with rgndata NULL */
+ return size + sizeof(RGNDATAHEADER);
+ }
+
+ //first we copy the header then we copy buffer
+ if( !NT_SUCCESS( MmCopyToCaller( rgndata, obj, sizeof( RGNDATAHEADER )))){
+ RGNDATA_UnlockRgn( hrgn );
+ return 0;
+ }
+ if( !NT_SUCCESS( MmCopyToCaller( (char*)rgndata+sizeof( RGNDATAHEADER ), obj->Buffer, size ))){
+ RGNDATA_UnlockRgn( hrgn );
+ return 0;
+ }
+
+ RGNDATA_UnlockRgn( hrgn );
+ return size + sizeof(RGNDATAHEADER);
+}
+