Title: [95782] trunk/Source/WebCore
Revision
95782
Author
[email protected]
Date
2011-09-22 21:10:24 -0700 (Thu, 22 Sep 2011)

Log Message

Use AffineTransform scale functions in ShadowBlur::adjustBlurRadius
https://bugs.webkit.org/show_bug.cgi?id=68667

Reviewed by Simon Fraser.

* platform/graphics/ShadowBlur.cpp:
(WebCore::ShadowBlur::adjustBlurRadius): Use AffineTransform::xScale and
AffineTransform::yScale instead of the custom code here that seems to do
the same thing.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (95781 => 95782)


--- trunk/Source/WebCore/ChangeLog	2011-09-23 04:00:18 UTC (rev 95781)
+++ trunk/Source/WebCore/ChangeLog	2011-09-23 04:10:24 UTC (rev 95782)
@@ -1,5 +1,17 @@
 2011-09-22  Darin Adler  <[email protected]>
 
+        Use AffineTransform scale functions in ShadowBlur::adjustBlurRadius
+        https://bugs.webkit.org/show_bug.cgi?id=68667
+
+        Reviewed by Simon Fraser.
+
+        * platform/graphics/ShadowBlur.cpp:
+        (WebCore::ShadowBlur::adjustBlurRadius): Use AffineTransform::xScale and
+        AffineTransform::yScale instead of the custom code here that seems to do
+        the same thing.
+
+2011-09-22  Darin Adler  <[email protected]>
+
         Remove unneeded type conversion from background bleed code
         https://bugs.webkit.org/show_bug.cgi?id=68669
 

Modified: trunk/Source/WebCore/platform/graphics/ShadowBlur.cpp (95781 => 95782)


--- trunk/Source/WebCore/platform/graphics/ShadowBlur.cpp	2011-09-23 04:00:18 UTC (rev 95781)
+++ trunk/Source/WebCore/platform/graphics/ShadowBlur.cpp	2011-09-23 04:10:24 UTC (rev 95782)
@@ -355,30 +355,8 @@
     if (!m_shadowsIgnoreTransforms)
         return;
 
-    const AffineTransform transform = context->getCTM();
-
-    // Adjust blur if we're scaling, since the radius must not be affected by transformations.
-    // FIXME: use AffineTransform::isIdentityOrTranslationOrFlipped()?
-    if (transform.isIdentity())
-        return;
-
-    // Calculate transformed unit vectors.
-    const FloatQuad unitQuad(FloatPoint(0, 0), FloatPoint(1, 0),
-                             FloatPoint(0, 1), FloatPoint(1, 1));
-    const FloatQuad transformedUnitQuad = transform.mapQuad(unitQuad);
-
-    // Calculate X axis scale factor.
-    const FloatSize xUnitChange = transformedUnitQuad.p2() - transformedUnitQuad.p1();
-    const float xAxisScale = sqrtf(xUnitChange.width() * xUnitChange.width()
-                                   + xUnitChange.height() * xUnitChange.height());
-
-    // Calculate Y axis scale factor.
-    const FloatSize yUnitChange = transformedUnitQuad.p3() - transformedUnitQuad.p1();
-    const float yAxisScale = sqrtf(yUnitChange.width() * yUnitChange.width()
-                                   + yUnitChange.height() * yUnitChange.height());
-
-    // Scale blur radius
-    m_blurRadius.scale(1 / xAxisScale, 1 / yAxisScale);
+    AffineTransform transform = context->getCTM();
+    m_blurRadius.scale(1 / transform.xScale(), 1 / transform.yScale());
 }
 
 IntSize ShadowBlur::blurredEdgeSize() const
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to