1 #include <ddk/winddi.h>
3 #include "../dib/dib.h"
5 #include <include/mouse.h>
6 #include <include/object.h>
7 #include <include/surface.h>
10 EngLineTo(SURFOBJ *Surface,
22 LONG x, y, d, deltax, deltay, i, length, xchange, ychange, error, hx, vy;
24 // These functions are assigned if we're working with a DIB
25 // The assigned functions depend on the bitsPerPixel of the DIB
26 PFN_DIB_PutPixel DIB_PutPixel;
27 PFN_DIB_HLine DIB_HLine;
28 PFN_DIB_VLine DIB_VLine;
30 SurfGDI = (SURFGDI*)AccessInternalObjectFromUserObject(Surface);
32 MouseSafetyOnDrawStart(Surface, SurfGDI, x1, y1, x2, y2);
34 if(Surface->iType!=STYPE_BITMAP)
36 // Call the driver's DrvLineTo
37 ret = SurfGDI->LineTo(Surface, Clip, Brush, x1, y1, x2, y2, RectBounds, mix);
38 MouseSafetyOnDrawEnd(Surface, SurfGDI);
42 // Assign DIB functions according to bytes per pixel
43 switch(BitsPerFormat(Surface->iBitmapFormat))
46 DIB_PutPixel = (PFN_DIB_PutPixel)DIB_1BPP_PutPixel;
47 DIB_HLine = (PFN_DIB_HLine)DIB_1BPP_HLine;
48 DIB_VLine = (PFN_DIB_VLine)DIB_1BPP_VLine;
52 DIB_PutPixel = (PFN_DIB_PutPixel)DIB_4BPP_PutPixel;
53 DIB_HLine = (PFN_DIB_HLine)DIB_4BPP_HLine;
54 DIB_VLine = (PFN_DIB_VLine)DIB_4BPP_VLine;
58 DIB_PutPixel = (PFN_DIB_PutPixel)DIB_24BPP_PutPixel;
59 DIB_HLine = (PFN_DIB_HLine)DIB_24BPP_HLine;
60 DIB_VLine = (PFN_DIB_VLine)DIB_24BPP_VLine;
64 DbgPrint("EngLineTo: unsupported DIB format %u (bitsPerPixel:%u)\n", Surface->iBitmapFormat,
65 BitsPerFormat(Surface->iBitmapFormat));
67 MouseSafetyOnDrawEnd(Surface, SurfGDI);
71 // FIXME: Implement clipping
99 if(y1==y2) { DIB_HLine(Surface, hx, hx + deltax, y1, Brush->iSolidColor); MouseSafetyOnDrawEnd(Surface, SurfGDI); return TRUE; }
100 if(x1==x2) { DIB_VLine(Surface, x1, vy, vy + deltay, Brush->iSolidColor); MouseSafetyOnDrawEnd(Surface, SurfGDI); return TRUE; }
110 DIB_PutPixel(Surface, x, y, Brush->iSolidColor);
126 DIB_PutPixel(Surface, x, y, Brush->iSolidColor);
138 MouseSafetyOnDrawEnd(Surface, SurfGDI);