sna/gen3: Improve clear-to-solid reduction
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
7ce5f4a113
commit
82023397cd
|
|
@ -2257,6 +2257,27 @@ gen3_init_radial(struct sna *sna,
|
|||
return 1;
|
||||
}
|
||||
|
||||
static Bool
|
||||
sna_picture_is_clear(PicturePtr picture,
|
||||
int x, int y, int w, int h,
|
||||
uint32_t *color)
|
||||
{
|
||||
struct sna_pixmap *priv;
|
||||
|
||||
if (!picture->pDrawable)
|
||||
return FALSE;
|
||||
|
||||
priv = sna_pixmap(get_drawable_pixmap(picture->pDrawable));
|
||||
if (priv == NULL || !priv->clear)
|
||||
return FALSE;
|
||||
|
||||
if (!source_is_covered(picture, x, y, w, h))
|
||||
return FALSE;
|
||||
|
||||
*color = priv->clear_color;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
gen3_composite_picture(struct sna *sna,
|
||||
PicturePtr picture,
|
||||
|
|
@ -2310,6 +2331,9 @@ gen3_composite_picture(struct sna *sna,
|
|||
if (sna_picture_is_solid(picture, &color))
|
||||
return gen3_init_solid(channel, color);
|
||||
|
||||
if (sna_picture_is_clear(picture, x, y, w, h, &color))
|
||||
return gen3_init_solid(channel, color);
|
||||
|
||||
if (!gen3_check_repeat(picture))
|
||||
return sna_render_picture_fixup(sna, picture, channel,
|
||||
x, y, w, h, dst_x, dst_y);
|
||||
|
|
|
|||
Loading…
Reference in New Issue