glamor_polyfillrect: Fixed a potential bug if fallback at glamor_fill.

We should advance the prect after we successfully excuted the
glamor_fill. And if failed, we need to add the failed 1 box
back to nbox.

Although, this bug will never happen currently, as glamor_fill
will never fallback.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
This commit is contained in:
Zhigang Gong 2012-04-10 10:19:30 +08:00 committed by Eric Anholt
parent 1f657f72ca
commit 3a91f16912

View File

@ -44,6 +44,7 @@ _glamor_poly_fill_rect(DrawablePtr drawable,
RegionPtr pClip = fbGetCompositeClip(gc); RegionPtr pClip = fbGetCompositeClip(gc);
Bool ret = FALSE; Bool ret = FALSE;
glamor_screen_private *glamor_priv; glamor_screen_private *glamor_priv;
xRectangle *saved_prect = prect;
glamor_priv = glamor_get_screen_private(drawable->pScreen); glamor_priv = glamor_get_screen_private(drawable->pScreen);
@ -55,7 +56,6 @@ _glamor_poly_fill_rect(DrawablePtr drawable,
fullY1 = prect->y + yorg; fullY1 = prect->y + yorg;
fullX2 = fullX1 + (int) prect->width; fullX2 = fullX1 + (int) prect->width;
fullY2 = fullY1 + (int) prect->height; fullY2 = fullY1 + (int) prect->height;
prect++;
n = REGION_NUM_RECTS(pClip); n = REGION_NUM_RECTS(pClip);
pbox = REGION_RECTS(pClip); pbox = REGION_RECTS(pClip);
@ -78,14 +78,17 @@ _glamor_poly_fill_rect(DrawablePtr drawable,
y1 = pbox->y1; y1 = pbox->y1;
if (pbox->y2 < y2) if (pbox->y2 < y2)
y2 = pbox->y2; y2 = pbox->y2;
pbox++;
pbox++;
if (x1 >= x2 || y1 >= y2) if (x1 >= x2 || y1 >= y2)
continue; continue;
if (!glamor_fill(drawable, gc, x1, y1, x2 - x1, if (!glamor_fill(drawable, gc, x1, y1, x2 - x1,
y2 - y1, fallback)) y2 - y1, fallback)) {
nrect++;
goto fail; goto fail;
}
} }
prect++;
} }
ret = TRUE; ret = TRUE;
goto done; goto done;