fix a crash when using mirrorhorizontal and resizing a window to width 1

This commit is contained in:
Mikael Magnusson 2006-09-07 11:40:01 +00:00
parent 1fbc70da58
commit 6930bdb289

View file

@ -458,28 +458,30 @@ static void gradient_mirrorhorizontal(RrSurface *sf, gint w, gint h)
VARS(x); VARS(x);
SETUP(x, sf->primary, sf->secondary, w/2); SETUP(x, sf->primary, sf->secondary, w/2);
for (x = w - 1; x > w/2-1; --x) { /* 0 -> w-1 */ if (w > 1) {
current = COLOR(x); for (x = w - 1; x > w/2-1; --x) { /* 0 -> w-1 */
datav = data; current = COLOR(x);
for (y = h - 1; y >= 0; --y) { /* 0 -> h */ datav = data;
*datav = current; for (y = h - 1; y >= 0; --y) { /* 0 -> h */
datav += w; *datav = current;
} datav += w;
++data; }
++data;
NEXT(x); 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;
} }
++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); current = COLOR(x);
for (y = h - 1; y >= 0; --y) /* 0 -> h */ for (y = h - 1; y >= 0; --y) /* 0 -> h */