diff options
Diffstat (limited to 'uxa/uxa-render.c')
-rw-r--r-- | uxa/uxa-render.c | 189 |
1 files changed, 0 insertions, 189 deletions
diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c index 877b2869..1e88c5d7 100644 --- a/uxa/uxa-render.c +++ b/uxa/uxa-render.c @@ -947,195 +947,6 @@ uxa_acquire_mask(ScreenPtr screen, out_x, out_y); } -static Bool -_pixman_region_init_rectangles(pixman_region16_t *region, - int num_rects, - xRectangle *rects, - int tx, int ty) -{ - pixman_box16_t stack_boxes[64], *boxes = stack_boxes; - pixman_bool_t ret; - int i; - - if (num_rects > sizeof(stack_boxes) / sizeof(stack_boxes[0])) { - boxes = malloc(sizeof(pixman_box16_t) * num_rects); - if (boxes == NULL) - return FALSE; - } - - for (i = 0; i < num_rects; i++) { - boxes[i].x1 = rects[i].x + tx; - boxes[i].y1 = rects[i].y + ty; - boxes[i].x2 = rects[i].x + tx + rects[i].width; - boxes[i].y2 = rects[i].y + ty + rects[i].height; - } - - ret = pixman_region_init_rects(region, boxes, num_rects); - - if (boxes != stack_boxes) - free(boxes); - - return ret; -} - -void -uxa_solid_rects (CARD8 op, - PicturePtr dst, - xRenderColor *color, - int num_rects, - xRectangle *rects) -{ - ScreenPtr screen = dst->pDrawable->pScreen; - uxa_screen_t *uxa_screen = uxa_get_screen(screen); - PixmapPtr dst_pixmap, src_pixmap = NULL; - pixman_region16_t region; - pixman_box16_t *boxes, *extents; - PicturePtr src; - int dst_x, dst_y; - int num_boxes; - - if (!pixman_region_not_empty(dst->pCompositeClip)) - return; - - if (uxa_screen->info->flags & UXA_USE_GLAMOR) { - int ok; - - uxa_picture_prepare_access(dst, UXA_GLAMOR_ACCESS_RW); - ok = glamor_composite_rects_nf(op, dst, color, - num_rects, rects); - uxa_picture_finish_access(dst, UXA_GLAMOR_ACCESS_RW); - - if (!ok) - goto fallback; - - return; - } - - if (dst->alphaMap) - goto fallback; - - dst_pixmap = uxa_get_offscreen_pixmap(dst->pDrawable, &dst_x, &dst_y); - if (!dst_pixmap) - goto fallback; - - if (!_pixman_region_init_rectangles(®ion, - num_rects, rects, - dst->pDrawable->x, dst->pDrawable->y)) - goto fallback; - - if (!pixman_region_intersect(®ion, ®ion, dst->pCompositeClip)) { - pixman_region_fini(®ion); - return; - } - - pixman_region_translate(®ion, dst_x, dst_y); - boxes = pixman_region_rectangles(®ion, &num_boxes); - extents = pixman_region_extents (®ion); - - if (op == PictOpClear) - color->red = color->green = color->blue = color->alpha = 0; - if (color->alpha >= 0xff00 && op == PictOpOver) { - color->alpha = 0xffff; - op = PictOpSrc; - } - - /* Using GEM, the relocation costs outweigh the advantages of the blitter */ - if (num_boxes == 1 && (op == PictOpSrc || op == PictOpClear)) { - CARD32 pixel; - -try_solid: - if (uxa_screen->info->check_solid && - !uxa_screen->info->check_solid(&dst_pixmap->drawable, GXcopy, FB_ALLONES)) - goto err_region; - - if (!uxa_get_pixel_from_rgba(&pixel, - color->red, - color->green, - color->blue, - color->alpha, - dst->format)) - goto err_region; - - if (!uxa_screen->info->prepare_solid(dst_pixmap, GXcopy, FB_ALLONES, pixel)) - goto err_region; - - while (num_boxes--) { - uxa_screen->info->solid(dst_pixmap, - boxes->x1, boxes->y1, - boxes->x2, boxes->y2); - boxes++; - } - - uxa_screen->info->done_solid(dst_pixmap); - } else { - int error; - - src = CreateSolidPicture(0, color, &error); - if (!src) - goto err_region; - - if (!uxa_screen->info->check_composite(op, src, NULL, dst, - extents->x2 - extents->x1, - extents->y2 - extents->y1)) { - if (op == PictOpSrc || op == PictOpClear) { - FreePicture(src, 0); - goto try_solid; - } - - goto err_src; - } - - if (!uxa_screen->info->check_composite_texture || - !uxa_screen->info->check_composite_texture(screen, src)) { - PicturePtr solid; - int src_off_x, src_off_y; - - solid = uxa_acquire_solid(screen, src->pSourcePict); - if (!solid) - goto err_src; - FreePicture(src, 0); - - 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, dst_pixmap)) - goto err_src; - - while (num_boxes--) { - uxa_screen->info->composite(dst_pixmap, - 0, 0, 0, 0, - boxes->x1, - boxes->y1, - boxes->x2 - boxes->x1, - boxes->y2 - boxes->y1); - boxes++; - } - - uxa_screen->info->done_composite(dst_pixmap); - FreePicture(src, 0); - } - - /* XXX xserver-1.8: CompositeRects is not tracked by Damage, so we must - * manually append the damaged regions ourselves. - */ - pixman_region_translate(®ion, -dst_x, -dst_y); - DamageRegionAppend(dst->pDrawable, ®ion); - - pixman_region_fini(®ion); - return; - -err_src: - FreePicture(src, 0); -err_region: - pixman_region_fini(®ion); -fallback: - uxa_screen->SavedCompositeRects(op, dst, color, num_rects, rects); -} - static int uxa_try_driver_composite(CARD8 op, PicturePtr pSrc, |