Fix _glamor_set_spans() bug (re-used 'n' variable)

n was used as a function parameter.  But inside the for (i=1..n) loop,
n got reassigned as REGION_NUM_RECTS() and then decremented to zero by
the while loop.  This caused the for loop to only iterate once instead
of 'n' times.

This patch renames the n parameter to numPoints.

Found by code inspection.  Untested.

Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
This commit is contained in:
Brian Paul 2013-10-19 16:10:52 -06:00 committed by Eric Anholt
parent 2f62bd46cc
commit 3bf1eb577e

View File

@ -30,7 +30,7 @@
static Bool
_glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
DDXPointPtr points, int *widths, int n, int sorted,
DDXPointPtr points, int *widths, int numPoints, int sorted,
Bool fallback)
{
PixmapPtr dest_pixmap = glamor_get_drawable_pixmap(drawable);
@ -53,9 +53,9 @@ _glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
goto fail;
glamor_get_drawable_deltas(drawable, dest_pixmap, &x_off, &y_off);
for (i = 0; i < n; i++) {
for (i = 0; i < numPoints; i++) {
n = REGION_NUM_RECTS(clip);
int n = REGION_NUM_RECTS(clip);
pbox = REGION_RECTS(clip);
while (n--) {
int x1 = points[i].x;
@ -85,7 +85,7 @@ fail:
glamor_fallback("to %p (%c)\n",
drawable, glamor_get_drawable_location(drawable));
if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) {
fbSetSpans(drawable, gc, src, points, widths, n, sorted);
fbSetSpans(drawable, gc, src, points, widths, numPoints, sorted);
glamor_finish_access(drawable, GLAMOR_ACCESS_RW);
}
ret = TRUE;