glamor: Add glamor_prepare_access_gc() from UXA.

This commit is contained in:
Eric Anholt 2010-02-08 12:09:52 +01:00 committed by Zhigang Gong
parent 72a757ba00
commit 55dac9b42e
2 changed files with 38 additions and 0 deletions

View File

@ -429,6 +429,42 @@ glamor_finish_access(DrawablePtr drawable)
xfree(pixmap->devPrivate.ptr);
pixmap->devPrivate.ptr = NULL;
}
/**
* Calls uxa_prepare_access with UXA_PREPARE_SRC for the tile, if that is the
* current fill style.
*
* Solid doesn't use an extra pixmap source, so we don't worry about them.
* Stippled/OpaqueStippled are 1bpp and can be in fb, so we should worry
* about them.
*/
Bool
glamor_prepare_access_gc(GCPtr gc)
{
if (gc->stipple)
if (!glamor_prepare_access(&gc->stipple->drawable, GLAMOR_ACCESS_RO))
return FALSE;
if (gc->fillStyle == FillTiled) {
if (!glamor_prepare_access (&gc->tile.pixmap->drawable,
GLAMOR_ACCESS_RO)) {
if (gc->stipple)
glamor_finish_access(&gc->stipple->drawable);
return FALSE;
}
}
return TRUE;
}
/**
* Finishes access to the tile in the GC, if used.
*/
void
glamor_finish_access_gc(GCPtr gc)
{
if (gc->fillStyle == FillTiled)
glamor_finish_access(&gc->tile.pixmap->drawable);
if (gc->stipple)
glamor_finish_access(&gc->stipple->drawable);
}
void
glamor_stipple(PixmapPtr pixmap, PixmapPtr stipple,

View File

@ -140,6 +140,8 @@ Bool glamor_prepare_access(DrawablePtr drawable, glamor_access_t access);
void glamor_finish_access(DrawablePtr drawable);
Bool glamor_prepare_access_window(WindowPtr window);
void glamor_finish_access_window(WindowPtr window);
Bool glamor_prepare_access_gc(GCPtr gc);
void glamor_finish_access_gc(GCPtr gc);
const Bool glamor_get_drawable_location(const DrawablePtr drawable);
Bool glamor_create_gc(GCPtr gc);
void glamor_stipple(PixmapPtr pixmap, PixmapPtr stipple,