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:
parent
2f62bd46cc
commit
3bf1eb577e
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
_glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
|
_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)
|
Bool fallback)
|
||||||
{
|
{
|
||||||
PixmapPtr dest_pixmap = glamor_get_drawable_pixmap(drawable);
|
PixmapPtr dest_pixmap = glamor_get_drawable_pixmap(drawable);
|
||||||
|
@ -53,9 +53,9 @@ _glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
glamor_get_drawable_deltas(drawable, dest_pixmap, &x_off, &y_off);
|
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);
|
pbox = REGION_RECTS(clip);
|
||||||
while (n--) {
|
while (n--) {
|
||||||
int x1 = points[i].x;
|
int x1 = points[i].x;
|
||||||
|
@ -85,7 +85,7 @@ fail:
|
||||||
glamor_fallback("to %p (%c)\n",
|
glamor_fallback("to %p (%c)\n",
|
||||||
drawable, glamor_get_drawable_location(drawable));
|
drawable, glamor_get_drawable_location(drawable));
|
||||||
if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) {
|
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);
|
glamor_finish_access(drawable, GLAMOR_ACCESS_RW);
|
||||||
}
|
}
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user