summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-05-14 20:52:48 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2010-05-14 21:16:50 +0100
commitb9a5e36f957e42eaf0387ad15f2298d3e9538b05 (patch)
tree0a5b9751c8df12e380edc3be74aca4eff5e091cd
parenta21297d7cc5945704d8cbd28ad0a2a3f6096fa47 (diff)
uxa: enable solid rects for backends that require pixmaps
Convert the color into a (cached) pixmap if the backend cannot handle the SolidFill natively. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--uxa/uxa-render.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index 39793ba7..cf643e3b 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -860,7 +860,7 @@ uxa_solid_rects (CARD8 op,
{
ScreenPtr screen = dst->pDrawable->pScreen;
uxa_screen_t *uxa_screen = uxa_get_screen(screen);
- PixmapPtr pixmap;
+ PixmapPtr pixmap, src_pixmap = NULL;
int dst_x, dst_y;
PicturePtr src;
int error;
@@ -872,17 +872,12 @@ uxa_solid_rects (CARD8 op,
if (dst->alphaMap)
goto fallback;
- if (!uxa_screen->info->check_composite_texture)
- goto fallback;
-
pixmap = uxa_get_offscreen_pixmap(dst->pDrawable, &dst_x, &dst_y);
if (!pixmap)
goto fallback;
if (op == PictOpClear)
color->red = color->green = color->blue = color->alpha = 0;
- if (PICT_FORMAT_A(dst->format) == 0)
- color->alpha = 0xffff;
if (color->alpha >= 0xff00 && op == PictOpOver)
op = PictOpSrc;
@@ -890,17 +885,27 @@ uxa_solid_rects (CARD8 op,
if (!src)
goto fallback;
- if (!uxa_screen->info->check_composite(op, src, NULL, dst) ||
+ if (!uxa_screen->info->check_composite(op, src, NULL, dst))
+ goto err_src;
+
+ if (!uxa_screen->info->check_composite_texture ||
!uxa_screen->info->check_composite_texture(screen, src)) {
- FreePicture(src, 0);
- goto fallback;
- }
+ PicturePtr solid;
+ int src_off_x, src_off_y;
- if (!uxa_screen->info->prepare_composite(op, src, NULL, dst, NULL, NULL, pixmap)) {
+ solid = uxa_acquire_solid(screen, src->pSourcePict);
FreePicture(src, 0);
- goto fallback;
+
+ src = solid;
+ src_pixmap = uxa_get_offscreen_pixmap(src->pDrawable,
+ &src_off_x, &src_off_y);
+ if (!src_pixmap)
+ goto err_src;
}
+ if (!uxa_screen->info->prepare_composite(op, src, NULL, dst, src_pixmap, NULL, pixmap))
+ goto err_src;
+
while (num_rects--) {
uxa_screen->info->composite(pixmap,
0, 0, 0, 0,
@@ -916,6 +921,8 @@ uxa_solid_rects (CARD8 op,
return;
+err_src:
+ FreePicture(src, 0);
fallback:
uxa_screen->SavedCompositeRects(op, dst, color, num_rects, rects);
}