summaryrefslogtreecommitdiff
path: root/uxa
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-06-08 10:24:51 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2010-06-08 19:52:46 +0100
commitf429fb9d872950705e11171d0e7407fb7673c786 (patch)
tree708d09e096cad518806ab59ed09755e1f72722f7 /uxa
parent0776a42b70f2de7b7d7d8804046c79442da1cb8a (diff)
xp:trapezoids
Diffstat (limited to 'uxa')
-rw-r--r--uxa/uxa-render.c50
-rw-r--r--uxa/uxa.c3
-rw-r--r--uxa/uxa.h5
3 files changed, 52 insertions, 6 deletions
diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index abfef8ea..6783a213 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -1759,6 +1759,7 @@ uxa_trapezoids(CARD8 op, PicturePtr src, PicturePtr dst,
int ntrap, xTrapezoid * traps)
{
ScreenPtr screen = dst->pDrawable->pScreen;
+ uxa_screen_t *uxa_screen = uxa_get_screen(screen);
BoxRec bounds;
Bool direct;
@@ -1783,12 +1784,19 @@ uxa_trapezoids(CARD8 op, PicturePtr src, PicturePtr dst,
xoff += pDraw->x;
yoff += pDraw->y;
- if (uxa_prepare_access(pDraw, UXA_ACCESS_RW)) {
- PictureScreenPtr ps = GetPictureScreen(screen);
-
- for (; ntrap; ntrap--, traps++)
- (*ps->RasterizeTrapezoid) (dst, traps, 0, 0);
- uxa_finish_access(pDraw);
+ if (!(uxa_pixmap_is_offscreen(pixmap) &&
+ uxa_screen->info->check_trapezoids &&
+ uxa_screen->info->check_trapezoids(pixmap->drawable.width,
+ pixmap->drawable.height,
+ pixmap->drawable.depth) &&
+ uxa_screen->info->rasterize_trapezoids(pixmap, FALSE, ntrap, traps, xoff, yoff))) {
+ if (uxa_prepare_access(pDraw, UXA_ACCESS_RW)) {
+ PictureScreenPtr ps = GetPictureScreen(screen);
+
+ for (; ntrap; ntrap--, traps++)
+ (*ps->RasterizeTrapezoid) (dst, traps, 0, 0);
+ uxa_finish_access(pDraw);
+ }
}
} else if (maskFormat) {
PixmapPtr scratch = NULL;
@@ -1805,6 +1813,36 @@ uxa_trapezoids(CARD8 op, PicturePtr src, PicturePtr dst,
width = bounds.x2 - bounds.x1;
height = bounds.y2 - bounds.y1;
+ if (uxa_drawable_is_offscreen(dst->pDrawable) &&
+ uxa_screen->info->check_trapezoids &&
+ uxa_screen->info->check_trapezoids(width, height, maskFormat->depth)) {
+ PixmapPtr pixmap;
+
+ pixmap = screen->CreatePixmap(screen, width, height, maskFormat->depth,
+ CREATE_PIXMAP_USAGE_SCRATCH);
+ if (uxa_screen->info->rasterize_trapezoids(pixmap, TRUE,
+ ntrap, traps,
+ -bounds.x1, -bounds.y1)) {
+ int error;
+
+ mask = CreatePicture(0, &pixmap->drawable, maskFormat,
+ 0, 0, serverClient, &error);
+ if (mask) {
+ CompositePicture(op, src, mask, dst,
+ bounds.x1 + xSrc - xDst,
+ bounds.y1 + ySrc - yDst,
+ 0, 0,
+ bounds.x1, bounds.y1,
+ width, height);
+ FreePicture(mask, 0);
+ screen->DestroyPixmap(pixmap);
+ return;
+ }
+ }
+
+ screen->DestroyPixmap(pixmap);
+ }
+
format = maskFormat->format |
(BitsPerPixel(maskFormat->depth) << 24);
image =
diff --git a/uxa/uxa.c b/uxa/uxa.c
index 8689933c..80de1aef 100644
--- a/uxa/uxa.c
+++ b/uxa/uxa.c
@@ -577,6 +577,9 @@ Bool uxa_driver_init(ScreenPtr screen, uxa_driver_t * uxa_driver)
if (uxa_driver->get_image != NULL) {
LogMessage(X_INFO, " get_image\n");
}
+ if (uxa_driver->rasterize_trapezoids != NULL) {
+ LogMessage(X_INFO, " trapezoids\n");
+ }
return TRUE;
}
diff --git a/uxa/uxa.h b/uxa/uxa.h
index e001c53d..80ac2f92 100644
--- a/uxa/uxa.h
+++ b/uxa/uxa.h
@@ -402,6 +402,11 @@ typedef struct _UxaDriver {
* This call is required if prepare_composite() ever succeeds.
*/
void (*done_composite) (PixmapPtr pDst);
+
+ Bool(*check_trapezoids) (int width, int height, int depth);
+ Bool(*rasterize_trapezoids) (PixmapPtr pixmap, Bool clear,
+ int ntraps, xTrapezoid *traps,
+ int dst_x, int dst_y);
/** @} */
/**