summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorEric Anholt <anholt@FreeBSD.org>2006-06-30 12:03:47 +0200
committerEric Anholt <anholt@FreeBSD.org>2006-07-03 16:40:59 +0200
commitf5e92542a14f51029347b6476e4e4af69144930b (patch)
tree9f82af357abf0f257216bfa4a458060c6af900d7 /render
parent6ef457913955d4289081c7d07d528963ccf5272c (diff)
Bug #7366: Fix crashes when setting filters on source pictures.
Now, filters may only be set on source pictures when the filter is common to all screens. Also, like SetPictureTransform, ChangePictureFilter is now not called on source pictures.
Diffstat (limited to 'render')
-rw-r--r--render/filter.c24
-rw-r--r--render/picturestr.h5
2 files changed, 22 insertions, 7 deletions
diff --git a/render/filter.c b/render/filter.c
index f81cc4a8c..61e040093 100644
--- a/render/filter.c
+++ b/render/filter.c
@@ -271,11 +271,16 @@ PictureResetFilters (ScreenPtr pScreen)
int
SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int nparams)
{
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- PictFilterPtr pFilter = PictureFindFilter (pScreen, name, len);
+ PictFilterPtr pFilter;
xFixed *new_params;
- int i, result;
+ int i, s, result;
+
+ pFilter = PictureFindFilter (screenInfo.screens[0], name, len);
+
+ for (s = 0; s < screenInfo.numScreens; s++) {
+ if (PictureFindFilter (screenInfo.screens[s], name, len) != pFilter)
+ return BadMatch;
+ }
if (!pFilter)
return BadName;
@@ -300,8 +305,13 @@ SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int
pPicture->filter_params[i] = params[i];
pPicture->filter = pFilter->id;
- result = (*ps->ChangePictureFilter) (pPicture, pPicture->filter,
- params, nparams);
- return result;
+ if (pPicture->pDrawable) {
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+
+ result = (*ps->ChangePictureFilter) (pPicture, pPicture->filter,
+ params, nparams);
+ return result;
+ }
return Success;
}
diff --git a/render/picturestr.h b/render/picturestr.h
index 25969a622..f1617f627 100644
--- a/render/picturestr.h
+++ b/render/picturestr.h
@@ -355,7 +355,12 @@ typedef struct _PictureScreen {
*/
ChangePictureTransformProcPtr ChangePictureTransform;
+ /**
+ * Called immediately after a picture's transform is changed through the
+ * SetPictureFilter request. Not called for source-only pictures.
+ */
ChangePictureFilterProcPtr ChangePictureFilter;
+
DestroyPictureFilterProcPtr DestroyPictureFilter;
TrapezoidsProcPtr Trapezoids;