diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-09-10 16:52:36 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2014-09-10 16:55:14 +0100 |
commit | f2b62ab38f0f5970b2f868e10dc3499ff3118dbb (patch) | |
tree | e476d0c1cde569f8e6552cb3cf6c1d0c0dfcaffb /src/sna/sna_damage.h | |
parent | 9b25eeee85d32223841640c3a39901e4b63707ce (diff) |
sna: Prune damage that covers the entire target Pixmap
Reduce it early and mark it complete.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_damage.h')
-rw-r--r-- | src/sna/sna_damage.h | 56 |
1 files changed, 37 insertions, 19 deletions
diff --git a/src/sna/sna_damage.h b/src/sna/sna_damage.h index a55f8598..272e83bc 100644 --- a/src/sna/sna_damage.h +++ b/src/sna/sna_damage.h @@ -29,6 +29,25 @@ struct sna_damage { struct sna_damage *sna_damage_create(void); +struct sna_damage *__sna_damage_all(struct sna_damage *damage, + int width, int height); +static inline struct sna_damage * +_sna_damage_all(struct sna_damage *damage, + int width, int height) +{ + damage = __sna_damage_all(damage, width, height); + return DAMAGE_MARK_ALL(damage); +} + +static inline void sna_damage_all(struct sna_damage **damage, + PixmapPtr pixmap) +{ + if (!DAMAGE_IS_ALL(*damage)) + *damage = _sna_damage_all(*damage, + pixmap->drawable.width, + pixmap->drawable.height); +} + struct sna_damage *_sna_damage_combine(struct sna_damage *l, struct sna_damage *r, int dx, int dy); @@ -49,6 +68,24 @@ static inline void sna_damage_add(struct sna_damage **damage, *damage = _sna_damage_add(*damage, region); } +static inline bool sna_damage_add_to_pixmap(struct sna_damage **damage, + RegionPtr region, + PixmapPtr pixmap) +{ + assert(!DAMAGE_IS_ALL(*damage)); + if (region->data == NULL && + region->extents.x2 - region->extents.x1 >= pixmap->drawable.width && + region->extents.y2 - region->extents.y1 >= pixmap->drawable.height) { + *damage = _sna_damage_all(*damage, + pixmap->drawable.width, + pixmap->drawable.height); + return true; + } else { + *damage = _sna_damage_add(*damage, region); + return false; + } +} + fastcall struct sna_damage *_sna_damage_add_box(struct sna_damage *damage, const BoxRec *box); static inline void sna_damage_add_box(struct sna_damage **damage, @@ -131,25 +168,6 @@ static inline bool sna_damage_is_all(struct sna_damage **_damage, } } -struct sna_damage *__sna_damage_all(struct sna_damage *damage, - int width, int height); -static inline struct sna_damage * -_sna_damage_all(struct sna_damage *damage, - int width, int height) -{ - damage = __sna_damage_all(damage, width, height); - return DAMAGE_MARK_ALL(damage); -} - -static inline void sna_damage_all(struct sna_damage **damage, - PixmapPtr pixmap) -{ - if (!DAMAGE_IS_ALL(*damage)) - *damage = _sna_damage_all(*damage, - pixmap->drawable.width, - pixmap->drawable.height); -} - fastcall struct sna_damage *_sna_damage_subtract(struct sna_damage *damage, RegionPtr region); static inline void sna_damage_subtract(struct sna_damage **damage, |