diff options
Diffstat (limited to 'Xprint/ps')
-rw-r--r-- | Xprint/ps/Ps.h | 1 | ||||
-rw-r--r-- | Xprint/ps/PsPixmap.c | 22 | ||||
-rw-r--r-- | Xprint/ps/PsPolygon.c | 25 |
3 files changed, 45 insertions, 3 deletions
diff --git a/Xprint/ps/Ps.h b/Xprint/ps/Ps.h index 1b1f02a1a..726cf5aae 100644 --- a/Xprint/ps/Ps.h +++ b/Xprint/ps/Ps.h @@ -566,6 +566,7 @@ extern void PsSetFillColor(DrawablePtr pDrawable, GCPtr pGC, PsOutPtr psOut, extern PixmapPtr PsCreatePixmap(ScreenPtr pScreen, int width, int height, int depth); +extern void PsScrubPixmap(PixmapPtr pPixmap); extern Bool PsDestroyPixmap(PixmapPtr pPixmap); extern DisplayListPtr PsGetFreeDisplayBlock(PsPixmapPrivPtr priv); extern void PsReplayPixmap(PixmapPtr pix, DrawablePtr pDrawable); diff --git a/Xprint/ps/PsPixmap.c b/Xprint/ps/PsPixmap.c index 6f4ca39d2..25a525b82 100644 --- a/Xprint/ps/PsPixmap.c +++ b/Xprint/ps/PsPixmap.c @@ -114,13 +114,15 @@ PsCreatePixmap( return pPixmap; } -Bool -PsDestroyPixmap(PixmapPtr pPixmap) +/* PsScrubPixmap: Remove all content from a pixmap (used by + * |PsPolyFillRect()| when the "solid fill" operation covers + * the whole pixmap) */ +void +PsScrubPixmap(PixmapPtr pPixmap) { PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pPixmap->devPrivate.ptr; DisplayListPtr disp = priv->dispList; - if( --pPixmap->refcnt ) return TRUE; while( disp ) { int i; @@ -177,6 +179,20 @@ PsDestroyPixmap(PixmapPtr pPixmap) } xfree(oldDisp); } + + priv->dispList = NULL; +} + +Bool +PsDestroyPixmap(PixmapPtr pPixmap) +{ + PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pPixmap->devPrivate.ptr; + DisplayListPtr disp = priv->dispList; + + if( --pPixmap->refcnt ) return TRUE; + + PsScrubPixmap(pPixmap); + xfree(priv); xfree(pPixmap); return TRUE; diff --git a/Xprint/ps/PsPolygon.c b/Xprint/ps/PsPolygon.c index a5b373775..dca00fa21 100644 --- a/Xprint/ps/PsPolygon.c +++ b/Xprint/ps/PsPolygon.c @@ -203,6 +203,31 @@ PsPolyFillRect( DisplayListPtr disp; GCPtr gc; +#ifdef DBE + /* Remove previous pixmap content if we render one single rect which + * covers the whole pixmap surface (this optimisation was added for + * the double-buffer extension ("DBE") which uses |PolyFillRect()| + * to clear the buffer - but it makes sense in other cases, too). + */ + if (nRects == 1) + { + extern Bool noDbeExtension; + + if ( (pRects[0].x==0) && (pRects[0].y==0) && + (pRects[0].width==pDrawable->width) && (pRects[0].height==pDrawable->height) && + (pGC->fillStyle == FillSolid) && + (noDbeExtension == False)) + { +#ifdef DEBUG_gismobile + ErrorF("PsPolyFillRect: scrubbing pixmap...\n"); +#endif /* DEBUG_gismobile */ + /* Remove all content from the pixmap as it would be covered + * by the whole rect anyway */ + PsScrubPixmap(pDrawable); + } + } +#endif /* DBE */ + if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return; disp = PsGetFreeDisplayBlock(priv); |