diff dmdrawline.h @ 133:92cc5e1fa180

Some work on line drawing routines.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 05 Oct 2012 00:36:40 +0300
parents 997e26f17946
children 79dac918c81e
line wrap: on
line diff
--- a/dmdrawline.h	Thu Oct 04 15:43:10 2012 +0300
+++ b/dmdrawline.h	Fri Oct 05 00:36:40 2012 +0300
@@ -5,13 +5,14 @@
     const int qpitch = screen->pitch / DM_DRAWLINE_DST_BYTES;
 
     // Clipping
-    if (dmClipLineCoords(&x0, &y0, &x1, &y1, screen))
+    if (dmClipLineCoords(&x0, &y0, &x1, &y1, screen) < 0)
         return -1;
 
     // Compute initial deltas
     dx = (x1 - x0) * 2;
     dy = (y1 - y0) * 2;
 
+
     if (dx < 0)
     {
         dx = -dx;
@@ -32,7 +33,11 @@
     y0 *= qpitch;
     y1 *= qpitch;
 
-    DM_DRAWLINE_DST_TYPE *pix = screen->pixels;
+#ifdef DM_DRAWLINE_INIT
+    DM_DRAWLINE_INIT
+#endif
+
+    DM_DRAWLINE_DST_TYPE *pix = (DM_DRAWLINE_DST_TYPE *) screen->pixels;
 
     // Continue based on which delta is larger
     if (dx > dy)
@@ -76,3 +81,5 @@
 #undef DM_DRAWLINE_NAME
 #undef DM_DRAWLINE_DST_BYTES
 #undef DM_DRAWLINE_DST_TYPE
+#undef DM_DRAWLINE_INIT
+#undef DM_DRAWLINE_INNER