Changeset 207028 in webkit


Ignore:
Timestamp:
Oct 10, 2016 3:10:55 PM (8 years ago)
Author:
Brent Fulgham
Message:

[Win][Direct2D] Correct Radial Graident Bug
https://bugs.webkit.org/show_bug.cgi?id=163241

Reviewed by Darin Adler.

Radial gradients were not working correctly under Direct2D because the
points and radius values used were incorrect. D2D wants a center point and
an offset, not a start and end point. It wants an X and Y radius (for an
ellipse), not a radius at the start point, and a radius at the end point.

Covered by existing fast/gradients/css-radial-gradients.html (and others).

  • platform/graphics/Image.cpp:

(WebCore::Image::drawTiled): Remove 'notImplemented' code path.

  • platform/graphics/win/GradientDirect2D.cpp:

(WebCore::Gradient::generateGradient): Use correct input values to
the Radial Gradient constructor.
(WebCore::Gradient::fill): Generate a gradient if we have no active
one to use.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r207027 r207028  
     12016-10-10  Brent Fulgham  <bfulgham@apple.com>
     2
     3        [Win][Direct2D] Correct Radial Graident Bug
     4        https://bugs.webkit.org/show_bug.cgi?id=163241
     5
     6        Reviewed by Darin Adler.
     7
     8        Radial gradients were not working correctly under Direct2D because the
     9        points and radius values used were incorrect. D2D wants a center point and
     10        an offset, not a start and end point. It wants an X and Y radius (for an
     11        ellipse), not a radius at the start point, and a radius at the end point.
     12
     13        Covered by existing fast/gradients/css-radial-gradients.html (and others).
     14
     15        * platform/graphics/Image.cpp:
     16        (WebCore::Image::drawTiled): Remove 'notImplemented' code path.
     17        * platform/graphics/win/GradientDirect2D.cpp:
     18        (WebCore::Gradient::generateGradient): Use correct input values to
     19        the Radial Gradient constructor.
     20        (WebCore::Gradient::fill): Generate a gradient if we have no active
     21        one to use.
     22
    1232016-10-10  Jiewen Tan  <jiewen_tan@apple.com>
    224
  • trunk/Source/WebCore/platform/graphics/Image.cpp

    r206872 r207028  
    9494void Image::drawTiled(GraphicsContext& ctxt, const FloatRect& destRect, const FloatPoint& srcPoint, const FloatSize& scaledTileSize, const FloatSize& spacing, CompositeOperator op, BlendMode blendMode)
    9595{
    96 #if USE(DIRECT2D)
    97     notImplemented();
    98 #else
    9996    Color color = singlePixelSolidColor();
    10097    if (color.isValid()) {
     
    204201    startAnimation();
    205202#endif
    206 #endif
    207203}
    208204
  • trunk/Source/WebCore/platform/graphics/win/GradientDirect2D.cpp

    r206830 r207028  
    6868
    6969    if (m_radial) {
     70        FloatSize offset = p1() - p0();
    7071        ID2D1RadialGradientBrush* radialGradient = nullptr;
     72        float radiusX = endRadius() + offset.width();
     73        float radiusY = radiusX / m_aspectRatio;
    7174        hr = renderTarget->CreateRadialGradientBrush(
    72             D2D1::RadialGradientBrushProperties(p0(), p1(), startRadius(), endRadius()),
     75            D2D1::RadialGradientBrushProperties(p0(), D2D1::Point2F(offset.width(), offset.height()), radiusX, radiusY),
    7376            D2D1::BrushProperties(), gradientStopCollection.get(),
    7477            &radialGradient);
     
    110113    }
    111114
    112     if (!m_cachedHash)
     115    if (!m_cachedHash || !m_gradient)
    113116        generateGradient(d2dContext);
    114117
Note: See TracChangeset for help on using the changeset viewer.