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.
This commit is contained in:
Eric Anholt 2006-06-30 12:03:47 +02:00
parent 6ef4579139
commit f5e92542a1
2 changed files with 22 additions and 7 deletions

View File

@ -271,11 +271,16 @@ PictureResetFilters (ScreenPtr pScreen)
int int
SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int nparams) SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int nparams)
{ {
ScreenPtr pScreen = pPicture->pDrawable->pScreen; PictFilterPtr pFilter;
PictureScreenPtr ps = GetPictureScreen(pScreen);
PictFilterPtr pFilter = PictureFindFilter (pScreen, name, len);
xFixed *new_params; 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) if (!pFilter)
return BadName; return BadName;
@ -300,8 +305,13 @@ SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int
pPicture->filter_params[i] = params[i]; pPicture->filter_params[i] = params[i];
pPicture->filter = pFilter->id; pPicture->filter = pFilter->id;
result = (*ps->ChangePictureFilter) (pPicture, pPicture->filter, if (pPicture->pDrawable) {
params, nparams); ScreenPtr pScreen = pPicture->pDrawable->pScreen;
return result; PictureScreenPtr ps = GetPictureScreen(pScreen);
result = (*ps->ChangePictureFilter) (pPicture, pPicture->filter,
params, nparams);
return result;
}
return Success; return Success;
} }

View File

@ -355,7 +355,12 @@ typedef struct _PictureScreen {
*/ */
ChangePictureTransformProcPtr ChangePictureTransform; ChangePictureTransformProcPtr ChangePictureTransform;
/**
* Called immediately after a picture's transform is changed through the
* SetPictureFilter request. Not called for source-only pictures.
*/
ChangePictureFilterProcPtr ChangePictureFilter; ChangePictureFilterProcPtr ChangePictureFilter;
DestroyPictureFilterProcPtr DestroyPictureFilter; DestroyPictureFilterProcPtr DestroyPictureFilter;
TrapezoidsProcPtr Trapezoids; TrapezoidsProcPtr Trapezoids;