Code

Small Paint Bucket optimization for creating GrayMap
authorjohncoswell <johncoswell@users.sourceforge.net>
Fri, 18 Apr 2008 01:31:11 +0000 (01:31 +0000)
committerjohncoswell <johncoswell@users.sourceforge.net>
Fri, 18 Apr 2008 01:31:11 +0000 (01:31 +0000)
src/flood-context.cpp

index f58ab0830dd4730fafdcc679d8a8d4cae4faca99..ee7f1b0da704a10952fa098ea0165faa1515fb02 100644 (file)
@@ -410,9 +410,12 @@ static void do_trace(bitmap_coords_info bci, guchar *trace_px, SPDesktop *deskto
 
     GrayMap *gray_map = GrayMapCreate(bci.width, bci.height);
     for (unsigned int y = 0; y < bci.height ; y++) {
+        unsigned long *gray_map_t = gray_map->rows[y];
+
         trace_t = get_pixel(trace_px, 0, y, bci.width);
         for (unsigned int x = 0; x < bci.width ; x++) {
-            gray_map->setPixel(gray_map, x, y, is_pixel_colored(trace_t) ? GRAYMAP_BLACK : GRAYMAP_WHITE);
+            *gray_map_t = is_pixel_colored(trace_t) ? GRAYMAP_BLACK : GRAYMAP_WHITE;
+            gray_map_t++;
             trace_t += 4;
         }
     }