summaryrefslogtreecommitdiff
path: root/render/impedpict.c
diff options
context:
space:
mode:
Diffstat (limited to 'render/impedpict.c')
-rw-r--r--render/impedpict.c59
1 files changed, 49 insertions, 10 deletions
diff --git a/render/impedpict.c b/render/impedpict.c
index 8eddd647f..b0069cf0e 100644
--- a/render/impedpict.c
+++ b/render/impedpict.c
@@ -15,6 +15,7 @@
#include "drv_picturestr.h"
#include "drv_pixmapstr.h"
+
static void SyncDrvPicture(PicturePtr pPicture, DrvPicturePtr pDrvPicture,
int index)
{
@@ -32,6 +33,25 @@ static void SyncDrvPicture(PicturePtr pPicture, DrvPicturePtr pDrvPicture,
pDrvPicture->pNext = pPicture->pNext->gpu[index];
if (pPicture->alphaMap)
pDrvPicture->alphaMap = pPicture->alphaMap->gpu[index];
+
+ if (!pDrvPicture->pCompositeClip)
+ pDrvPicture->pCompositeClip = RegionCreate(NullBox, 0);
+
+ if (pPicture->pCompositeClip)
+ RegionCopy(pDrvPicture->pCompositeClip, pPicture->pCompositeClip);
+ else
+ RegionNull(pDrvPicture->pCompositeClip);
+
+}
+
+static Bool CreateSourcePict(PicturePtr pPicture, PictureScreenPtr ps)
+{
+ if (!pPicture->gpu[0]) {
+ pPicture->gpu[0] = DrvCreatePicture(NULL, pPicture->pFormat, 0, NULL);
+ if (!pPicture->gpu[0])
+ return FALSE;
+ }
+ return TRUE;
}
static int
@@ -48,6 +68,8 @@ impedCreatePicture (PicturePtr pPicture)
pPicture->gpu[0] = DrvCreatePicture(pPixmap->gpu[0], pPicture->pFormat,
0, 0);
+ if (!pPicture->gpu[0])
+ ErrorF("no gpu 0 picture\n");
SyncDrvPicture(pPicture, pPicture->gpu[0], 0);
return 0;
}
@@ -66,13 +88,21 @@ impedComposite (CARD8 op,
CARD16 width,
CARD16 height)
{
- PictureScreenPtr ps;
int x_off, y_off;
ProtoPixmapPtr pSrcPixmap = NULL, pDstPixmap, pMaskPixmap = NULL;
DrvPicturePtr pDrvSrc, pDrvMask = NULL, pDrvDst;
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
if (pSrc->pDrawable)
- pSrcPixmap = GetDrawablePixmap(pSrc->pDrawable);
+ pSrcPixmap = GetDrawablePixmap(pSrc->pDrawable);
+ else {
+ Bool ret;
+ ret = CreateSourcePict(pSrc, ps);
+ if (!ret)
+ return;
+ }
+
if (pMask)
pMaskPixmap = GetDrawablePixmap(pMask->pDrawable);
pDstPixmap = GetDrawablePixmap(pDst->pDrawable);
@@ -97,12 +127,14 @@ impedComposite (CARD8 op,
xDst += x_off;
yDst += y_off;
- ps = GetPictureScreen(pDst->pDrawable->pScreen);
-
pDrvSrc = pSrc->gpu[0];
- if (pMask)
+ SyncDrvPicture(pSrc, pDrvSrc, 0);
+ if (pMask) {
pDrvMask = pMask->gpu[0];
+ SyncDrvPicture(pMask, pDrvMask, 0);
+ }
pDrvDst = pDst->gpu[0];
+ SyncDrvPicture(pDst, pDrvDst, 0);
if (pSrcPixmap)
pDrvSrc->pPixmap = pSrcPixmap->gpu[0];
@@ -161,12 +193,19 @@ impedTrapezoids (CARD8 op,
DrvPicturePtr pDrvSrc = NULL, pDrvDst;
int i;
int x_off, y_off;
+ Bool ret;
- if (pSrc && pSrc->pDrawable) {
- pSrcPixmap = GetDrawablePixmap(pSrc->pDrawable);
- impedGetDrawableDeltas(pSrc->pDrawable, pSrcPixmap, &x_off, &y_off);
- xSrc += x_off;
- ySrc += y_off;
+ if (pSrc) {
+ if (pSrc->pDrawable) {
+ pSrcPixmap = GetDrawablePixmap(pSrc->pDrawable);
+ impedGetDrawableDeltas(pSrc->pDrawable, pSrcPixmap, &x_off, &y_off);
+ xSrc += x_off;
+ ySrc += y_off;
+ } else {
+ ret = CreateSourcePict(pSrc, ps);
+ if (!ret)
+ return;
+ }
}
pDstPixmap = GetDrawablePixmap(pDst->pDrawable);