summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2011-05-31 23:17:16 -0700
committerOwain G. Ainsworth <oga@openbsd.org>2011-06-24 05:51:09 +0100
commita4eaef3f379fe0977ca62bf24160e20e2d9fb648 (patch)
tree63829c8f2123ad7d0d0fe13b61b6633785490ee9
parente46c76ed62fce425a85456996c63362c92a168f7 (diff)
uxa: Simplify Composite solid acceleration for spans by only clipping once.
Unlike the previous commit removing this style of code, the code in this one was originally wrong, and would fail to clip in the second pass of clipping when y was > pbox->y2. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=37233 Reviewed-by: Keith Packard <keithp@keithp.com> (cherry picked from commit e0066e77e026b0dd0daa0c3765473c7d63aa6753) Signed-off-by: Owain G. Ainsworth <oga@openbsd.org>
-rw-r--r--uxa/uxa-accel.c79
1 files changed, 24 insertions, 55 deletions
diff --git a/uxa/uxa-accel.c b/uxa/uxa-accel.c
index 18131127..62fa3cce 100644
--- a/uxa/uxa-accel.c
+++ b/uxa/uxa-accel.c
@@ -61,11 +61,9 @@ uxa_fill_spans(DrawablePtr pDrawable, GCPtr pGC, int n,
uxa_screen_t *uxa_screen = uxa_get_screen(screen);
RegionPtr pClip = fbGetCompositeClip(pGC);
PixmapPtr dst_pixmap, src_pixmap = NULL;
- BoxPtr pextent, pbox;
+ BoxPtr pbox;
int nbox;
- int extentX1, extentX2, extentY1, extentY2;
- int x1, x2, y, fullX1, fullX2, fullY1;
- int partX1, partX2;
+ int x1, x2, y;
int off_x, off_y;
xRenderColor color;
PictFormatPtr format;
@@ -140,62 +138,35 @@ uxa_fill_spans(DrawablePtr pDrawable, GCPtr pGC, int n,
goto solid;
}
- pextent = REGION_EXTENTS(pGC->screen, pClip);
- extentX1 = pextent->x1;
- extentY1 = pextent->y1;
- extentX2 = pextent->x2;
- extentY2 = pextent->y2;
while (n--) {
- fullX1 = ppt->x;
- fullY1 = ppt->y;
- fullX2 = fullX1 + (int)*pwidth;
+ x1 = ppt->x;
+ y = ppt->y;
+ x2 = x1 + (int)*pwidth;
ppt++;
pwidth++;
- if (fullY1 < extentY1 || extentY2 <= fullY1)
- continue;
+ nbox = REGION_NUM_RECTS(pClip);
+ pbox = REGION_RECTS(pClip);
+ while (nbox--) {
+ if (pbox->y1 > y || pbox->y2 <= y)
+ continue;
- if (fullX1 < extentX1)
- fullX1 = extentX1;
+ if (x1 < pbox->x1)
+ x1 = pbox->x1;
- if (fullX2 > extentX2)
- fullX2 = extentX2;
+ if (x2 > pbox->x2)
+ x2 = pbox->x2;
- if (fullX1 >= fullX2)
- continue;
+ if (x2 <= x1)
+ continue;
- nbox = REGION_NUM_RECTS(pClip);
- if (nbox == 1) {
uxa_screen->info->composite(dst_pixmap,
- 0, 0, 0, 0,
- fullX1 + off_x,
- fullY1 + off_y,
- fullX2 - fullX1, 1);
- } else {
- pbox = REGION_RECTS(pClip);
- while (nbox--) {
- if (pbox->y1 > fullY1)
- break;
-
- if (pbox->y1 <= fullY1) {
- partX1 = pbox->x1;
- if (partX1 < fullX1)
- partX1 = fullX1;
-
- partX2 = pbox->x2;
- if (partX2 > fullX2)
- partX2 = fullX2;
-
- if (partX2 > partX1) {
- uxa_screen->info->composite(dst_pixmap,
- 0, 0, 0, 0,
- partX1 + off_x,
- fullY1 + off_y,
- partX2 - partX1, 1);
- }
- }
- pbox++;
- }
+ 0, 0,
+ 0, 0,
+ x1 + off_x, y + off_y,
+ x2 - x1, 1);
+
+ pbox++;
}
}
@@ -238,10 +209,8 @@ solid:
continue;
(*uxa_screen->info->solid) (dst_pixmap,
- x1 + off_x,
- y + off_y,
- x2 + off_x,
- y + 1 + off_y);
+ x1 + off_x, y + off_y,
+ x2 + off_x, y + 1 + off_y);
pbox++;
}
}