Author: tretiakov
Date: Sat Dec 30 23:46:05 2006
New Revision: 25249
URL:
http://svn.reactos.org/svn/reactos?rev=25249&view=rev
Log:
Implement NtGdiPolyDraw (based on wine).
Modified:
trunk/reactos/dll/win32/gdi32/gdi32.def
trunk/reactos/dll/win32/gdi32/misc/stubs.c
trunk/reactos/subsystems/win32/win32k/include/path.h
trunk/reactos/subsystems/win32/win32k/objects/line.c
Modified: trunk/reactos/dll/win32/gdi32/gdi32.def
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/gdi32.def?…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/gdi32.def (original)
+++ trunk/reactos/dll/win32/gdi32/gdi32.def Sat Dec 30 23:46:05 2006
@@ -494,7 +494,7 @@
PlgBlt@40=NtGdiPlgBlt@40
PolyBezier@12=NtGdiPolyBezier@12
PolyBezierTo@12=NtGdiPolyBezierTo@12
-PolyDraw@16
+PolyDraw@16=NtGdiPolyDraw@16
PolyPolygon@16=NtGdiPolyPolygon@16
PolyPolyline@16=NtGdiPolyPolyline@16
PolyTextOutA@12
Modified: trunk/reactos/dll/win32/gdi32/misc/stubs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/misc/stubs…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/misc/stubs.c (original)
+++ trunk/reactos/dll/win32/gdi32/misc/stubs.c Sat Dec 30 23:46:05 2006
@@ -781,24 +781,6 @@
UNIMPLEMENTED;
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
-}
-
-
-/*
- * @unimplemented
- */
-BOOL
-STDCALL
-PolyDraw(
- HDC hdc,
- CONST POINT *a1,
- CONST BYTE *a2,
- int a3
- )
-{
- UNIMPLEMENTED;
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return FALSE;
}
Modified: trunk/reactos/subsystems/win32/win32k/include/path.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/path.h (original)
+++ trunk/reactos/subsystems/win32/win32k/include/path.h Sat Dec 30 23:46:05 2006
@@ -22,4 +22,6 @@
BOOL FASTCALL PATH_RoundRect(DC *dc, INT x1, INT y1, INT x2, INT y2, INT ell_width, INT
ell_height);
BOOL FASTCALL PATH_PathToRegion (GdiPath *pPath, INT nPolyFillMode, HRGN *pHrgn);
+VOID FASTCALL IntGdiCloseFigure(PDC pDc);
+
#endif /* _WIN32K_PATH_H */
Modified: trunk/reactos/subsystems/win32/win32k/objects/line.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/line.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/line.c Sat Dec 30 23:46:05 2006
@@ -149,7 +149,6 @@
Pts = GDI_Bezier ( pt, Count, &nOut );
if ( Pts )
{
- DbgPrint("Pts = %p, no = %d\n", Pts, nOut);
ret = IntGdiPolyline(dc, Pts, nOut);
ExFreePool(Pts);
}
@@ -729,12 +728,76 @@
APIENTRY
NtGdiPolyDraw(
IN HDC hdc,
- IN LPPOINT ppt,
- IN LPBYTE pjAttr,
- IN ULONG cpt)
-{
- UNIMPLEMENTED;
- return FALSE;
+ IN LPPOINT lppt,
+ IN LPBYTE lpbTypes,
+ IN ULONG cCount)
+{
+ PDC dc;
+ BOOL result = FALSE;
+ POINT lastmove;
+ unsigned int i;
+
+ dc = DC_LockDc(hdc);
+ if(!dc) return FALSE;
+
+ _SEH_TRY
+ {
+ ProbeArrayForRead(lppt, sizeof(POINT), cCount, sizeof(LONG));
+ ProbeArrayForRead(lpbTypes, sizeof(BYTE), cCount, sizeof(BYTE));
+
+ /* check for each bezierto if there are two more points */
+ for( i = 0; i < cCount; i++ )
+ if( lpbTypes[i] != PT_MOVETO &&
+ lpbTypes[i] & PT_BEZIERTO )
+ {
+ if( cCount < i+3 ) _SEH_LEAVE;
+ else i += 2;
+ }
+
+ /* if no moveto occurs, we will close the figure here */
+ lastmove.x = dc->w.CursPosX;
+ lastmove.y = dc->w.CursPosY;
+
+ /* now let's draw */
+ for( i = 0; i < cCount; i++ )
+ {
+ if( lpbTypes[i] == PT_MOVETO )
+ {
+ IntGdiMoveToEx( dc, lppt[i].x, lppt[i].y, NULL );
+ lastmove.x = dc->w.CursPosX;
+ lastmove.y = dc->w.CursPosY;
+ }
+ else if( lpbTypes[i] & PT_LINETO )
+ IntGdiLineTo( dc, lppt[i].x, lppt[i].y );
+ else if( lpbTypes[i] & PT_BEZIERTO )
+ {
+ POINT pts[4];
+ pts[0].x = dc->w.CursPosX;
+ pts[0].y = dc->w.CursPosY;
+ RtlCopyMemory(pts + 1, lppt, sizeof(POINT) * 3);
+ IntGdiPolyBezier(dc, pts, 4);
+ i += 2;
+ }
+ else _SEH_LEAVE;
+
+ if( lpbTypes[i] & PT_CLOSEFIGURE )
+ {
+ if( PATH_IsPathOpen( dc->w.path ) ) IntGdiCloseFigure( dc );
+ else IntGdiLineTo( dc, lastmove.x, lastmove.y );
+ }
+ }
+
+ result = TRUE;
+ }
+ _SEH_HANDLE
+ {
+ SetLastNtError(_SEH_GetExceptionCode());
+ }
+ _SEH_END;
+
+ DC_UnlockDc(dc);
+
+ return result;
}
BOOL