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;
gradient_pyramid(&a->surface, w, h);
break;
default:
- g_message("unhandled gradient");
+ g_assert_not_reached(); /* unhandled gradient */
return;
}
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);
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);
NEXT(x);
}
+ current = COLOR(x);
*(data+x) = current;
*(data+inw-x) = current;
*(end-x) = current;