Changeset 18681 in webkit


Ignore:
Timestamp:
Jan 8, 2007 2:51:24 PM (17 years ago)
Author:
weinig
Message:

LayoutTests:

Reviewed by Darin and Eric.

Fixes: http://bugs.webkit.org/show_bug.cgi?id=12150
Corrected results for W3C's pservers-grad-16-b.
Add a test for stop calues corner cases.

  • svg/W3C-SVG-1.1/pservers-grad-16-b-expected.checksum:
  • svg/W3C-SVG-1.1/pservers-grad-16-b-expected.png:
  • svg/W3C-SVG-1.1/pservers-grad-16-b-expected.txt:
  • svg/custom/gradient-stop-corner-cases-expected.checksum: Added.
  • svg/custom/gradient-stop-corner-cases-expected.png: Added.
  • svg/custom/gradient-stop-corner-cases-expected.txt: Added.
  • svg/custom/gradient-stop-corner-cases.svg: Added.

WebCore:

Reviewed by Darin and Eric.

Fixes: http://bugs.webkit.org/show_bug.cgi?id=12150
Handle correctly cases where no stops are defined, cases where a
stop offset value is less than previous stops offset value, and cases
where a stop offset value is greater than 1.0.


  • platform/graphics/svg/SVGPaintServerGradient.cpp: (WebCore::SVGPaintServerGradient::setGradientStops): Don't sort stops
  • platform/graphics/svg/cg/SVGPaintServerGradientCg.cpp: (WebCore::cgGradientCallback): When there are no stops, use a transparent fill (WebCore::SVGPaintServerGradient::updateQuartzGradientStopsCache): a stop offset must always be considered at greater or equal to all preceding stop offsets, but no more than 1.0
Location:
trunk
Files:
4 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r18679 r18681  
     12007-01-08  Remi Zara  <remi_zara@mac.com>
     2
     3        Reviewed by Darin and Eric.
     4
     5        Fixes: http://bugs.webkit.org/show_bug.cgi?id=12150
     6        Corrected results for W3C's pservers-grad-16-b.
     7        Add a test for stop calues corner cases.
     8
     9        * svg/W3C-SVG-1.1/pservers-grad-16-b-expected.checksum:
     10        * svg/W3C-SVG-1.1/pservers-grad-16-b-expected.png:
     11        * svg/W3C-SVG-1.1/pservers-grad-16-b-expected.txt:
     12        * svg/custom/gradient-stop-corner-cases-expected.checksum: Added.
     13        * svg/custom/gradient-stop-corner-cases-expected.png: Added.
     14        * svg/custom/gradient-stop-corner-cases-expected.txt: Added.
     15        * svg/custom/gradient-stop-corner-cases.svg: Added.
     16
    1172007-01-08  Darin Adler  <darin@apple.com>
    218
  • trunk/LayoutTests/svg/W3C-SVG-1.1/pservers-grad-16-b-expected.checksum

    r18436 r18681  
    1 498bc4ec2c76c2338c891a2a59c6eb0c
     18acbf6d2f62d72eaefd74ba51ee14158
  • trunk/LayoutTests/svg/W3C-SVG-1.1/pservers-grad-16-b-expected.txt

    r18521 r18681  
    11KRenderingPaintServer {id="defs1" [type=LINEAR-GRADIENT] [stops=[]] [start=(0,0)] [end=(0,0)]}
    22KRenderingPaintServer {id="defs2" [type=LINEAR-GRADIENT] [stops=[(1.00,#000000)]] [start=(0,0)] [end=(1,0)]}
    3 KRenderingPaintServer {id="defs3" [type=LINEAR-GRADIENT] [stops=[(0.00,#FFFF00), (0.10,#0000FF), (0.25,#FF0000), (0.50,#008000)]] [start=(0,0)] [end=(1,0)]}
     3KRenderingPaintServer {id="defs3" [type=LINEAR-GRADIENT] [stops=[(0.00,#FFFF00), (0.25,#FF0000), (0.50,#008000), (0.10,#0000FF)]] [start=(0,0)] [end=(1,0)]}
    44layer at (0,0) size 480x360
    55  RenderView at (0,0) size 480x360
     
    88        RenderPath {rect} at (19.50,9.50) size 441x81 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=LINEAR-GRADIENT] [stops=[]] [start=(0,0)] [end=(0,0)]}] [data="M20.00,10.00L460.00,10.00L460.00,90.00L20.00,90.00"]
    99        RenderPath {rect} at (20,110) size 440x80 [fill={[type=LINEAR-GRADIENT] [stops=[(1.00,#000000)]] [start=(0,0)] [end=(1,0)]}] [data="M20.00,110.00L460.00,110.00L460.00,190.00L20.00,190.00"]
    10         RenderPath {rect} at (20,210) size 440x80 [fill={[type=LINEAR-GRADIENT] [stops=[(0.00,#FFFF00), (0.10,#0000FF), (0.25,#FF0000), (0.50,#008000)]] [start=(0,0)] [end=(1,0)]}] [data="M20.00,210.00L460.00,210.00L460.00,290.00L20.00,290.00"]
     10        RenderPath {rect} at (20,210) size 440x80 [fill={[type=LINEAR-GRADIENT] [stops=[(0.00,#FFFF00), (0.25,#FF0000), (0.50,#008000), (0.10,#0000FF)]] [start=(0,0)] [end=(1,0)]}] [data="M20.00,210.00L460.00,210.00L460.00,290.00L20.00,290.00"]
    1111      RenderSVGText {text} at (10,340) size 480x46
    1212        RenderSVGInlineText {#text} at (0,-36) size 264x46
  • trunk/WebCore/ChangeLog

    r18680 r18681  
     12007-01-08  Remi Zara  <remi_zara@mac.com>
     2
     3        Reviewed by Darin and Eric.
     4
     5        Fixes: http://bugs.webkit.org/show_bug.cgi?id=12150
     6        Handle correctly cases where no stops are defined, cases where a
     7        stop offset value is less than previous stops offset value, and cases
     8        where a stop offset value is greater than 1.0.
     9       
     10        * platform/graphics/svg/SVGPaintServerGradient.cpp:
     11        (WebCore::SVGPaintServerGradient::setGradientStops): Don't sort stops
     12        * platform/graphics/svg/cg/SVGPaintServerGradientCg.cpp:
     13        (WebCore::cgGradientCallback): When there are no stops, use a transparent
     14        fill
     15        (WebCore::SVGPaintServerGradient::updateQuartzGradientStopsCache):
     16        a stop offset must always be considered at greater or equal to all
     17        preceding stop offsets, but no more than 1.0
     18
    1192007-01-08  Timothy Hatcher  <timothy@apple.com>
    220
     
    196214        Added this method to DOM and IDL, too. Made namedItem() non-virtual.
    197215
    198 >>>>>>> .r18675
    1992162007-01-08  Beth Dakin  <bdakin@apple.com>
    200217
  • trunk/WebCore/platform/graphics/svg/SVGPaintServerGradient.cpp

    r18521 r18681  
    3333
    3434namespace WebCore {
    35 
    36 // Helpers
    37 static inline bool compareStopOffset(const SVGGradientStop& first, const SVGGradientStop& second)
    38 {
    39     return first.first < second.first;
    40 }
    4135
    4236TextStream& operator<<(TextStream& ts, SVGGradientSpreadMethod m)
     
    9892{
    9993    m_stops = stops;
    100     std::sort(m_stops.begin(), m_stops.end(), compareStopOffset);
    10194}
    10295
  • trunk/WebCore/platform/graphics/svg/cg/SVGPaintServerGradientCg.cpp

    r18641 r18681  
    4646
    4747    if (!stopsCount) {
    48         outColor[0] = 0;
    49         outColor[1] = 0;
    50         outColor[2] = 0;
    51         outColor[3] = 1;
     48        memset(outColor, 0, 4 * sizeof(CGFloat));
    5249        return;
    5350    } else if (stopsCount == 1) {
     
    133130    CGFloat previousOffset = 0.0;
    134131    for (unsigned i = 0; i < stops.size(); ++i) {
    135         m_stopsCache[i].offset = stops[i].first;
    136         m_stopsCache[i].previousDeltaInverse = 1.0 / (stops[i].first - previousOffset);
    137         previousOffset = stops[i].first;
     132        CGFloat currOffset = min(max(stops[i].first, previousOffset), 1.0f);
     133        m_stopsCache[i].offset = currOffset;
     134        m_stopsCache[i].previousDeltaInverse = 1.0 / (currOffset - previousOffset);
     135        previousOffset = currOffset;
    138136        CGFloat* ca = m_stopsCache[i].colorArray;
    139137        stops[i].second.getRGBA(ca[0], ca[1], ca[2], ca[3]);
Note: See TracChangeset for help on using the changeset viewer.