mirror of
https://github.com/reactos/reactos.git
synced 2025-05-16 15:50:24 +00:00
1. CLIPOBJ_bEnum, CLIPOBJ_cEnumStart - implemented internal clip region enumeration.
2. Implemented PaintRgn. Added test to gditest. 3. Removed enum.c enum.h (duplicates for clip.c clip.h). svn path=/trunk/; revision=3362
This commit is contained in:
parent
cfd7b8b886
commit
95d847d794
16 changed files with 285 additions and 140 deletions
|
@ -37,6 +37,8 @@ void gditest( void ){
|
|||
HFONT hf, tf;
|
||||
BITMAPINFOHEADER BitInf;
|
||||
BITMAPINFO BitPalInf;
|
||||
HRGN hRgn1, hRgn2, hRgn3;
|
||||
HBRUSH BlueBrush, DefBrush;
|
||||
|
||||
// Set up a DC called Desktop that accesses DISPLAY
|
||||
Desktop = CreateDCA("DISPLAY", NULL, NULL, NULL);
|
||||
|
@ -48,6 +50,20 @@ void gditest( void ){
|
|||
// Background
|
||||
Background (Desktop);
|
||||
|
||||
|
||||
//ei
|
||||
BlueBrush = CreateSolidBrush( RGB(0, 0, 0xff) );
|
||||
DefBrush = SelectObject( Desktop, BlueBrush );
|
||||
|
||||
hRgn1 = CreateRectRgn( 1, 2, 100, 101 );
|
||||
hRgn2 = CreateRectRgn( 10, 20, 150, 151 );
|
||||
hRgn3 = CreateRectRgn( 1, 1, 1, 1);
|
||||
CombineRgn( hRgn3, hRgn1, hRgn2, RGN_XOR );
|
||||
|
||||
PaintRgn( Desktop, hRgn3 );
|
||||
SelectObject( Desktop, DefBrush );
|
||||
DeleteObject( BlueBrush );
|
||||
|
||||
// Create a blue pen and select it into the DC
|
||||
BluePen = CreatePen(PS_SOLID, 8, RGB(0, 0, 0xff));
|
||||
SelectObject(Desktop, BluePen);
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
|
||||
#include "../vgaddi.h"
|
||||
#include "../vgavideo/vgavideo.h"
|
||||
#include "brush.h"
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
BOOL VGADDIFillSolid(SURFOBJ *Surface, RECTL Dimensions, ULONG iColor)
|
||||
{
|
||||
|
@ -12,7 +14,15 @@ BOOL VGADDIFillSolid(SURFOBJ *Surface, RECTL Dimensions, ULONG iColor)
|
|||
unsigned char *vp, *vpX;
|
||||
volatile unsigned char dummy;
|
||||
int byte_per_line;
|
||||
int i;
|
||||
int i, j;
|
||||
|
||||
DPRINT("VGADDIFillSolid: x:%d, y:%d, w:%d, h:%d\n", x, y, w, h);
|
||||
//ei temporary kludge because code below doesn't seem to work
|
||||
for( i=0; i<h; i++){
|
||||
for( j=0; j<w; j++)
|
||||
vgaPutPixel(x+j, y+i, iColor);
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
ASSIGNVP4(x, y, vpX)
|
||||
get_masks(x, w);
|
||||
|
@ -70,6 +80,7 @@ BOOL VGADDIPaintRgn(SURFOBJ *Surface, CLIPOBJ *ClipRegion, ULONG iColor, MIX Mix
|
|||
RECT_ENUM RectEnum;
|
||||
BOOL EnumMore;
|
||||
|
||||
DPRINT("VGADDIPaintRgn: iMode: %d, iDComplexity: %d\n Color:%d\n", ClipRegion->iMode, ClipRegion->iDComplexity, iColor);
|
||||
switch(ClipRegion->iMode) {
|
||||
|
||||
case TC_RECTANGLES:
|
||||
|
@ -80,19 +91,24 @@ BOOL VGADDIPaintRgn(SURFOBJ *Surface, CLIPOBJ *ClipRegion, ULONG iColor, MIX Mix
|
|||
|
||||
if (ClipRegion->iDComplexity == DC_RECT)
|
||||
{
|
||||
DPRINT("VGADDIPaintRgn Rect:%d %d %d %d\n", ClipRegion->rclBounds.left, ClipRegion->rclBounds.top, ClipRegion->rclBounds.right, ClipRegion->rclBounds.bottom);
|
||||
VGADDIFillSolid(Surface, ClipRegion->rclBounds, iColor);
|
||||
} else {
|
||||
/* Enumerate all the rectangles and draw them */
|
||||
|
||||
/* CLIPOBJ_cEnumStart(ClipRegion, FALSE, CT_RECTANGLES, CD_ANY,
|
||||
CLIPOBJ_cEnumStart(ClipRegion, FALSE, CT_RECTANGLES, CD_ANY,
|
||||
ENUM_RECT_LIMIT);
|
||||
|
||||
do {
|
||||
int i;
|
||||
EnumMore = CLIPOBJ_bEnum(ClipRegion, sizeof(RectEnum), (PVOID) &RectEnum);
|
||||
DPRINT("EnumMore: %d, count: %d\n", EnumMore, RectEnum.c);
|
||||
for( i=0; i<RectEnum.c; i++){
|
||||
DPRINT("VGADDI enum Rect:%d %d %d %d\n", RectEnum.arcl[i].left, RectEnum.arcl[i].top, RectEnum.arcl[i].right, RectEnum.arcl[i].bottom);
|
||||
VGADDIFillSolid(Surface, RectEnum.arcl[i], iColor);
|
||||
}
|
||||
|
||||
VGADDIFillSolid(Surface, &RectEnum.arcl[0], iColor);
|
||||
|
||||
} while (EnumMore); */
|
||||
} while (EnumMore);
|
||||
}
|
||||
|
||||
return(TRUE);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#define BRUSHOBJ_PtrToHandle(pBrushObj) \
|
||||
((HBRUSH) GDIOBJ_PtrToHandle ((PGDIOBJ) pBrushObj, GO_BRUSH_MAGIC))
|
||||
*/
|
||||
#define BRUSHOBJ_LockBrush(hBrush) GDIOBJ_LockObj((HGDIOBJ)hBrush, GO_BRUSH_MAGIC)
|
||||
#define BRUSHOBJ_LockBrush(hBrush) ((PBRUSHOBJ)GDIOBJ_LockObj((HGDIOBJ)hBrush, GO_BRUSH_MAGIC))
|
||||
#define BRUSHOBJ_UnlockBrush(hBrush) GDIOBJ_UnlockObj((HGDIOBJ)hBrush, GO_BRUSH_MAGIC)
|
||||
|
||||
HBRUSH
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: makefile,v 1.20 2002/07/22 07:55:48 ei Exp $
|
||||
# $Id: makefile,v 1.21 2002/08/18 07:02:56 ei Exp $
|
||||
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
|
@ -22,7 +22,7 @@ MAIN_OBJECTS = main/dllmain.o
|
|||
|
||||
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/region.o
|
||||
OBJECTS_OBJECTS = objects/dc.o objects/line.o objects/pen.o objects/bitblt.o objects/text.o objects/region.o objects/brush.o
|
||||
|
||||
OBJECTS = $(MAIN_OBJECTS) $(MISC_OBJECTS) $(OBJECTS_OBJECTS)
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: stubs.c,v 1.7 2002/07/22 07:55:48 ei Exp $
|
||||
/* $Id: stubs.c,v 1.8 2002/08/18 07:02:56 ei Exp $
|
||||
*
|
||||
* reactos/lib/gdi32/misc/stubs.c
|
||||
*
|
||||
|
@ -193,20 +193,6 @@ CreatePalette(
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
HBRUSH
|
||||
STDCALL
|
||||
CreateSolidBrush(
|
||||
COLORREF a0
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
DeleteMetaFile(
|
||||
|
@ -1017,16 +1003,6 @@ PlayMetaFile(
|
|||
|
||||
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
PaintRgn(
|
||||
HDC a0,
|
||||
HRGN a1
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
18
reactos/lib/gdi32/objects/brush.c
Normal file
18
reactos/lib/gdi32/objects/brush.c
Normal file
|
@ -0,0 +1,18 @@
|
|||
#ifdef UNICODE
|
||||
#undef UNICODE
|
||||
#endif
|
||||
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <ddk/ntddk.h>
|
||||
#include <win32k/kapi.h>
|
||||
|
||||
|
||||
HBRUSH
|
||||
STDCALL
|
||||
CreateSolidBrush(
|
||||
COLORREF a0
|
||||
)
|
||||
{
|
||||
return W32kCreateSolidBrush(a0);
|
||||
}
|
|
@ -143,4 +143,14 @@ GetRegionData(
|
|||
return W32kGetRegionData(a0,a1,a2);
|
||||
}
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
PaintRgn(
|
||||
HDC a0,
|
||||
HRGN a1
|
||||
)
|
||||
{
|
||||
return W32kPaintRgn( a0, a1 );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -14,16 +14,63 @@
|
|||
#include "clip.h"
|
||||
#include <include/object.h>
|
||||
|
||||
VOID EngDeleteClipRegion(CLIPOBJ *ClipObj)
|
||||
#include <win32k/debug1.h>
|
||||
|
||||
VOID IntEngDeleteClipRegion(CLIPOBJ *ClipObj)
|
||||
{
|
||||
HCLIP HClip = AccessHandleFromUserObject(ClipObj);
|
||||
CLIPGDI *ClipGDI = (CLIPGDI*)AccessInternalObject(HClip);
|
||||
|
||||
EngFreeMem(ClipGDI);
|
||||
EngFreeMem(ClipObj);
|
||||
FreeGDIHandle(HClip);
|
||||
}
|
||||
|
||||
CLIPOBJ * IntEngCreateClipRegion( ULONG count, PRECTL pRect, RECTL rcBounds )
|
||||
{
|
||||
HCLIP hClip;
|
||||
CLIPGDI* clipInt;
|
||||
CLIPOBJ* clipUser;
|
||||
DPRINT("IntEngCreateClipRegion count: %d\n", count);
|
||||
if( count > 1 ){
|
||||
hClip = (HCLIP)CreateGDIHandle( sizeof( CLIPGDI ) + count*sizeof(RECTL),
|
||||
sizeof( CLIPOBJ ) );
|
||||
|
||||
if( hClip ){
|
||||
clipInt = (CLIPGDI*)AccessInternalObject( hClip );
|
||||
RtlCopyMemory( clipInt->EnumRects.arcl, pRect, count*sizeof(RECTL));
|
||||
clipInt->EnumRects.c=count;
|
||||
|
||||
clipUser = (CLIPOBJ*)AccessUserObject( hClip );
|
||||
ASSERT( clipUser );
|
||||
|
||||
clipUser->iDComplexity = DC_COMPLEX;
|
||||
clipUser->iFComplexity = (count <= 4)? FC_RECT4: FC_COMPLEX;
|
||||
clipUser->iMode = TC_RECTANGLES;
|
||||
RtlCopyMemory( &(clipUser->rclBounds), &rcBounds, sizeof( RECTL ) );
|
||||
|
||||
return clipUser;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
else{
|
||||
hClip = (HCLIP)CreateGDIHandle( sizeof( CLIPGDI ),
|
||||
sizeof( CLIPOBJ ) );
|
||||
if( hClip ){
|
||||
clipInt = (CLIPGDI*)AccessInternalObject( hClip );
|
||||
RtlCopyMemory( clipInt->EnumRects.arcl, &rcBounds, sizeof( RECTL ));
|
||||
clipInt->EnumRects.c = 1;
|
||||
|
||||
clipUser = (CLIPOBJ*)AccessUserObject( hClip );
|
||||
ASSERT( clipUser );
|
||||
|
||||
clipUser->iDComplexity = ((rcBounds.top==rcBounds.bottom)&&(rcBounds.left==rcBounds.right))?
|
||||
DC_TRIVIAL:DC_RECT;
|
||||
clipUser->iFComplexity = FC_RECT;
|
||||
clipUser->iMode = TC_RECTANGLES;
|
||||
DPRINT("IntEngCreateClipRegion: iDComplexity: %d\n", clipUser->iDComplexity);
|
||||
RtlCopyMemory( &(clipUser->rclBounds), &rcBounds, sizeof( RECTL ) );
|
||||
return clipUser;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CLIPOBJ * STDCALL
|
||||
EngCreateClip(VOID)
|
||||
|
@ -47,12 +94,17 @@ CLIPOBJ_cEnumStart(IN PCLIPOBJ ClipObj,
|
|||
CLIPGDI *ClipGDI = (CLIPGDI*)AccessInternalObjectFromUserObject(ClipObj);
|
||||
|
||||
ClipGDI->EnumPos = 0;
|
||||
ClipGDI->EnumRects.c = MaxRects;
|
||||
ClipGDI->EnumMax = (MaxRects>0)? MaxRects : ClipGDI->EnumRects.c;
|
||||
|
||||
if( !((BuildOrder == CD_ANY) || (BuildOrder == CD_LEFTDOWN ))){
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
ClipGDI->EnumOrder = BuildOrder;
|
||||
|
||||
// Return the number of rectangles enumerated
|
||||
if(ClipGDI->EnumRects.c>MaxRects)
|
||||
if( (MaxRects > 0) && (ClipGDI->EnumRects.c>MaxRects) )
|
||||
{
|
||||
ClipGDI->EnumRects.c = 0xFFFFFFFF;
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
return ClipGDI->EnumRects.c;
|
||||
|
@ -64,12 +116,20 @@ CLIPOBJ_bEnum(IN PCLIPOBJ ClipObj,
|
|||
OUT ULONG *EnumRects)
|
||||
{
|
||||
CLIPGDI *ClipGDI = (CLIPGDI*)AccessInternalObjectFromUserObject(ClipObj);
|
||||
ULONG nCopy;
|
||||
PENUMRECTS pERects = (PENUMRECTS)EnumRects;
|
||||
|
||||
ClipGDI->EnumPos++;
|
||||
//calculate how many rectangles we should copy
|
||||
nCopy = MIN( ClipGDI->EnumMax-ClipGDI->EnumPos,
|
||||
MIN( ClipGDI->EnumRects.c, (ObjSize-sizeof(ULONG))/sizeof(RECTL)));
|
||||
|
||||
RtlCopyMemory( &(pERects->arcl), &(ClipGDI->EnumRects.arcl), nCopy*sizeof(RECTL) );
|
||||
pERects->c = nCopy;
|
||||
|
||||
ClipGDI->EnumPos+=nCopy;
|
||||
|
||||
if(ClipGDI->EnumPos > ClipGDI->EnumRects.c)
|
||||
{
|
||||
return FALSE;
|
||||
} else
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -1 +1,17 @@
|
|||
#ifndef __WIN32K_CLIP_H
|
||||
#define __WIN32K_CLIP_H
|
||||
|
||||
typedef ULONG HCLIP;
|
||||
CLIPOBJ * IntEngCreateClipRegion( ULONG count, PRECTL pRect, RECTL rcBounds );
|
||||
VOID IntEngDeleteClipRegion(CLIPOBJ *ClipObj);
|
||||
|
||||
|
||||
#define ENUM_RECT_LIMIT 50
|
||||
|
||||
typedef struct _RECT_ENUM
|
||||
{
|
||||
ULONG c;
|
||||
RECTL arcl[ENUM_RECT_LIMIT];
|
||||
} RECT_ENUM;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: GDI Driver Enumeration Functions
|
||||
* FILE: subsys/win32k/eng/enum.c
|
||||
* PROGRAMER: Jason Filby
|
||||
* REVISION HISTORY:
|
||||
* 3/7/1999: Created
|
||||
*/
|
||||
|
||||
#include <ddk/winddi.h>
|
||||
|
||||
ULONG CLIPOBJ_cEnumStart(IN PCLIPOBJ ClipObj,
|
||||
IN BOOL ShouldDoAll,
|
||||
IN ULONG ClipType,
|
||||
IN ULONG BuildOrder,
|
||||
IN ULONG MaxRects)
|
||||
{
|
||||
// Sets the parameters for enumerating rectables in the given clip region
|
||||
|
||||
ULONG enumCount = 0;
|
||||
ENUMRECTS enumRects;
|
||||
|
||||
// MUCH WORK TO DO HERE
|
||||
|
||||
// Return the number of rectangles enumerated
|
||||
if(enumCount>MaxRects)
|
||||
{
|
||||
enumCount = 0xFFFFFFFF;
|
||||
}
|
||||
return enumCount;
|
||||
}
|
||||
|
||||
BOOL CLIPOBJ_bEnum(IN PCLIPOBJ ClipObj,
|
||||
IN ULONG ObjSize,
|
||||
OUT ULONG *EnumRects)
|
||||
{
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
#define ENUM_RECT_LIMIT 50
|
||||
|
||||
typedef struct _RECT_ENUM
|
||||
{
|
||||
ULONG c;
|
||||
RECTL arcl[ENUM_RECT_LIMIT];
|
||||
} RECT_ENUM;
|
|
@ -21,7 +21,8 @@ ULONG CreateGDIHandle(ULONG InternalSize, ULONG UserSize)
|
|||
PENGOBJ pObj;
|
||||
int i;
|
||||
|
||||
size = sizeof( ENGOBJ ) + InternalSize + UserSize;
|
||||
//size = sizeof( ENGOBJ ) + InternalSize + UserSize;
|
||||
size = InternalSize; //internal size includes header and user portions
|
||||
pObj = EngAllocMem( FL_ZERO_MEMORY, size, 0 );
|
||||
|
||||
if( !pObj )
|
||||
|
|
|
@ -41,12 +41,15 @@ typedef struct _BRUSHGDI {
|
|||
typedef struct _CLIPGDI {
|
||||
ENGOBJ Header;
|
||||
CLIPOBJ ClipObj;
|
||||
/* ei what were these for?
|
||||
ULONG NumRegionRects;
|
||||
ULONG NumIntersectRects;
|
||||
RECTL *RegionRects;
|
||||
RECTL *IntersectRects;
|
||||
|
||||
*/
|
||||
ULONG EnumPos;
|
||||
ULONG EnumOrder;
|
||||
ULONG EnumMax;
|
||||
ENUMRECTS EnumRects;
|
||||
} CLIPGDI, *PCLIPGDI;
|
||||
|
||||
|
|
|
@ -11,23 +11,72 @@
|
|||
#include <ddk/winddi.h>
|
||||
#include <include/object.h>
|
||||
#include <include/paint.h>
|
||||
#include <include/surface.h>
|
||||
|
||||
#include "objects.h"
|
||||
#include <include/mouse.h>
|
||||
#include "../dib/dib.h"
|
||||
|
||||
#include "brush.h"
|
||||
#include "enum.h"
|
||||
|
||||
BOOL FillSolid(SURFOBJ *Surface, PRECTL Dimensions, ULONG iColor)
|
||||
//#define NDEBUG
|
||||
#include <win32k/debug1.h>
|
||||
|
||||
BOOL FillSolid(SURFOBJ *Surface, PRECTL pRect, ULONG iColor)
|
||||
{
|
||||
// These functions are assigned if we're working with a DIB
|
||||
// The assigned functions depend on the bitsPerPixel of the DIB
|
||||
PFN_DIB_PutPixel DIB_PutPixel;
|
||||
PFN_DIB_HLine DIB_HLine;
|
||||
PFN_DIB_VLine DIB_VLine;
|
||||
LONG y;
|
||||
ULONG x, LineWidth, leftOfBitmap;
|
||||
SURFGDI *SurfaceGDI;
|
||||
|
||||
SurfaceGDI = (SURFGDI*)AccessInternalObjectFromUserObject(Surface);
|
||||
LineWidth = Dimensions->right - Dimensions->left;
|
||||
|
||||
for (y = Dimensions->top; y < Dimensions->bottom; y++)
|
||||
MouseSafetyOnDrawStart(Surface, SurfaceGDI, pRect->left, pRect->top, pRect->right, pRect->bottom);
|
||||
/*
|
||||
if(Surface->iType!=STYPE_BITMAP)
|
||||
{
|
||||
// EngHLine(Surface, SurfaceGDI, Dimensions->left, y, LineWidth, iColor);
|
||||
// Call the driver's DrvLineTo
|
||||
ret = SurfGDI->LineTo(Surface, Clip, Brush, x1, y1, x2, y2, RectBounds, mix);
|
||||
MouseSafetyOnDrawEnd(Surface, SurfGDI);
|
||||
return ret;
|
||||
}
|
||||
*/
|
||||
// Assign DIB functions according to bytes per pixel
|
||||
DPRINT("BPF: %d\n", BitsPerFormat(Surface->iBitmapFormat));
|
||||
switch(BitsPerFormat(Surface->iBitmapFormat))
|
||||
{
|
||||
case 4:
|
||||
DIB_PutPixel = (PFN_DIB_PutPixel)DIB_4BPP_PutPixel;
|
||||
DIB_HLine = (PFN_DIB_HLine)DIB_4BPP_HLine;
|
||||
DIB_VLine = (PFN_DIB_VLine)DIB_4BPP_VLine;
|
||||
break;
|
||||
|
||||
case 24:
|
||||
DIB_PutPixel = (PFN_DIB_PutPixel)DIB_24BPP_PutPixel;
|
||||
DIB_HLine = (PFN_DIB_HLine)DIB_24BPP_HLine;
|
||||
DIB_VLine = (PFN_DIB_VLine)DIB_24BPP_VLine;
|
||||
break;
|
||||
|
||||
default:
|
||||
DbgPrint("EngLineTo: unsupported DIB format %u (bitsPerPixel:%u)\n", Surface->iBitmapFormat,
|
||||
BitsPerFormat(Surface->iBitmapFormat));
|
||||
|
||||
MouseSafetyOnDrawEnd(Surface, SurfaceGDI);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
LineWidth = pRect->right - pRect->left;
|
||||
DPRINT(" LineWidth: %d, top: %d, bottom: %d\n", LineWidth, pRect->top, pRect->bottom);
|
||||
for (y = pRect->top; y < pRect->bottom; y++)
|
||||
{
|
||||
//EngLineTo(Surface, SurfaceGDI, Dimensions->left, y, LineWidth, iColor);
|
||||
DIB_HLine(Surface, pRect->left, pRect->right, y, iColor);
|
||||
}
|
||||
MouseSafetyOnDrawEnd(Surface, SurfaceGDI);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -38,6 +87,7 @@ BOOL EngPaintRgn(SURFOBJ *Surface, CLIPOBJ *ClipRegion, ULONG iColor, MIX Mix,
|
|||
RECT_ENUM RectEnum;
|
||||
BOOL EnumMore;
|
||||
|
||||
DPRINT("ClipRegion->iMode:%d, ClipRegion->iDComplexity: %d\n Color: %d", ClipRegion->iMode, ClipRegion->iDComplexity, iColor);
|
||||
switch(ClipRegion->iMode) {
|
||||
|
||||
case TC_RECTANGLES:
|
||||
|
@ -48,7 +98,7 @@ BOOL EngPaintRgn(SURFOBJ *Surface, CLIPOBJ *ClipRegion, ULONG iColor, MIX Mix,
|
|||
|
||||
if (ClipRegion->iDComplexity == DC_RECT)
|
||||
{
|
||||
FillSolid(Surface, &ClipRegion->rclBounds, iColor);
|
||||
FillSolid(Surface, &(ClipRegion->rclBounds), iColor);
|
||||
} else {
|
||||
|
||||
/* Enumerate all the rectangles and draw them */
|
||||
|
@ -75,26 +125,38 @@ EngPaint(IN SURFOBJ *Surface,
|
|||
IN MIX Mix)
|
||||
{
|
||||
BOOLEAN ret;
|
||||
SURFGDI *SurfGDI;
|
||||
|
||||
// Is the surface's Paint function hooked?
|
||||
SurfGDI = (SURFGDI*)AccessInternalObjectFromUserObject(Surface);
|
||||
|
||||
// FIXME: Perform Mouse Safety on the given ClipRegion
|
||||
// MouseSafetyOnDrawStart(Surface, SurfGDI, x1, y1, x2, y2);
|
||||
|
||||
if((Surface->iType!=STYPE_BITMAP) && (SurfGDI->Paint!=NULL))
|
||||
{
|
||||
// Call the driver's DrvPaint
|
||||
ret = SurfGDI->Paint(Surface, ClipRegion, Brush, BrushOrigin, Mix);
|
||||
// MouseSafetyOnDrawEnd(Surface, SurfGDI);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// FIXME: We only support a brush's solid color attribute
|
||||
ret = EngPaintRgn(Surface, ClipRegion, Brush->iSolidColor, Mix, NULL, BrushOrigin);
|
||||
|
||||
// MouseSafetyOnDrawEnd(Surface, SurfGDI);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL STDCALL
|
||||
IntEngPaint(IN SURFOBJ *Surface,
|
||||
IN CLIPOBJ *ClipRegion,
|
||||
IN BRUSHOBJ *Brush,
|
||||
IN POINTL *BrushOrigin,
|
||||
IN MIX Mix)
|
||||
{
|
||||
SURFGDI *SurfGDI;
|
||||
BOOL ret;
|
||||
|
||||
// Is the surface's Paint function hooked?
|
||||
SurfGDI = (SURFGDI*)AccessInternalObjectFromUserObject(Surface);
|
||||
|
||||
DPRINT("SurfGDI type: %d, sgdi paint: %x\n", Surface->iType, SurfGDI->Paint);
|
||||
if((Surface->iType!=STYPE_BITMAP) && (SurfGDI->Paint!=NULL))
|
||||
{
|
||||
// Call the driver's DrvPaint
|
||||
MouseSafetyOnDrawStart(Surface, SurfGDI, ClipRegion->rclBounds.left,
|
||||
ClipRegion->rclBounds.top, ClipRegion->rclBounds.right,
|
||||
ClipRegion->rclBounds.bottom);
|
||||
|
||||
ret = SurfGDI->Paint(Surface, ClipRegion, Brush, BrushOrigin, Mix);
|
||||
MouseSafetyOnDrawEnd(Surface, SurfGDI);
|
||||
return ret;
|
||||
}
|
||||
return EngPaint( Surface, ClipRegion, Brush, BrushOrigin, Mix );
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: dc.c,v 1.33 2002/08/04 09:55:11 ei Exp $
|
||||
/* $Id: dc.c,v 1.34 2002/08/18 07:02:57 ei Exp $
|
||||
*
|
||||
* DC.C - Device context functions
|
||||
*
|
||||
|
@ -1155,9 +1155,10 @@ void DC_InitDC(HDC DCHandle)
|
|||
W32kSetTextColor(DCHandle, DCToInit->w.textColor);
|
||||
W32kSetBkColor(DCHandle, DCToInit->w.backgroundColor);
|
||||
W32kSelectObject(DCHandle, DCToInit->w.hPen);
|
||||
W32kSelectObject(DCHandle, DCToInit->w.hBrush);
|
||||
W32kSelectObject(DCHandle, W32kGetStockObject( GRAY_BRUSH )); //FIXME: default should be WHITE_BRUSH
|
||||
W32kSelectObject(DCHandle, DCToInit->w.hFont);
|
||||
}
|
||||
else
|
||||
DPRINT("DC_InitDC: can't get dc for handle %d\n", DCHandle );
|
||||
// CLIPPING_UpdateGCRegion(DCToInit);
|
||||
}
|
||||
|
|
|
@ -7,12 +7,17 @@
|
|||
#include <win32k/bitmaps.h>
|
||||
#include <win32k/region.h>
|
||||
#include <win32k/cliprgn.h>
|
||||
#include <win32k/brush.h>
|
||||
#include <include/rect.h>
|
||||
|
||||
|
||||
// #define NDEBUG
|
||||
#include <win32k/debug1.h>
|
||||
|
||||
BOOL STDCALL
|
||||
IntEngPaint(IN SURFOBJ *Surface,IN CLIPOBJ *ClipRegion,IN BRUSHOBJ *Brush,IN POINTL *BrushOrigin,
|
||||
IN MIX Mix);
|
||||
|
||||
// Internal Functions
|
||||
|
||||
#define EMPTY_REGION(pReg) { \
|
||||
|
@ -1749,47 +1754,53 @@ W32kPaintRgn(HDC hDC,
|
|||
RECT box;
|
||||
HRGN tmpVisRgn, prevVisRgn;
|
||||
DC *dc = DC_HandleToPtr(hDC);
|
||||
PROSRGNDATA visrgn;
|
||||
CLIPOBJ* ClipRegion;
|
||||
BOOL bRet = FALSE;
|
||||
PBRUSHOBJ pBrush;
|
||||
POINTL BrushOrigin;
|
||||
SURFOBJ *SurfObj;
|
||||
|
||||
if( !dc )
|
||||
return FALSE;
|
||||
|
||||
if(!(tmpVisRgn = W32kCreateRectRgn(0, 0, 0, 0))){
|
||||
DC_ReleasePtr( hDC );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* ei enable later
|
||||
// Transform region into device co-ords
|
||||
if(!REGION_LPTODP(hDC, tmpVisRgn, hRgn) || W32kOffsetRgn(tmpVisRgn, dc->w.DCOrgX, dc->w.DCOrgY) == ERROR) {
|
||||
W32kDeleteObject( tmpVisRgn );
|
||||
DC_ReleasePtr( hDC );
|
||||
return FALSE;
|
||||
}
|
||||
*/
|
||||
/* enable when clipping is implemented
|
||||
W32kCombineRgn(tmpVisRgn, tmpVisRgn, dc->w.hGCClipRgn, RGN_AND);
|
||||
*/
|
||||
|
||||
// Modify visible region
|
||||
if(!(prevVisRgn = SaveVisRgn(hDC))) {
|
||||
W32kDeleteObject(tmpVisRgn);
|
||||
DC_ReleasePtr( hDC );
|
||||
return FALSE;
|
||||
}
|
||||
W32kCombineRgn(tmpVisRgn, prevVisRgn, tmpVisRgn, RGN_AND);
|
||||
SelectVisRgn(hDC, tmpVisRgn);
|
||||
W32kDeleteObject(tmpVisRgn);
|
||||
//visrgn = RGNDATA_LockRgn(tmpVisRgn);
|
||||
visrgn = RGNDATA_LockRgn(hRgn);
|
||||
|
||||
ClipRegion = IntEngCreateClipRegion( visrgn->rdh.nCount, visrgn->Buffer, visrgn->rdh.rcBound );
|
||||
ASSERT( ClipRegion );
|
||||
pBrush = BRUSHOBJ_LockBrush(dc->w.hBrush);
|
||||
ASSERT(pBrush);
|
||||
BrushOrigin.x = dc->w.brushOrgX;
|
||||
BrushOrigin.y = dc->w.brushOrgY;
|
||||
SurfObj = (SURFOBJ*)AccessUserObject(dc->Surface);
|
||||
|
||||
bRet = IntEngPaint(SurfObj,
|
||||
ClipRegion,
|
||||
pBrush,
|
||||
&BrushOrigin,
|
||||
0xFFFF);//don't know what to put here
|
||||
|
||||
RGNDATA_UnlockRgn( tmpVisRgn );
|
||||
|
||||
// Fill the region
|
||||
|
||||
W32kGetRgnBox(dc->w.hGCClipRgn, &box);
|
||||
// if (X11DRV_SetupGCForBrush( physDev )) FIXME: Recode with ReactOS GDI calls
|
||||
// {
|
||||
// // Update the pixmap from the DIB section
|
||||
// X11DRV_LockDIBSection(physDev, DIB_Status_GdiMod, FALSE);
|
||||
//
|
||||
// TSXFillRectangle(gdi_display, physDev->drawable, physDev->gc,
|
||||
// box.left, box.top, box.right-box.left, box.bottom-box.top);
|
||||
//
|
||||
// // Update the DIBSection from the pixmap
|
||||
// X11DRV_UnlockDIBSection(physDev, TRUE);
|
||||
// }
|
||||
|
||||
// Restore the visible region
|
||||
DC_ReleasePtr( hDC );
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue