glamor: Make glamor_solid_boxes take a DrawablePtr

Instead of a PixmapPtr. Gives better results if the window depth
doesn't match the backing pixmap depth.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1565
This commit is contained in:
Michel Dänzer 2023-07-19 18:00:18 +02:00 committed by Michel Dänzer
parent 2de50de563
commit d4e11f4c92
4 changed files with 7 additions and 13 deletions

View File

@ -227,12 +227,10 @@ glamor_composite_rectangles(CARD8 op,
boxes = pixman_region_rectangles(&region, &num_boxes);
if (op == PictOpSrc || op == PictOpClear) {
CARD32 pixel;
int dst_x, dst_y;
glamor_get_drawable_deltas(dst->pDrawable, pixmap, &dst_x, &dst_y);
pixman_region_translate(&region, dst_x, dst_y);
pixman_region_translate(&region, -dst->pDrawable->x, -dst->pDrawable->y);
DEBUGF("%s: pixmap +(%d, %d) extents (%d, %d),(%d, %d)\n",
DEBUGF("%s: drawable extents (%d, %d),(%d, %d)\n",
__FUNCTION__, dst_x, dst_y,
RegionExtents(&region)->x1, RegionExtents(&region)->y1,
RegionExtents(&region)->x2, RegionExtents(&region)->y2);
@ -241,7 +239,7 @@ glamor_composite_rectangles(CARD8 op,
pixel = 0;
else
miRenderColorToPixel(dst->pFormat, color, &pixel);
glamor_solid_boxes(pixmap, boxes, num_boxes, pixel);
glamor_solid_boxes(dst->pDrawable, boxes, num_boxes, pixel);
goto done;
}

View File

@ -895,7 +895,7 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
unsigned long fg_pixel);
void
glamor_solid_boxes(PixmapPtr pixmap,
glamor_solid_boxes(DrawablePtr drawable,
BoxPtr box, int nbox, unsigned long fg_pixel);

View File

@ -432,7 +432,6 @@ glamor_image_text(DrawablePtr drawable, GCPtr gc,
int c;
RegionRec region;
BoxRec box;
int off_x, off_y;
/* Check planemask before drawing background to
* bail early if it's not OK
@ -443,8 +442,6 @@ glamor_image_text(DrawablePtr drawable, GCPtr gc,
if (charinfo[c])
width += charinfo[c]->metrics.characterWidth;
glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y);
if (width >= 0) {
box.x1 = drawable->x + x;
box.x2 = drawable->x + x + width;
@ -456,8 +453,8 @@ glamor_image_text(DrawablePtr drawable, GCPtr gc,
box.y2 = drawable->y + y + gc->font->info.fontDescent;
RegionInit(&region, &box, 1);
RegionIntersect(&region, &region, gc->pCompositeClip);
RegionTranslate(&region, off_x, off_y);
glamor_solid_boxes(pixmap, RegionRects(&region), RegionNumRects(&region), gc->bgPixel);
RegionTranslate(&region, -drawable->x, -drawable->y);
glamor_solid_boxes(drawable, RegionRects(&region), RegionNumRects(&region), gc->bgPixel);
RegionUninit(&region);
}

View File

@ -23,10 +23,9 @@
#include "glamor_priv.h"
void
glamor_solid_boxes(PixmapPtr pixmap,
glamor_solid_boxes(DrawablePtr drawable,
BoxPtr box, int nbox, unsigned long fg_pixel)
{
DrawablePtr drawable = &pixmap->drawable;
GCPtr gc;
xRectangle *rect;
int n;