Changeset 95782 in webkit


Ignore:
Timestamp:
Sep 22, 2011 9:10:24 PM (13 years ago)
Author:
Darin Adler
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.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r95778 r95782  
     12011-09-22  Darin Adler  <darin@apple.com>
     2
     3        Use AffineTransform scale functions in ShadowBlur::adjustBlurRadius
     4        https://bugs.webkit.org/show_bug.cgi?id=68667
     5
     6        Reviewed by Simon Fraser.
     7
     8        * platform/graphics/ShadowBlur.cpp:
     9        (WebCore::ShadowBlur::adjustBlurRadius): Use AffineTransform::xScale and
     10        AffineTransform::yScale instead of the custom code here that seems to do
     11        the same thing.
     12
    1132011-09-22  Darin Adler  <darin@apple.com>
    214
  • trunk/Source/WebCore/platform/graphics/ShadowBlur.cpp

    r91914 r95782  
    356356        return;
    357357
    358     const AffineTransform transform = context->getCTM();
    359 
    360     // Adjust blur if we're scaling, since the radius must not be affected by transformations.
    361     // FIXME: use AffineTransform::isIdentityOrTranslationOrFlipped()?
    362     if (transform.isIdentity())
    363         return;
    364 
    365     // Calculate transformed unit vectors.
    366     const FloatQuad unitQuad(FloatPoint(0, 0), FloatPoint(1, 0),
    367                              FloatPoint(0, 1), FloatPoint(1, 1));
    368     const FloatQuad transformedUnitQuad = transform.mapQuad(unitQuad);
    369 
    370     // Calculate X axis scale factor.
    371     const FloatSize xUnitChange = transformedUnitQuad.p2() - transformedUnitQuad.p1();
    372     const float xAxisScale = sqrtf(xUnitChange.width() * xUnitChange.width()
    373                                    + xUnitChange.height() * xUnitChange.height());
    374 
    375     // Calculate Y axis scale factor.
    376     const FloatSize yUnitChange = transformedUnitQuad.p3() - transformedUnitQuad.p1();
    377     const float yAxisScale = sqrtf(yUnitChange.width() * yUnitChange.width()
    378                                    + yUnitChange.height() * yUnitChange.height());
    379 
    380     // Scale blur radius
    381     m_blurRadius.scale(1 / xAxisScale, 1 / yAxisScale);
     358    AffineTransform transform = context->getCTM();
     359    m_blurRadius.scale(1 / transform.xScale(), 1 / transform.yScale());
    382360}
    383361
Note: See TracChangeset for help on using the changeset viewer.