mirror of
https://github.com/reactos/reactos.git
synced 2024-12-26 17:14:41 +00:00
Implemented some of gdi region functions.
svn path=/trunk/; revision=3262
This commit is contained in:
parent
52102e72fc
commit
8d9c181908
10 changed files with 5139 additions and 3419 deletions
|
@ -3450,7 +3450,7 @@ typedef struct _RGNDATAHEADER {
|
|||
|
||||
typedef struct _RGNDATA {
|
||||
RGNDATAHEADER rdh;
|
||||
char Buffer[1];
|
||||
char* Buffer;
|
||||
} RGNDATA, *PRGNDATA, *LPRGNDATA;
|
||||
|
||||
typedef struct tagSCROLLINFO {
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
#ifndef _WIN32K_CLIPRGN_H
|
||||
#define _WIN32K_CLIPRGN_H
|
||||
|
||||
HRGN WINAPI SaveVisRgn(HDC hdc);
|
||||
INT WINAPI SelectVisRgn(HDC hdc, HRGN hrgn);
|
||||
|
||||
int
|
||||
STDCALL
|
||||
W32kExcludeClipRect (
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
#ifndef __WIN32K_FLOAT_H
|
||||
#define __WIN32K_FLOAT_H
|
||||
|
||||
#include <win32k/math.h>
|
||||
#include <win32k/dc.h>
|
||||
#include <freetype/freetype.h>
|
||||
|
||||
typedef struct tagFLOAT_POINT
|
||||
{
|
||||
FLOAT x, y;
|
||||
|
@ -33,6 +40,7 @@ static inline void INTERNAL_LPTODP_FLOAT(DC *dc, FLOAT_POINT *point)
|
|||
/* Performs a viewport-to-world transformation on the specified point (which
|
||||
* is in integer format). Returns TRUE if successful, else FALSE.
|
||||
*/
|
||||
#if 0
|
||||
static inline BOOL INTERNAL_DPTOLP(DC *dc, LPPOINT point)
|
||||
{
|
||||
FLOAT_POINT floatPoint;
|
||||
|
@ -67,6 +75,10 @@ static inline void INTERNAL_LPTODP(DC *dc, LPPOINT point)
|
|||
point->y = GDI_ROUND(floatPoint.y);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#define MulDiv( x, y, z ) EngMulDiv( x, y, z )
|
||||
|
||||
#define XDPTOLP(dc,x) \
|
||||
(MulDiv(((x)-(dc)->vportOrgX), (dc)->wndExtX, (dc)->vportExtX) + (dc)->wndOrgX)
|
||||
#define YDPTOLP(dc,y) \
|
||||
|
@ -86,3 +98,5 @@ static inline void INTERNAL_LPTODP(DC *dc, LPPOINT point)
|
|||
MulDiv((x), (dc)->vportExtX, (dc)->wndExtX)
|
||||
#define YLSTODS(dc,y) \
|
||||
MulDiv((y), (dc)->vportExtY, (dc)->wndExtY)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2,32 +2,16 @@
|
|||
#ifndef __WIN32K_REGION_H
|
||||
#define __WIN32K_REGION_H
|
||||
|
||||
#include <structs.h>
|
||||
#include <win32k/gdiobj.h>
|
||||
|
||||
/* Internal functions */
|
||||
/*
|
||||
#define RGNDATA_PtrToHandle(pRgn) \
|
||||
((HRGN) GDIOBJ_PtrToHandle ((PGDIOBJ) pRgn, GO_REGION_MAGIC))
|
||||
*/
|
||||
#define RGNDATA_HandleToPtr(hRgn) \
|
||||
((RGNDATA *) GDIOBJ_LockObj ((HGDIOBJ) hRgn, GO_REGION_MAGIC))
|
||||
#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_UnlockRgn(hRgn) GDIOBJ_UnlockObj((HGDIOBJ)hRgn, GO_REGION_MAGIC)
|
||||
HRGN RGNDATA_AllocRgn(INT n);
|
||||
|
||||
/* call GDIOBJ_ReleaseObj when reference counting is added */
|
||||
#define RGNDATA_Release(hRgn) {}
|
||||
|
||||
/* GDI logical region object */
|
||||
typedef struct tagRGNOBJ
|
||||
{
|
||||
GDIOBJHDR header;
|
||||
RGNDATA* rgn;
|
||||
} RGNOBJ;
|
||||
BOOL RGNDATA_InternalDelete( PRGNDATA Obj );
|
||||
|
||||
/* User entry points */
|
||||
INT STDCALL
|
||||
W32kGetBoxRgn(HRGN hRgn, PRECT Rect);
|
||||
HRGN STDCALL
|
||||
W32kCropRgn(HRGN hDest, HRGN hSrc, const RECT* Rect, const POINT* Point);
|
||||
HRGN STDCALL
|
||||
W32kUnionRectWithRgn(HRGN hDest, const RECT* Rect);
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
double atan (double __x);
|
||||
double atan2 (double __y, double __x);
|
||||
|
@ -207,3 +208,50 @@ double tan (double __x)
|
|||
|
||||
return __value;
|
||||
}
|
||||
|
||||
//FIXME! Is there a better algorithm. like FT_MulDiv
|
||||
INT STDCALL EngMulDiv(
|
||||
INT nMultiplicand,
|
||||
INT nMultiplier,
|
||||
INT nDivisor)
|
||||
{
|
||||
#if SIZEOF_LONG_LONG >= 8
|
||||
long long ret;
|
||||
|
||||
if (!nDivisor) return -1;
|
||||
|
||||
/* We want to deal with a positive divisor to simplify the logic. */
|
||||
if (nDivisor < 0)
|
||||
{
|
||||
nMultiplicand = - nMultiplicand;
|
||||
nDivisor = -nDivisor;
|
||||
}
|
||||
|
||||
/* If the result is positive, we "add" to round. else, we subtract to round. */
|
||||
if ( ( (nMultiplicand < 0) && (nMultiplier < 0) ) ||
|
||||
( (nMultiplicand >= 0) && (nMultiplier >= 0) ) )
|
||||
ret = (((long long)nMultiplicand * nMultiplier) + (nDivisor/2)) / nDivisor;
|
||||
else
|
||||
ret = (((long long)nMultiplicand * nMultiplier) - (nDivisor/2)) / nDivisor;
|
||||
|
||||
if ((ret > 2147483647) || (ret < -2147483647)) return -1;
|
||||
return ret;
|
||||
#else
|
||||
if (!nDivisor) return -1;
|
||||
|
||||
/* We want to deal with a positive divisor to simplify the logic. */
|
||||
if (nDivisor < 0)
|
||||
{
|
||||
nMultiplicand = - nMultiplicand;
|
||||
nDivisor = -nDivisor;
|
||||
}
|
||||
|
||||
/* If the result is positive, we "add" to round. else, we subtract to round. */
|
||||
if ( ( (nMultiplicand < 0) && (nMultiplier < 0) ) ||
|
||||
( (nMultiplicand >= 0) && (nMultiplier >= 0) ) )
|
||||
return ((nMultiplicand * nMultiplier) + (nDivisor/2)) / nDivisor;
|
||||
|
||||
return ((nMultiplicand * nMultiplier) - (nDivisor/2)) / nDivisor;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: painting.c,v 1.1 2002/07/04 20:12:27 dwelch Exp $
|
||||
/* $Id: painting.c,v 1.2 2002/07/18 21:59:18 ei Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -23,6 +23,7 @@
|
|||
#include <user32/wininternal.h>
|
||||
#include <include/rect.h>
|
||||
#include <win32k/coord.h>
|
||||
#include <win32k/region.h>
|
||||
|
||||
|
||||
#define NDEBUG
|
||||
|
@ -173,11 +174,11 @@ PaintRedrawWindow(HWND hWnd, const RECT* UpdateRect, HRGN UpdateRgn,
|
|||
{
|
||||
if (Window->UpdateRegion != NULL)
|
||||
{
|
||||
hRgn = W32kCropRgn(0, UpdateRgn, NULL, &Pt);
|
||||
hRgn = REGION_CropRgn(0, UpdateRgn, NULL, &Pt);
|
||||
}
|
||||
else
|
||||
{
|
||||
Window->UpdateRegion = W32kCropRgn(0, UpdateRgn, &Rect, &Pt);
|
||||
Window->UpdateRegion = REGION_CropRgn(0, UpdateRgn, &Rect, &Pt);
|
||||
}
|
||||
}
|
||||
else if (UpdateRect != NULL)
|
||||
|
@ -329,7 +330,7 @@ PaintUpdateNCRegion(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
|
|||
Window->Flags &= ~WINDOWOBJECT_NEED_NCPAINT;
|
||||
if (Window->UpdateRegion > (HANDLE)1)
|
||||
{
|
||||
hRgnRet = W32kCropRgn(hRgn, Window->UpdateRegion, NULL, NULL);
|
||||
hRgnRet = REGION_CropRgn(hRgn, Window->UpdateRegion, NULL, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -355,7 +356,7 @@ PaintUpdateNCRegion(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
|
|||
Rect.right != ClientRect.right || Rect.right != ClientRect.right)
|
||||
{
|
||||
hClip = Window->UpdateRegion;
|
||||
Window->UpdateRegion = W32kCropRgn(hRgn, hClip,
|
||||
Window->UpdateRegion = REGION_CropRgn(hRgn, hClip,
|
||||
&Rect, NULL);
|
||||
if (Flags & UNC_REGION)
|
||||
{
|
||||
|
@ -365,7 +366,7 @@ PaintUpdateNCRegion(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
|
|||
|
||||
if (Flags & UNC_CHECK)
|
||||
{
|
||||
W32kGetBoxRgn(Window->UpdateRegion, &UpdateRegionBox);
|
||||
W32kGetRgnBox(Window->UpdateRegion, &UpdateRegionBox);
|
||||
if (W32kIsEmptyRect(&UpdateRegionBox))
|
||||
{
|
||||
W32kDeleteObject(Window->UpdateRegion);
|
||||
|
@ -377,7 +378,7 @@ PaintUpdateNCRegion(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
|
|||
|
||||
if (!hClip && Window->UpdateRegion && Flags & UNC_REGION)
|
||||
{
|
||||
hRgnRet = W32kCropRgn(hRgn, Window->UpdateRegion, NULL,
|
||||
hRgnRet = REGION_CropRgn(hRgn, Window->UpdateRegion, NULL,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
@ -398,7 +399,7 @@ PaintUpdateNCRegion(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
|
|||
{
|
||||
if (Window->UpdateRegion > (HANDLE)1 && Flags & UNC_REGION)
|
||||
{
|
||||
hRgnRet = W32kCropRgn(hRgn, Window->UpdateRegion, NULL, NULL);
|
||||
hRgnRet = REGION_CropRgn(hRgn, Window->UpdateRegion, NULL, NULL);
|
||||
}
|
||||
else if (Window->UpdateRegion == (HANDLE)1 && Flags & UNC_UPDATE)
|
||||
{
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <windows.h>
|
||||
#include <ddk/ntddk.h>
|
||||
#include <win32k/dc.h>
|
||||
#include <win32k/region.h>
|
||||
#include <win32k/cliprgn.h>
|
||||
|
||||
// #define NDEBUG
|
||||
|
@ -14,43 +15,39 @@ HRGN WINAPI SaveVisRgn(HDC hdc)
|
|||
HRGN copy;
|
||||
PRGNDATA obj, copyObj;
|
||||
PDC dc = DC_HandleToPtr(hdc);
|
||||
/*ei
|
||||
|
||||
if (!dc) return 0;
|
||||
|
||||
obj = RGNDATA_HandleToPtr(dc->w.hVisRgn);
|
||||
obj = RGNDATA_LockRgn(dc->w.hVisRgn);
|
||||
|
||||
if(!(copy = CreateRectRgn(0, 0, 0, 0)))
|
||||
if(!(copy = W32kCreateRectRgn(0, 0, 0, 0)))
|
||||
{
|
||||
GDI_ReleaseObj(dc->w.hVisRgn);
|
||||
GDI_ReleaseObj(hdc);
|
||||
RGNDATA_UnlockRgn(dc->w.hVisRgn);
|
||||
DC_ReleasePtr(hdc);
|
||||
return 0;
|
||||
}
|
||||
CombineRgn(copy, dc->w.hVisRgn, 0, RGN_COPY);
|
||||
copyObj = RGNDATA_HandleToPtr(copy);
|
||||
*/
|
||||
W32kCombineRgn(copy, dc->w.hVisRgn, 0, RGN_COPY);
|
||||
copyObj = RGNDATA_LockRgn(copy);
|
||||
/* copyObj->header.hNext = obj->header.hNext;
|
||||
header.hNext = copy; */
|
||||
DC_ReleasePtr( hdc );
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
INT16 WINAPI SelectVisRgn(HDC hdc, HRGN hrgn)
|
||||
INT WINAPI SelectVisRgn(HDC hdc, HRGN hrgn)
|
||||
{
|
||||
return ERROR;
|
||||
/*ei
|
||||
int retval;
|
||||
DC *dc;
|
||||
|
||||
if (!hrgn) return ERROR;
|
||||
if (!(dc = DC_HandleToPtr(hdc))) return ERROR;
|
||||
|
||||
dc->flags &= ~DC_DIRTY;
|
||||
dc->w.flags &= ~DC_DIRTY;
|
||||
|
||||
retval = CombineRgn(dc->hVisRgn, hrgn, 0, RGN_COPY);
|
||||
CLIPPING_UpdateGCRegion(dc);
|
||||
retval = W32kCombineRgn(dc->w.hVisRgn, hrgn, 0, RGN_COPY);
|
||||
//ei CLIPPING_UpdateGCRegion(dc);
|
||||
|
||||
return retval;
|
||||
*/
|
||||
}
|
||||
|
||||
int STDCALL W32kExcludeClipRect(HDC hDC,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* GDIOBJ.C - GDI object manipulation routines
|
||||
*
|
||||
* $Id: gdiobj.c,v 1.12 2002/07/13 21:37:27 ei Exp $
|
||||
* $Id: gdiobj.c,v 1.13 2002/07/18 21:59:18 ei Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -213,7 +213,8 @@ BOOL GDIOBJ_FreeObj(HGDIOBJ hObj, WORD Magic)
|
|||
Obj = (PGDIOBJ)((PCHAR)handleEntry->pObject + sizeof(GDIOBJHDR));
|
||||
switch( handleEntry->wMagic ){
|
||||
case GO_REGION_MAGIC:
|
||||
|
||||
bRet = RGNDATA_InternalDelete( (PRGNDATA) Obj );
|
||||
break;
|
||||
case GO_PEN_MAGIC:
|
||||
case GO_PALETTE_MAGIC:
|
||||
case GO_BITMAP_MAGIC:
|
||||
|
@ -290,6 +291,7 @@ BOOL GDIOBJ_UnlockObj( HGDIOBJ hObj, WORD Magic )
|
|||
|
||||
if( objectHeader->dwCount == 0x80000000 ){
|
||||
//delayed object release
|
||||
objectHeader->dwCount = 0;
|
||||
ExReleaseFastMutex(&RefCountHandling);
|
||||
DPRINT("GDIOBJ_UnlockObj: delayed delete\n");
|
||||
return GDIOBJ_FreeObj( hObj, Magic );
|
||||
|
@ -439,31 +441,6 @@ HGDIOBJ STDCALL W32kGetStockObject(INT Object)
|
|||
|
||||
BOOL STDCALL W32kDeleteObject(HGDIOBJ hObject)
|
||||
{
|
||||
/* ei: Now this is handled in gdiobj.c
|
||||
PGDIOBJ Obj;
|
||||
PGDIOBJHDR ObjHdr;
|
||||
WORD magic;
|
||||
|
||||
magic = GDIOBJ_GetHandleMagic (hObject);
|
||||
Obj = GDIOBJ_HandleToPtr( hObject, GO_MAGIC_DONTCARE );
|
||||
if( !Obj )
|
||||
return FALSE;
|
||||
ObjHdr = (PGDIOBJHDR)(((PCHAR)Obj) - sizeof (GDIOBJHDR));
|
||||
switch( magic )
|
||||
{
|
||||
case GO_BITMAP_MAGIC: {
|
||||
DPRINT( "Deleting bitmap\n" );
|
||||
ExFreePool( ((PBITMAPOBJ)Obj)->bitmap.bmBits );
|
||||
BITMAPOBJ_FreeBitmap( Obj );
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
DPRINT( "W32kDeleteObject: Deleting object of unknown type %x\n", magic );
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
*/
|
||||
return GDIOBJ_FreeObj( hObject, GO_MAGIC_DONTCARE );
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -46,7 +46,6 @@ STUB(EngMapFontFile)
|
|||
STUB(EngMapModule)
|
||||
STUB(EngMarkBandingSurface)
|
||||
STUB(EngMovePointer)
|
||||
STUB(EngMulDiv)
|
||||
STUB(EngMultiByteToUnicodeN)
|
||||
STUB(EngMultiByteToWideChar)
|
||||
STUB(EngProbeForRead)
|
||||
|
|
Loading…
Reference in a new issue