From 155c92e66f5f0adbe78c40a91940a6e59244e01a Mon Sep 17 00:00:00 2001 From: "tor@cs.brown.edu" Date: Thu, 12 Jul 2007 08:42:30 -0700 Subject: [PATCH] Bug 379123 - filters on objects with some matrices not displayed. r=longsonr, sr=roc --- layout/svg/base/src/nsSVGFilterFrame.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/layout/svg/base/src/nsSVGFilterFrame.cpp b/layout/svg/base/src/nsSVGFilterFrame.cpp index 08f59f9e8414..2de39f9e1216 100644 --- a/layout/svg/base/src/nsSVGFilterFrame.cpp +++ b/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); }