mesh: Avoid theoretical infinite loops

This quells this warning:

  src/cairo-mesh-pattern-rasterizer.c:731:5: warning: cannot
  optimize possibly infinite loops

I guess the compiler's complaining because if vsteps were negative or
equal to UINT_MAX the loop could cycle infinitely.  Silly compiler.

Fix as suggested by Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Bryce Harrington 2014-02-18 21:13:53 -08:00
parent 19f412bb1f
commit 44a09f462c

View file

@ -697,9 +697,9 @@ rasterize_bezier_patch (unsigned char *data, int width, int height, int stride,
cairo_point_double_t p[4][4], double col[4][4])
{
double pv[4][2][4], cstart[4], cend[4], dcstart[4], dcend[4];
int vsteps, v, i, k;
int v, i, k;
vsteps = 1 << vshift;
v = 1 << vshift;
/*
* pv[i][0] is the function (represented using forward
@ -724,11 +724,11 @@ rasterize_bezier_patch (unsigned char *data, int width, int height, int stride,
for (i = 0; i < 4; ++i) {
cstart[i] = col[0][i];
cend[i] = col[1][i];
dcstart[i] = (col[2][i] - col[0][i]) / vsteps;
dcend[i] = (col[3][i] - col[1][i]) / vsteps;
dcstart[i] = (col[2][i] - col[0][i]) / v;
dcend[i] = (col[3][i] - col[1][i]) / v;
}
for (v = 0; v <= vsteps; ++v) {
while (v--) {
cairo_point_double_t nodes[4];
for (i = 0; i < 4; ++i) {
nodes[i].x = pv[i][0][0];