sna: Split get_drawable_deltas()

In some cases we know we only have a window, and so may skip a
conditional.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2013-09-07 17:27:20 +01:00
parent 218c9901e5
commit 7ee7e373f2
1 changed files with 15 additions and 5 deletions

View File

@ -434,15 +434,25 @@ CARD32 sna_render_format_for_depth(int depth);
void sna_debug_flush(struct sna *sna);
static inline bool
get_window_deltas(PixmapPtr pixmap, int16_t *x, int16_t *y)
{
#ifdef COMPOSITE
*x = -pixmap->screen_x;
*y = -pixmap->screen_y;
return pixmap->screen_x | pixmap->screen_y;
#else
*x = *y = 0;
return false;
#endif
}
static inline bool
get_drawable_deltas(DrawablePtr drawable, PixmapPtr pixmap, int16_t *x, int16_t *y)
{
#ifdef COMPOSITE
if (drawable->type == DRAWABLE_WINDOW) {
*x = -pixmap->screen_x;
*y = -pixmap->screen_y;
return pixmap->screen_x | pixmap->screen_y;
}
if (drawable->type == DRAWABLE_WINDOW)
return get_window_deltas(pixmap, x, y);
#endif
*x = *y = 0;
return false;