X-Git-Url: http://git.jankratochvil.net/?p=reactos.git;a=blobdiff_plain;f=subsys%2Fwin32k%2Fobjects%2Fline.c;fp=subsys%2Fwin32k%2Fobjects%2Fline.c;h=a71e2044af7b8fa7c7e7e065d6a944caeb14d1da;hp=c4b1ac1cd68141b8e2ddd02b22e032c1f4297445;hb=7c0db166f81fbe8c8b913d7f26048e337d383605;hpb=e3ed2d773259cc445c7ff8181ebd934931365328 diff --git a/subsys/win32k/objects/line.c b/subsys/win32k/objects/line.c index c4b1ac1..a71e204 100644 --- a/subsys/win32k/objects/line.c +++ b/subsys/win32k/objects/line.c @@ -2,16 +2,19 @@ #undef WIN32_LEAN_AND_MEAN #include +#include #include #include #include #include #include #include +#include -// #define NDEBUG +#define NDEBUG #include + BOOL STDCALL W32kAngleArc(HDC hDC, @@ -109,6 +112,9 @@ W32kLineTo(HDC hDC, BOOL ret; PPENOBJ pen; PROSRGNDATA reg; +#ifndef TODO + RECT defaultrect; +#endif if(!dc) return FALSE; @@ -120,18 +126,28 @@ W32kLineTo(HDC hDC, ASSERT( pen ); // not yet implemented ASSERT( reg ); +#ifndef TODO + if (NULL == reg) { + defaultrect.left = 0; + defaultrect.top = 0; + defaultrect.right = 640; + defaultrect.bottom = 480; + + reg = &defaultrect; + } +#endif /* Draw the line according to the DC origin */ - ret = EngLineTo(SurfObj, - NULL, // ClipObj - PenToBrushObj(dc, pen), - dc->w.DCOrgX + dc->w.CursPosX, dc->w.DCOrgY + dc->w.CursPosY, - dc->w.DCOrgX + XEnd, dc->w.DCOrgY + YEnd, - reg, // Bounding rectangle - dc->w.ROPmode); // MIX - - GDIOBJ_UnlockObj( dc->w.hGCClipRgn, GO_REGION_MAGIC ); - GDIOBJ_UnlockObj( dc->w.hPen, GO_PEN_MAGIC); + ret = IntEngLineTo(SurfObj, + NULL, // ClipObj + PenToBrushObj(dc, pen), + dc->w.DCOrgX + dc->w.CursPosX, dc->w.DCOrgY + dc->w.CursPosY, + dc->w.DCOrgX + XEnd, dc->w.DCOrgY + YEnd, + reg, // Bounding rectangle + dc->w.ROPmode); // MIX + + GDIOBJ_UnlockObj( dc->w.hGCClipRgn, GO_REGION_MAGIC ); + GDIOBJ_UnlockObj( dc->w.hPen, GO_PEN_MAGIC); } if(ret) { dc->w.CursPosX = XEnd; @@ -244,7 +260,72 @@ W32kPolyline(HDC hDC, CONST LPPOINT pt, int Count) { - UNIMPLEMENTED; + DC *dc = DC_HandleToPtr(hDC); + SURFOBJ *SurfObj = (SURFOBJ*)AccessUserObject(dc->Surface); + BOOL ret; + LONG i; + PPENOBJ pen; + PROSRGNDATA reg; + POINT *pts; + + if (!dc) + return(FALSE); + + if(PATH_IsPathOpen(dc->w.path)) + { + ret = PATH_Polyline(hDC, pt, Count); + } + else + { + pen = (PPENOBJ) GDIOBJ_LockObj(dc->w.hPen, GO_PEN_MAGIC); + reg = (PROSRGNDATA)GDIOBJ_LockObj(dc->w.hGCClipRgn, GO_REGION_MAGIC); + + ASSERT( pen ); + + //FIXME: Do somthing with reg... + + //Allocate "Count" bytes of memory to hold a safe copy of pt + if (!(pts=ExAllocatePool(NonPagedPool, sizeof(POINT) * Count))) + { + GDIOBJ_UnlockObj( dc->w.hGCClipRgn, GO_REGION_MAGIC ); + GDIOBJ_UnlockObj( dc->w.hPen, GO_PEN_MAGIC); + DC_ReleasePtr( hDC ); + return(FALSE); + } + + //safly copy pt to local version + if (STATUS_SUCCESS!=MmCopyFromCaller(pts, pt, sizeof(POINT) * Count)) + { + ExFreePool(pts); + GDIOBJ_UnlockObj( dc->w.hGCClipRgn, GO_REGION_MAGIC ); + GDIOBJ_UnlockObj( dc->w.hPen, GO_PEN_MAGIC); + DC_ReleasePtr( hDC ); + return(FALSE); + } + + //offset the array of point by the dc->w.DCOrg + for(i=0; iw.DCOrgX; + pts[i].y += dc->w.DCOrgY; + } + + //get IntEngPolyline to do the drawing. + ret = IntEngPolyline(SurfObj, + NULL, + PenToBrushObj(dc, pen), + pts, + Count, + dc->w.ROPmode); + + //Clean up + ExFreePool(pts); + GDIOBJ_UnlockObj( dc->w.hGCClipRgn, GO_REGION_MAGIC ); + GDIOBJ_UnlockObj( dc->w.hPen, GO_PEN_MAGIC); + } + + DC_ReleasePtr( hDC ); + return(ret); } BOOL