]> Dogcows Code - chaz/openbox/commitdiff
fix a crash when using mirrorhorizontal and resizing a window to width 1
authorMikael Magnusson <mikachu@comhem.se>
Thu, 7 Sep 2006 11:40:01 +0000 (11:40 +0000)
committerMikael Magnusson <mikachu@comhem.se>
Thu, 7 Sep 2006 11:40:01 +0000 (11:40 +0000)
render/gradient.c

index d2cb6814cc9336b792e19e9a3ce5e01807d15c1d..91fe4e27eff4e5bf76852d7c031e557f8dd6692c 100644 (file)
@@ -458,28 +458,30 @@ static void gradient_mirrorhorizontal(RrSurface *sf, gint w, gint h)
     VARS(x);
     SETUP(x, sf->primary, sf->secondary, w/2);
 
-    for (x = w - 1; x > w/2-1; --x) {  /* 0 -> w-1 */
-        current = COLOR(x);
-        datav = data;
-        for (y = h - 1; y >= 0; --y) {  /* 0 -> h */
-            *datav = current;
-            datav += w;
-        }
-        ++data;
+    if (w > 1) {
+        for (x = w - 1; x > w/2-1; --x) {  /* 0 -> w-1 */
+            current = COLOR(x);
+            datav = data;
+            for (y = h - 1; y >= 0; --y) {  /* 0 -> h */
+                *datav = current;
+                datav += w;
+            }
+            ++data;
 
-        NEXT(x);
-    }
-    SETUP(x, sf->secondary, sf->primary, w/2);
-    for (x = w/2 - 1; x > 0; --x) {  /* 0 -> w-1 */
-        current = COLOR(x);
-        datav = data;
-        for (y = h - 1; y >= 0; --y) {  /* 0 -> h */
-            *datav = current;
-            datav += w;
+            NEXT(x);
         }
-        ++data;
+        SETUP(x, sf->secondary, sf->primary, w/2);
+        for (x = w/2 - 1; x > 0; --x) {  /* 0 -> w-1 */
+            current = COLOR(x);
+            datav = data;
+            for (y = h - 1; y >= 0; --y) {  /* 0 -> h */
+                *datav = current;
+                datav += w;
+            }
+            ++data;
 
-        NEXT(x);
+            NEXT(x);
+        }
     }
     current = COLOR(x);
     for (y = h - 1; y >= 0; --y)  /* 0 -> h */
This page took 0.023592 seconds and 4 git commands to generate.