From ea8d9067135bc51992fb7e11bad37ea21956c56d Mon Sep 17 00:00:00 2001 From: "tor%cs.brown.edu" Date: Thu, 12 Jul 2007 15:42:30 +0000 Subject: [PATCH] Bug 379123 - filters on objects with some matrices not displayed. r=longsonr, sr=roc git-svn-id: svn://10.0.0.236/trunk@229813 18797224-902f-48f8-a5cc-f745e15eee43 --- .../layout/svg/base/src/nsSVGFilterFrame.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/mozilla/layout/svg/base/src/nsSVGFilterFrame.cpp b/mozilla/layout/svg/base/src/nsSVGFilterFrame.cpp index 08f59f9e841..2de39f9e121 100644 --- a/mozilla/layout/svg/base/src/nsSVGFilterFrame.cpp +++ b/mozilla/layout/svg/base/src/nsSVGFilterFrame.cpp @@ -185,15 +185,24 @@ nsSVGFilterFrame::FilterPaint(nsSVGRenderState *aContext, nsSVGUtils::ConvertToSurfaceSize(gfxSize(filterResX, filterResY), &resultOverflows); } else { - float s1, s2; - ctm->GetA(&s1); - ctm->GetD(&s2); + float a, b, c, d; + ctm->GetA(&a); + ctm->GetB(&b); + ctm->GetC(&c); + ctm->GetD(&d); + + // maximum expansion derivation from + // http://lists.cairographics.org/archives/cairo/2004-October/001980.html + float f = (a * a + b * b + c * c + d * d) / 2; + float g = (a * a - b * b + c * c - d * d) / 2; + float h = a * b + c * d; + float scale = sqrt(f + sqrt(g * g + h * h)); #ifdef DEBUG_tor - fprintf(stderr, "scales: %f %f\n", s1, s2); + fprintf(stderr, "scale: %f\n", scale); #endif filterRes = - nsSVGUtils::ConvertToSurfaceSize(gfxSize(s1 * width, s2 * height), + nsSVGUtils::ConvertToSurfaceSize(gfxSize(width, height) * scale, &resultOverflows); }