]> git.imager.perl.org - imager.git/blobdiff - hlines.c
note about JPEG for anaglyph.pl sample
[imager.git] / hlines.c
index 8b2ef18a5926f16e93e2a0072dfe9efd64d2bd27..6fc3c04e32c06e3438c33bc48deb536b19f4e1c7 100644 (file)
--- a/hlines.c
+++ b/hlines.c
@@ -68,7 +68,7 @@ i_int_init_hlines(
   int bytes = count_y * sizeof(i_int_hline_entry *);
 
   if (bytes / count_y != sizeof(i_int_hline_entry *)) {
-    m_fatal(3, "integer overflow calculating memory allocation\n");
+    i_fatal(3, "integer overflow calculating memory allocation\n");
   }
 
   hlines->start_y = start_y;
@@ -111,7 +111,7 @@ i_int_hlines_add(i_int_hlines *hlines, int y, int x, int width) {
   int x_limit = x + width;
 
   if (width < 0) {
-    m_fatal(3, "negative width %d passed to i_int_hlines_add\n", width);
+    i_fatal(3, "negative width %d passed to i_int_hlines_add\n", width);
   }
 
   /* just return if out of range */
@@ -263,8 +263,26 @@ i_int_hlines_fill_fill(im, hlines, fill)
 */
 void
 i_int_hlines_fill_fill(i_img *im, i_int_hlines *hlines, i_fill_t *fill) {
-  int y, i, x;
+  i_render r;
+  int y, i;
+
+  i_render_init(&r, im, im->xsize);
 
+  for (y = hlines->start_y; y < hlines->limit_y; ++y) {
+    i_int_hline_entry *entry = hlines->entries[y - hlines->start_y];
+    if (entry) {
+      for (i = 0; i < entry->count; ++i) {
+       i_int_hline_seg *seg = entry->segs + i;
+       int width = seg->x_limit-seg->minx;
+       
+       i_render_fill(&r, seg->minx, y, width, NULL, fill);
+      }
+    }
+  }
+  i_render_done(&r);
+  
+#if 1
+#else
   if (im->bits == i_8_bits && fill->fill_with_color) {
     i_color *line = mymalloc(sizeof(i_color) * im->xsize);
     i_color *work = NULL;
@@ -327,6 +345,7 @@ i_int_hlines_fill_fill(i_img *im, i_int_hlines *hlines, i_fill_t *fill) {
     if (work)
       myfree(work);
   }
+#endif
 }
 
 /*