add sekelton for the GradientFill() implementation.

svn path=/trunk/; revision=8099
This commit is contained in:
Thomas Bluemel 2004-02-08 21:37:53 +00:00
parent d9ae46ef9d
commit dfd90b8ad1
17 changed files with 644 additions and 111 deletions

View file

@ -174,6 +174,7 @@ NtGdiGetWinMetaFileBits 5
NtGdiGetWindowExtEx 2
NtGdiGetWindowOrgEx 2
NtGdiGetWorldTransform 2
NtGdiGradientFill 6
NtGdiIntersectClipRect 5
NtGdiInvertRgn 2
NtGdiLPtoDP 3

View file

@ -327,98 +327,100 @@ enum _GLYPH_MODE
#define HOOK_SYNCHRONIZE 0x00001000
#define HOOK_SYNCHRONIZEACCESS 0x00004000
#define HOOK_TRANSPARENTBLT 0x00008000
#define HOOK_ALPHABLEND 0x00010000
#define HOOK_GRADIENTFILL 0x00020000
#define HOOK_FLAGS 0x0003b5ff
enum _DRV_HOOK_FUNCS
{
INDEX_DrvEnablePDEV,
INDEX_DrvCompletePDEV,
INDEX_DrvDisablePDEV,
INDEX_DrvEnableSurface,
INDEX_DrvDisableSurface,
INDEX_DrvAssertMode,
INDEX_DrvResetPDEV = 7,
INDEX_DrvDisableDriver,
INDEX_DrvCreateDeviceBitmap = 10,
INDEX_DrvDeleteDeviceBitmap,
INDEX_DrvRealizeBrush,
INDEX_DrvDitherColor,
INDEX_DrvStrokePath,
INDEX_DrvFillPath,
INDEX_DrvStrokeAndFillPath,
INDEX_DrvPaint,
INDEX_DrvBitBlt,
INDEX_DrvCopyBits,
INDEX_DrvStretchBlt,
INDEX_DrvSetPalette = 22,
INDEX_DrvTextOut,
INDEX_DrvEscape,
INDEX_DrvDrawEscape,
INDEX_DrvQueryFont,
INDEX_DrvQueryFontTree,
INDEX_DrvQueryFontData,
INDEX_DrvSetPointerShape,
INDEX_DrvMovePointer,
INDEX_DrvLineTo,
INDEX_DrvSendPage,
INDEX_DrvStartPage,
INDEX_DrvEndDoc,
INDEX_DrvStartDoc,
INDEX_DrvGetGlyphMode = 37,
INDEX_DrvSynchronize,
INDEX_DrvSaveScreenBits = 40,
INDEX_DrvGetModes,
INDEX_DrvFree,
INDEX_DrvDestroyFont,
INDEX_DrvQueryFontCaps,
INDEX_DrvLoadFontFile,
INDEX_DrvUnloadFontFile,
INDEX_DrvFontManagement,
INDEX_DrvQueryTrueTypeTable,
INDEX_DrvQueryTrueTypeOutline,
INDEX_DrvGetTrueTypeFile,
INDEX_DrvQueryFontFile,
INDEX_DrvMovePanning,
INDEX_DrvQueryAdvanceWidths,
INDEX_DrvSetPixelFormat,
INDEX_DrvDescribePixelFormat,
INDEX_DrvSwapBuffers,
INDEX_DrvStartBanding,
INDEX_DrvNextBand,
INDEX_DrvGetDirectDrawInfo,
INDEX_DrvEnableDirectDraw,
INDEX_DrvDisableDirectDraw,
INDEX_DrvQuerySpoolType,
INDEX_DrvIcmCreateColorTransform,
INDEX_DrvIcmDeleteColorTransform,
INDEX_DrvIcmCheckBitmapBits,
INDEX_DrvIcmSetDeviceGammaRamp,
INDEX_DrvGradientFill,
INDEX_DrvStretchBltROP,
INDEX_DrvPlgBlt,
INDEX_DrvAlphaBlend,
INDEX_DrvSynthesizeFont,
INDEX_DrvGetSynthesizedFontFiles,
INDEX_DrvTransparentBlt,
INDEX_DrvQueryPerBandInfo,
INDEX_DrvQueryDeviceSupport,
INDEX_DrvReserved1,
INDEX_DrvReserved2,
INDEX_DrvReserved3,
INDEX_DrvReserved4,
INDEX_DrvReserved5,
INDEX_DrvReserved6,
INDEX_DrvReserved7,
INDEX_DrvReserved8,
INDEX_DrvQueryGlyphAttrs,
INDEX_DrvNotify,
INDEX_DrvSynchronizeSurface,
INDEX_DrvResetDevice,
INDEX_DrvReserved9,
INDEX_DrvReserved10,
INDEX_DrvReserved11,
INDEX_DrvDeriveSurface = 85,
INDEX_LAST
};
/* DRVFN.iFunc constants */
#define INDEX_DrvEnablePDEV 0L
#define INDEX_DrvCompletePDEV 1L
#define INDEX_DrvDisablePDEV 2L
#define INDEX_DrvEnableSurface 3L
#define INDEX_DrvDisableSurface 4L
#define INDEX_DrvAssertMode 5L
#define INDEX_DrvOffset 6L
#define INDEX_DrvResetPDEV 7L
#define INDEX_DrvDisableDriver 8L
#define INDEX_DrvCreateDeviceBitmap 10L
#define INDEX_DrvDeleteDeviceBitmap 11L
#define INDEX_DrvRealizeBrush 12L
#define INDEX_DrvDitherColor 13L
#define INDEX_DrvStrokePath 14L
#define INDEX_DrvFillPath 15L
#define INDEX_DrvStrokeAndFillPath 16L
#define INDEX_DrvPaint 17L
#define INDEX_DrvBitBlt 18L
#define INDEX_DrvCopyBits 19L
#define INDEX_DrvStretchBlt 20L
#define INDEX_DrvSetPalette 22L
#define INDEX_DrvTextOut 23L
#define INDEX_DrvEscape 24L
#define INDEX_DrvDrawEscape 25L
#define INDEX_DrvQueryFont 26L
#define INDEX_DrvQueryFontTree 27L
#define INDEX_DrvQueryFontData 28L
#define INDEX_DrvSetPointerShape 29L
#define INDEX_DrvMovePointer 30L
#define INDEX_DrvLineTo 31L
#define INDEX_DrvSendPage 32L
#define INDEX_DrvStartPage 33L
#define INDEX_DrvEndDoc 34L
#define INDEX_DrvStartDoc 35L
#define INDEX_DrvGetGlyphMode 37L
#define INDEX_DrvSynchronize 38L
#define INDEX_DrvSaveScreenBits 40L
#define INDEX_DrvGetModes 41L
#define INDEX_DrvFree 42L
#define INDEX_DrvDestroyFont 43L
#define INDEX_DrvQueryFontCaps 44L
#define INDEX_DrvLoadFontFile 45L
#define INDEX_DrvUnloadFontFile 46L
#define INDEX_DrvFontManagement 47L
#define INDEX_DrvQueryTrueTypeTable 48L
#define INDEX_DrvQueryTrueTypeOutline 49L
#define INDEX_DrvGetTrueTypeFile 50L
#define INDEX_DrvQueryFontFile 51L
#define INDEX_DrvMovePanning 52L
#define INDEX_DrvQueryAdvanceWidths 53L
#define INDEX_DrvSetPixelFormat 54L
#define INDEX_DrvDescribePixelFormat 55L
#define INDEX_DrvSwapBuffers 56L
#define INDEX_DrvStartBanding 57L
#define INDEX_DrvNextBand 58L
#define INDEX_DrvGetDirectDrawInfo 59L
#define INDEX_DrvEnableDirectDraw 60L
#define INDEX_DrvDisableDirectDraw 61L
#define INDEX_DrvQuerySpoolType 62L
#define INDEX_DrvIcmCreateColorTransform 64L
#define INDEX_DrvIcmDeleteColorTransform 65L
#define INDEX_DrvIcmCheckBitmapBits 66L
#define INDEX_DrvIcmSetDeviceGammaRamp 67L
#define INDEX_DrvGradientFill 68L
#define INDEX_DrvStretchBltROP 69L
#define INDEX_DrvPlgBlt 70L
#define INDEX_DrvAlphaBlend 71L
#define INDEX_DrvSynthesizeFont 72L
#define INDEX_DrvGetSynthesizedFontFiles 73L
#define INDEX_DrvTransparentBlt 74L
#define INDEX_DrvQueryPerBandInfo 75L
#define INDEX_DrvQueryDeviceSupport 76L
#define INDEX_DrvReserved1 77L
#define INDEX_DrvReserved2 78L
#define INDEX_DrvReserved3 79L
#define INDEX_DrvReserved4 80L
#define INDEX_DrvReserved5 81L
#define INDEX_DrvReserved6 82L
#define INDEX_DrvReserved7 83L
#define INDEX_DrvReserved8 84L
#define INDEX_DrvDeriveSurface 85L
#define INDEX_DrvQueryGlyphAttrs 86L
#define INDEX_DrvNotify 87L
#define INDEX_DrvSynchronizeSurface 88L
#define INDEX_DrvResetDevice 89L
#define INDEX_DrvReserved9 90L
#define INDEX_DrvReserved10 91L
#define INDEX_DrvReserved11 92L
#define INDEX_LAST 93L
/* EngCreatePalette mode types */
#define PAL_INDEXED 0x00000001
@ -1065,6 +1067,17 @@ PVOID STDCALL
DrvGetTrueTypeFile(IN ULONG FileNumber,
IN PULONG Size);
BOOL STDCALL
DrvGradientFill(IN SURFOBJ *psoDest,
IN CLIPOBJ *pco,
IN XLATEOBJ *pxlo,
IN TRIVERTEX *pVertex,
IN ULONG nVertex,
IN PVOID pMesh,
IN ULONG nMesh,
IN RECTL *prclExtents,
IN POINTL *pptlDitherOrg,
IN ULONG ulMode);
BOOL STDCALL
DrvLineTo(IN PSURFOBJ SurfObj,
IN PCLIPOBJ ClipObj,
IN PBRUSHOBJ BrushObj,

View file

@ -1962,6 +1962,11 @@ extern "C" {
#define GMEM_LOCKCOUNT (255)
#define GlobalDiscard(h) GlobalReAlloc(h, 0, GMEM_MOVEABLE)
/* GradientFill */
#define GRADIENT_FILL_RECT_H (0)
#define GRADIENT_FILL_RECT_V (1)
#define GRADIENT_FILL_TRIANGLE (2)
/* ImageList_Create */
#define ILC_COLOR (0)
#define ILC_COLOR4 (4)

View file

@ -6293,6 +6293,17 @@ typedef struct _WIN32_FILE_ATTRIBUTES_DATA {
DWORD nFileSizeLow;
} WIN32_FILE_ATTRIBUTE_DATA, *LPWIN32_FILE_ATTRIBUTE_DATA;
typedef struct _GRADIENT_TRIANGLE {
ULONG Vertex1;
ULONG Vertex2;
ULONG Vertex3;
} GRADIENT_TRIANGLE, *PGRADIENT_TRIANGLE, *LPGRADIENT_TRIANGLE;
typedef struct _GRADIENT_RECT {
ULONG UpperLeft;
ULONG LowerRight;
} GRADIENT_RECT, *PGRADIENT_RECT, *LPGRADIENT_RECT;
#ifdef __cplusplus
}
#endif /* __cplusplus */

View file

@ -166,6 +166,16 @@ NtGdiGetPixel (
);
BOOL
STDCALL
NtGdiGradientFill (
HDC hdc,
PTRIVERTEX pVertex,
ULONG uVertex,
PVOID pMesh,
ULONG uMesh,
ULONG ulMode
);
BOOL
STDCALL
NtGdiMaskBlt (
HDC hDCDest,
INT XDest,

View file

@ -95,6 +95,7 @@ typedef VOID STDCALL_FUNC (*PGD_DISABLEDIRECTDRAW)(DHPDEV);
typedef LONG STDCALL_FUNC (*PGD_QUERYSPOOLTYPE)(DHPDEV, LPWSTR);
typedef BOOL STDCALL_FUNC (*PGD_GRADIENTFILL)(SURFOBJ*, CLIPOBJ*, XLATEOBJ*, TRIVERTEX*, ULONG, PVOID, ULONG, RECTL*, POINTL*, ULONG);
typedef struct _DRIVER_FUNCTIONS
{
@ -156,6 +157,7 @@ typedef struct _DRIVER_FUNCTIONS
PGD_ENABLEDIRECTDRAW EnableDirectDraw;
PGD_DISABLEDIRECTDRAW DisableDirectDraw;
PGD_QUERYSPOOLTYPE QuerySpoolType;
PGD_GRADIENTFILL GradientFill;
} DRIVER_FUNCTIONS, *PDRIVER_FUNCTIONS;
BOOL DRIVER_RegisterDriver(LPCWSTR Name, PGD_ENABLEDRIVER EnableDriver);

View file

@ -1,4 +1,4 @@
/* $Id: stubs.c,v 1.47 2004/02/08 16:16:24 navaraf Exp $
/* $Id: stubs.c,v 1.48 2004/02/08 21:37:52 weiden Exp $
*
* reactos/lib/gdi32/misc/stubs.c
*
@ -2260,17 +2260,6 @@ GdiGetLocalFont(HFONT hfont)
return 0;
}
/*
* @unimplemented
*/
BOOL
STDCALL
GdiGradientFill(HDC hdc,PTRIVERTEX pVertex,ULONG uVertex,PVOID pMesh,ULONG uMesh,ULONG ulMode)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/*
* @unimplemented
*/

View file

@ -128,3 +128,19 @@ FloodFill(
return NtGdiFloodFill(hdc,nXStart, nYStart, crFill );
}
/*
* @implemented
*/
BOOL STDCALL
GdiGradientFill(
HDC hdc,
PTRIVERTEX pVertex,
ULONG uVertex,
PVOID pMesh,
ULONG uMesh,
ULONG ulMode
)
{
return NtGdiGradientFill(hdc, pVertex, uVertex, pMesh, uMesh, ulMode);
}

View file

@ -0,0 +1,288 @@
/*
* ReactOS W32 Subsystem
* Copyright (C) 1998 - 2004 ReactOS Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: gradient.c,v 1.1 2004/02/08 21:37:52 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* PURPOSE: GDI Driver Gradient Functions
* FILE: subsys/win32k/eng/gradient.c
* PROGRAMER: Thomas Weidenmueller
* REVISION HISTORY:
* 3/7/1999: Created
*/
#include <ddk/winddi.h>
#include <ddk/ntddmou.h>
#include <include/object.h>
#include <include/paint.h>
#include <include/surface.h>
#include <include/rect.h>
#include "objects.h"
#include <include/mouse.h>
#include "../dib/dib.h"
#include "brush.h"
#include "clip.h"
//#define NDEBUG
#include <win32k/debug1.h>
/* MACROS *********************************************************************/
#define VERTEX(n) (pVertex + gt->n)
#define COMPAREVERTEX(a, b) ((a)->x == (b)->x && (a)->y == (b)->y)
/* FUNCTIONS ******************************************************************/
BOOL FASTCALL
IntEngGradientFillRect(
IN SURFOBJ *psoDest,
IN CLIPOBJ *pco,
IN XLATEOBJ *pxlo,
IN TRIVERTEX *pVertex,
IN ULONG nVertex,
IN PGRADIENT_RECT gRect,
IN RECTL *prclExtents,
IN POINTL *pptlDitherOrg,
IN BOOL Vertical)
{
/*
RECT_ENUM RectEnum;
BOOL EnumMore;
ULONG i;
CLIPOBJ_cEnumStart(pco, FALSE, CT_RECTANGLES, CD_RIGHTDOWN, 0);
do
{
EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= y1; i++)
{
}
} while(EnumMore);
*/
return FALSE;
}
#define NLINES 3
#define VCMPCLR(a,b,c,color) (a->color != b->color || a->color != c->color)
#define VCMPCLRS(a,b,c) \
!(!VCMPCLR(a,b,c,Red) || !VCMPCLR(a,b,c,Green) || !VCMPCLR(a,b,c,Blue))
BOOL FASTCALL
IntEngGradientFillTriangle(
IN SURFOBJ *psoDest,
IN CLIPOBJ *pco,
IN XLATEOBJ *pxlo,
IN TRIVERTEX *pVertex,
IN ULONG nVertex,
IN PGRADIENT_TRIANGLE gTriangle,
IN RECTL *prclExtents,
IN POINTL *pptlDitherOrg)
{
PTRIVERTEX v1, v2, v3;
RECT_ENUM RectEnum;
BOOL EnumMore;
POINTL Translate;
INTENG_ENTER_LEAVE EnterLeave;
v1 = (pVertex + gTriangle->Vertex1);
v2 = (pVertex + gTriangle->Vertex2);
v3 = (pVertex + gTriangle->Vertex3);
/* sort */
if(v1->y > v2->y)
{
TRIVERTEX *t;
t = v1;
v1 = v2;
v2 = t;
}
if(v2->y > v3->y)
{
TRIVERTEX *t;
t = v2;
v2 = v3;
v3 = t;
if(v1->y > v2->y)
{
t = v1;
v1 = v2;
v2 = t;
}
}
DbgPrint("Triangle: (%i,%i) (%i,%i) (%i,%i)\n", v1->x, v1->y, v2->x, v2->y, v3->x, v3->y);
if(VCMPCLRS(v1, v2, v3))
{
CLIPOBJ_cEnumStart(pco, FALSE, CT_RECTANGLES, CD_RIGHTDOWN, 0);
do
{
LONG i;
RECT FillRect;
SURFOBJ *OutputObj;
SURFGDI *OutputGDI;
EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
for (i = 0; i < RectEnum.c; i++)
{
if(NtGdiIntersectRect(&FillRect, &RectEnum.arcl[i], prclExtents))
{
if(!IntEngEnter(&EnterLeave, psoDest, &FillRect, FALSE, &Translate, &OutputObj))
{
return FALSE;
}
OutputGDI = AccessInternalObjectFromUserObject(OutputObj);
/* FIXME - Render gradient triangle */
if(!IntEngLeave(&EnterLeave))
{
return FALSE;
}
}
}
} while(EnumMore);
return TRUE;
}
/* FIXME - fill triangle with one solid color */
return FALSE;
}
BOOL FASTCALL STATIC
IntEngIsNULLTriangle(TRIVERTEX *pVertex, GRADIENT_TRIANGLE *gt)
{
if(COMPAREVERTEX(VERTEX(Vertex1), VERTEX(Vertex2)))
return TRUE;
if(COMPAREVERTEX(VERTEX(Vertex1), VERTEX(Vertex3)))
return TRUE;
if(COMPAREVERTEX(VERTEX(Vertex2), VERTEX(Vertex3)))
return TRUE;
return FALSE;
}
BOOL STDCALL
EngGradientFill(
IN SURFOBJ *psoDest,
IN CLIPOBJ *pco,
IN XLATEOBJ *pxlo,
IN TRIVERTEX *pVertex,
IN ULONG nVertex,
IN PVOID pMesh,
IN ULONG nMesh,
IN RECTL *prclExtents,
IN POINTL *pptlDitherOrg,
IN ULONG ulMode)
{
ULONG i;
switch(ulMode)
{
case GRADIENT_FILL_RECT_H:
case GRADIENT_FILL_RECT_V:
{
PGRADIENT_RECT gr = (PGRADIENT_RECT)pMesh;
for(i = 0; i < nMesh; i++, gr++)
{
if(!IntEngGradientFillRect(psoDest, pco, pxlo, pVertex, nVertex, gr, prclExtents,
pptlDitherOrg, (ulMode == GRADIENT_FILL_RECT_V)))
{
return FALSE;
}
}
return TRUE;
}
case GRADIENT_FILL_TRIANGLE:
{
PGRADIENT_TRIANGLE gt = (PGRADIENT_TRIANGLE)pMesh;
for(i = 0; i < nMesh; i++, gt++)
{
if(IntEngIsNULLTriangle(pVertex, gt))
{
/* skip empty triangles */
continue;
}
if(!IntEngGradientFillTriangle(psoDest, pco, pxlo, pVertex, nVertex, gt, prclExtents,
pptlDitherOrg))
{
return FALSE;
}
}
return TRUE;
}
}
return FALSE;
}
BOOL STDCALL
IntEngGradientFill(
IN SURFOBJ *psoDest,
IN CLIPOBJ *pco,
IN XLATEOBJ *pxlo,
IN TRIVERTEX *pVertex,
IN ULONG nVertex,
IN PVOID pMesh,
IN ULONG nMesh,
IN RECTL *prclExtents,
IN POINTL *pptlDitherOrg,
IN ULONG ulMode)
{
BOOL Ret;
SURFGDI *SurfGDI;
SurfGDI = (SURFGDI*)AccessInternalObjectFromUserObject(psoDest);
MouseSafetyOnDrawStart(psoDest, SurfGDI, pco->rclBounds.left, pco->rclBounds.top,
pco->rclBounds.right, pco->rclBounds.bottom);
if((psoDest->iType != STYPE_BITMAP) && SurfGDI->GradientFill)
{
ExAcquireFastMutex(SurfGDI->DriverLock);
Ret = SurfGDI->GradientFill(psoDest, pco, pxlo, pVertex, nVertex, pMesh, nMesh,
prclExtents, pptlDitherOrg, ulMode);
ExReleaseFastMutex(SurfGDI->DriverLock);
MouseSafetyOnDrawEnd(psoDest, SurfGDI);
return Ret;
}
Ret = EngGradientFill(psoDest, pco, pxlo, pVertex, nVertex, pMesh, nMesh, prclExtents,
pptlDitherOrg, ulMode);
if(Ret)
{
/* Dummy BitBlt to let driver know that something has changed.
0x00AA0029 is the Rop for D (no-op) */
if(SurfGDI->BitBlt)
{
ExAcquireFastMutex(SurfGDI->DriverLock);
SurfGDI->BitBlt(psoDest, NULL, NULL, pco, pxlo,
prclExtents, pptlDitherOrg, NULL, NULL, NULL, 0x00AA0029);
ExReleaseFastMutex(SurfGDI->DriverLock);
MouseSafetyOnDrawEnd(psoDest, SurfGDI);
return TRUE;
}
EngBitBlt(psoDest, NULL, NULL, pco, pxlo,
prclExtents, pptlDitherOrg, NULL, NULL, NULL, 0x00AA0029);
}
MouseSafetyOnDrawEnd(psoDest, SurfGDI);
return Ret;
}

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: objects.h,v 1.27 2004/02/06 22:18:56 rcampbell Exp $
/* $Id: objects.h,v 1.28 2004/02/08 21:37:52 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -145,6 +145,8 @@ typedef HBITMAP STDCALL (*PFN_CreateDeviceBitmap)(DHPDEV, SIZEL, ULONG);
typedef BOOL STDCALL (*PFN_SetPalette)(DHPDEV, PALOBJ*, ULONG, ULONG, ULONG);
typedef BOOL STDCALL (*PFN_GradientFill)(SURFOBJ*, CLIPOBJ*, XLATEOBJ*, TRIVERTEX*, ULONG, PVOID, ULONG, RECTL*, POINTL*, ULONG);
/* Forward declare (circular reference) */
typedef struct _SURFGDI *PSURFGDI;
@ -186,6 +188,7 @@ typedef struct _SURFGDI {
PFN_SetPalette SetPalette;
PFN_MovePointer MovePointer;
PFN_SetPointerShape SetPointerShape;
PFN_GradientFill GradientFill;
/* DIB functions */
PFN_DIB_PutPixel DIB_PutPixel;

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: surface.c,v 1.30 2004/01/16 19:32:00 gvg Exp $
/* $Id: surface.c,v 1.31 2004/02/08 21:37:52 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -458,6 +458,7 @@ EngAssociateSurface(IN HSURF Surface,
if(Hooks & HOOK_COPYBITS) SurfGDI->CopyBits = Device->DriverFunctions.CopyBits;
if(Hooks & HOOK_SYNCHRONIZE) SurfGDI->Synchronize = Device->DriverFunctions.Synchronize;
if(Hooks & HOOK_SYNCHRONIZEACCESS) SurfGDI->SynchronizeAccess = TRUE;
if(Hooks & HOOK_GRADIENTFILL) SurfGDI->GradientFill = Device->DriverFunctions.GradientFill;
SurfGDI->CreateDeviceBitmap = Device->DriverFunctions.CreateDeviceBitmap;
SurfGDI->SetPalette = Device->DriverFunctions.SetPalette;

View file

@ -36,6 +36,19 @@ IntEngStretchBlt(SURFOBJ *DestObj,
POINTL *BrushOrigin,
ULONG Mode);
BOOL STDCALL
IntEngGradientFill(
SURFOBJ *psoDest,
CLIPOBJ *pco,
XLATEOBJ *pxlo,
TRIVERTEX *pVertex,
ULONG nVertex,
PVOID pMesh,
ULONG nMesh,
RECTL *prclExtents,
POINTL *pptlDitherOrg,
ULONG ulMode);
XLATEOBJ * STDCALL IntEngCreateXlate(USHORT DestPalType,
USHORT SourcePalType,
HPALETTE PaletteDest,

View file

@ -1,4 +1,4 @@
# $Id: makefile,v 1.91 2004/01/30 16:36:16 navaraf Exp $
# $Id: makefile,v 1.92 2004/02/08 21:37:52 weiden Exp $
PATH_TO_TOP = ../..
@ -41,7 +41,8 @@ TARGET_LFLAGS =\
ENG_OBJECTS= eng/debug.o eng/error.o eng/mem.o eng/brush.o eng/bitblt.o \
eng/clip.o eng/copybits.o eng/device.o eng/handle.o eng/lineto.o \
eng/paint.o eng/palette.o eng/perfcnt.o eng/semaphor.o eng/surface.o \
eng/xlate.o eng/transblt.o eng/mouse.o eng/misc.o eng/nls.o eng/sort.o
eng/xlate.o eng/transblt.o eng/mouse.o eng/misc.o eng/nls.o eng/sort.o \
eng/gradient.o
MAIN_OBJECTS = main/dllmain.o main/svctabm.o

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: driver.c,v 1.34 2003/12/12 12:54:30 gvg Exp $
/* $Id: driver.c,v 1.35 2004/02/08 21:37:53 weiden Exp $
*
* GDI Driver support routines
* (mostly swiped from Wine)
@ -229,6 +229,7 @@ BOOL DRIVER_BuildDDIFunctions(PDRVENABLEDATA DED,
if(DED->pdrvfn[i].iFunc == INDEX_DrvEnableDirectDraw) DF->EnableDirectDraw = (PGD_ENABLEDIRECTDRAW)DED->pdrvfn[i].pfn;
if(DED->pdrvfn[i].iFunc == INDEX_DrvDisableDirectDraw) DF->DisableDirectDraw = (PGD_DISABLEDIRECTDRAW)DED->pdrvfn[i].pfn;
if(DED->pdrvfn[i].iFunc == INDEX_DrvQuerySpoolType) DF->QuerySpoolType = (PGD_QUERYSPOOLTYPE)DED->pdrvfn[i].pfn;
if(DED->pdrvfn[i].iFunc == INDEX_DrvGradientFill) DF->GradientFill = (PGD_GRADIENTFILL)DED->pdrvfn[i].pfn;
}
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: fillshap.c,v 1.39 2004/02/04 22:10:00 navaraf Exp $ */
/* $Id: fillshap.c,v 1.40 2004/02/08 21:37:53 weiden Exp $ */
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
@ -31,6 +31,9 @@
#include <include/inteng.h>
#include <include/path.h>
#include <include/paint.h>
#include <include/palette.h>
#include <include/eng.h>
#include <include/intgdi.h>
#include <internal/safe.h>
#define NDEBUG
@ -1328,4 +1331,178 @@ NtGdiRoundRect(
return ret;
}
BOOL FASTCALL
IntGdiGradientFill(
DC *dc,
PTRIVERTEX pVertex,
ULONG uVertex,
PVOID pMesh,
ULONG uMesh,
ULONG ulMode)
{
SURFOBJ *SurfObj;
PPALGDI PalDestGDI;
XLATEOBJ *XlateObj;
RECTL Extent;
POINTL DitherOrg;
ULONG Mode, i;
BOOL Ret;
ASSERT(dc);
ASSERT(pVertex);
ASSERT(uVertex);
ASSERT(pMesh);
ASSERT(uMesh);
/* check parameters */
if(ulMode & GRADIENT_FILL_TRIANGLE)
{
PGRADIENT_TRIANGLE tr = (PGRADIENT_TRIANGLE)pMesh;
for(i = 0; i < uMesh; i++, tr++)
{
if(tr->Vertex1 >= uVertex ||
tr->Vertex2 >= uVertex ||
tr->Vertex3 >= uVertex)
{
SetLastWin32Error(ERROR_INVALID_PARAMETER);
return FALSE;
}
}
}
else
{
PGRADIENT_RECT rc = (PGRADIENT_RECT)pMesh;
for(i = 0; i < uMesh; i++, rc++)
{
if(rc->UpperLeft >= uVertex || rc->LowerRight >= uVertex)
{
SetLastWin32Error(ERROR_INVALID_PARAMETER);
return FALSE;
}
}
}
/* calculate extent */
Extent.left = Extent.right = pVertex->x;
Extent.top = Extent.bottom = pVertex->y;
for(i = 0; i < uVertex; i++)
{
Extent.left = min(Extent.left, (pVertex + i)->x);
Extent.right = max(Extent.right, (pVertex + i)->x);
Extent.top = min(Extent.top, (pVertex + i)->y);
Extent.bottom = max(Extent.bottom, (pVertex + i)->y);
}
DitherOrg.x = dc->w.DCOrgX;
DitherOrg.y = dc->w.DCOrgY;
Extent.left += DitherOrg.x;
Extent.right += DitherOrg.x;
Extent.top += DitherOrg.y;
Extent.bottom += DitherOrg.y;
SurfObj = (SURFOBJ*)AccessUserObject((ULONG)dc->Surface);
ASSERT(SurfObj);
PalDestGDI = PALETTE_LockPalette(dc->w.hPalette);
ASSERT(PalDestGDI);
Mode = PalDestGDI->Mode;
PALETTE_UnlockPalette(dc->w.hPalette);
XlateObj = (PXLATEOBJ)IntEngCreateXlate(Mode, PAL_RGB, dc->w.hPalette, NULL);
ASSERT(XlateObj);
Ret = IntEngGradientFill(SurfObj,
dc->CombinedClip,
XlateObj,
pVertex,
uVertex,
pMesh,
uMesh,
&Extent,
&DitherOrg,
ulMode);
EngDeleteXlate(XlateObj);
return Ret;
}
BOOL
STDCALL
NtGdiGradientFill(
HDC hdc,
PTRIVERTEX pVertex,
ULONG uVertex,
PVOID pMesh,
ULONG uMesh,
ULONG ulMode)
{
DC *dc;
BOOL Ret;
PTRIVERTEX SafeVertex;
PVOID SafeMesh;
ULONG SizeMesh;
NTSTATUS Status;
dc = DC_LockDc(hdc);
if(!dc)
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE;
}
if(!pVertex || !uVertex || !pMesh || !uMesh)
{
DC_UnlockDc(hdc);
SetLastWin32Error(ERROR_INVALID_PARAMETER);
return FALSE;
}
switch(ulMode)
{
case GRADIENT_FILL_RECT_H:
case GRADIENT_FILL_RECT_V:
SizeMesh = uMesh * sizeof(GRADIENT_RECT);
break;
case GRADIENT_FILL_TRIANGLE:
SizeMesh = uMesh * sizeof(TRIVERTEX);
break;
default:
DC_UnlockDc(hdc);
SetLastWin32Error(ERROR_INVALID_PARAMETER);
return FALSE;
}
if(!(SafeVertex = ExAllocatePool(PagedPool, (uVertex * sizeof(TRIVERTEX)) + SizeMesh)))
{
DC_UnlockDc(hdc);
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
Status = MmCopyFromCaller(SafeVertex, pVertex, uVertex * sizeof(TRIVERTEX));
if(!NT_SUCCESS(Status))
{
DC_UnlockDc(hdc);
ExFreePool(SafeVertex);
SetLastNtError(Status);
return FALSE;
}
SafeMesh = (PTRIVERTEX)(SafeVertex + uVertex);
Status = MmCopyFromCaller(SafeMesh, pMesh, SizeMesh);
if(!NT_SUCCESS(Status))
{
DC_UnlockDc(hdc);
ExFreePool(SafeVertex);
SetLastNtError(Status);
return FALSE;
}
Ret = IntGdiGradientFill(dc, SafeVertex, uVertex, SafeMesh, uMesh, ulMode);
DC_UnlockDc(hdc);
ExFreePool(SafeVertex);
return Ret;
}
/* EOF */

View file

@ -1,4 +1,4 @@
; $Id: win32k.def,v 1.22 2003/08/26 12:28:53 weiden Exp $
; $Id: win32k.def,v 1.23 2004/02/08 21:37:52 weiden Exp $
;
; win32k.def
;
@ -60,6 +60,7 @@ EngGetPrinterData@24
EngGetPrinterDataFileName@4
EngGetProcessHandle@0
EngGetType1FontList@24
EngGradientFill@40
EngLineTo@36
EngLoadImage@4
EngLoadModule@4

View file

@ -1,4 +1,4 @@
; $Id: win32k.edf,v 1.18 2003/08/26 12:28:53 weiden Exp $
; $Id: win32k.edf,v 1.19 2004/02/08 21:37:52 weiden Exp $
;
; win32k.def
;
@ -60,6 +60,7 @@ EngGetPrinterData=EngGetPrinterData@24
EngGetPrinterDataFileName=EngGetPrinterDataFileName@4
EngGetProcessHandle=EngGetProcessHandle@0
EngGetType1FontList=EngGetType1FontList@24
EngGradientFill=EngGradientFill@40
EngLineTo=EngLineTo@36
EngLoadImage=EngLoadImage@4
EngLoadModule=EngLoadModule@4