]> Dogcows Code - chaz/openbox/blobdiff - render/gradient.c
use ob_debug for any debug printing and only display the output when its a debug...
[chaz/openbox] / render / gradient.c
index 6f976e0b0e6843fc3b7c9b3034e377d32ee620b5..47f4850fdfbf9fc83ecbee7f43669310e076fabb 100644 (file)
@@ -21,7 +21,7 @@ void RrRender(RrAppearance *a, int w, int h)
     switch (a->surface.grad) {
     case RR_SURFACE_SOLID:
         gradient_solid(a, w, h);
-        return;
+        break;
     case RR_SURFACE_VERTICAL:
         gradient_vertical(&a->surface, w, h);
         break;
@@ -38,7 +38,7 @@ void RrRender(RrAppearance *a, int w, int h)
         gradient_pyramid(&a->surface, w, h);
         break;
     default:
-        g_message("unhandled gradient");
+        g_assert_not_reached(); /* unhandled gradient */
         return;
     }
   
@@ -334,7 +334,7 @@ static void gradient_solid(RrAppearance *l, int w, int h)
 static void gradient_horizontal(RrSurface *sf, int w, int h)
 {
     int x, y;
-    RrPixel32 *data = sf->RrPixel_data;
+    RrPixel32 *data = sf->RrPixel_data, *datav;
     RrPixel32 current;
 
     VARS(x);
@@ -342,8 +342,11 @@ static void gradient_horizontal(RrSurface *sf, int w, int h)
 
     for (x = w - 1; x > 0; --x) {  /* 0 -> w-1 */
         current = COLOR(x);
-        for (y = h - 1; y >= 0; --y)  /* 0 -> h */
-            *(data + y * w) = current;
+        datav = data;
+        for (y = h - 1; y >= 0; --y) {  /* 0 -> h */
+            *datav = current;
+            datav += w;
+        }
         ++data;
 
         NEXT(x);
@@ -530,6 +533,7 @@ static void gradient_pyramid(RrSurface *sf, int inw, int inh)
         
         NEXT(x);
     }
+    current = COLOR(x);
     *(data+x) = current;
     *(data+inw-x) = current;
     *(end-x) = current;
This page took 0.023576 seconds and 4 git commands to generate.