Bug 362233 - merge filter with subregion misbehaves.

Patch by amenzie@us.ibm.com, r=tor, sr=roc
This commit is contained in:
tor%cs.brown.edu 2006-12-01 05:30:42 +00:00
parent 0c22a1838a
commit 88f250bdff

View File

@ -276,6 +276,14 @@ public:
return mRect; return mRect;
} }
/*
* Releasing a source image will prevent FixupTarget() from copying pixels
* outside of the filter sub-region to the target surface.
*/
void ReleaseSource() {
mSourceData = nsnull;
}
/* /*
* Returns total length of data buffer in bytes * Returns total length of data buffer in bytes
*/ */
@ -417,7 +425,13 @@ nsSVGFilterResource::FixupTarget()
// left // left
if (mRect.x > 0) { if (mRect.x > 0) {
for (PRInt32 y = mRect.y; y < mRect.y + mRect.height; y++) for (PRInt32 y = mRect.y; y < mRect.y + mRect.height; y++)
memcpy(mTargetData + y * mStride, mSourceData + y * mStride, 4 * mRect.x); if (mSourceData) {
memcpy(mTargetData + y * mStride,
mSourceData + y * mStride,
4 * mRect.x);
} else {
memset(mTargetData + y * mStride, 0, 4 * mRect.x);
}
} }
// right // right
@ -1568,6 +1582,7 @@ nsSVGFEMergeElement::Filter(nsSVGFilterInstance *instance)
cairo_set_source_surface(cr, sourceSurface, 0, 0); cairo_set_source_surface(cr, sourceSurface, 0, 0);
cairo_paint(cr); cairo_paint(cr);
} }
fr.ReleaseSource();
cairo_destroy(cr); cairo_destroy(cr);
return NS_OK; return NS_OK;
} }