Changeset 65889 in webkit


Ignore:
Timestamp:
Aug 24, 2010 4:22:12 AM (14 years ago)
Author:
Nikolas Zimmermann
Message:

2010-08-24 Nikolas Zimmermann <nzimmermann@rim.com>

Reviewed by Dirk Schulze.

Markers don't render, when applied to a target using vector-effect="non-scaling-stroke"
https://bugs.webkit.org/show_bug.cgi?id=44511

Make fillAndStrokePath a member function of RenderPath, to avoid having to pass the const Path& and this paramters.
Don't leave the GraphicsContext mutated after applying non-scaling-stroke transformation, otherwhise markers will be renderer
in the wrong coordinate space, and thus don't show up anymore.

Test: svg/custom/non-scaling-stroke-markers.svg

  • rendering/RenderPath.cpp: (WebCore::RenderPath::fillAndStrokePath): (WebCore::RenderPath::paint):
  • rendering/RenderPath.h:

2010-08-24 Nikolas Zimmermann <nzimmermann@rim.com>

Reviewed by Dirk Schulze.

Markers don't render, when applied to a target using vector-effect="non-scaling-stroke"
https://bugs.webkit.org/show_bug.cgi?id=44511

Add new test verifying that markers can be appplied to objects using vector-effect="non-scaling-stroke".

  • platform/mac/svg/custom/non-scaling-stroke-markers-expected.checksum: Added.
  • platform/mac/svg/custom/non-scaling-stroke-markers-expected.png: Added.
  • platform/mac/svg/custom/non-scaling-stroke-markers-expected.txt: Added.
  • svg/custom/non-scaling-stroke-markers.svg: Added.
Location:
trunk
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r65885 r65889  
     12010-08-24  Nikolas Zimmermann  <nzimmermann@rim.com>
     2
     3        Reviewed by Dirk Schulze.
     4
     5        Markers don't render, when applied to a target using vector-effect="non-scaling-stroke"
     6        https://bugs.webkit.org/show_bug.cgi?id=44511
     7
     8        Add new test verifying that markers can be appplied to objects using vector-effect="non-scaling-stroke".
     9
     10        * platform/mac/svg/custom/non-scaling-stroke-markers-expected.checksum: Added.
     11        * platform/mac/svg/custom/non-scaling-stroke-markers-expected.png: Added.
     12        * platform/mac/svg/custom/non-scaling-stroke-markers-expected.txt: Added.
     13        * svg/custom/non-scaling-stroke-markers.svg: Added.
     14
    1152010-08-24  Andreas Kling  <andreas.kling@nokia.com>
    216
  • trunk/WebCore/ChangeLog

    r65888 r65889  
     12010-08-24  Nikolas Zimmermann  <nzimmermann@rim.com>
     2
     3        Reviewed by Dirk Schulze.
     4
     5        Markers don't render, when applied to a target using vector-effect="non-scaling-stroke"
     6        https://bugs.webkit.org/show_bug.cgi?id=44511
     7
     8        Make fillAndStrokePath a member function of RenderPath, to avoid having to pass the const Path& and this paramters.
     9        Don't leave the GraphicsContext mutated after applying non-scaling-stroke transformation, otherwhise markers will be renderer
     10        in the wrong coordinate space, and thus don't show up anymore.
     11
     12        Test: svg/custom/non-scaling-stroke-markers.svg
     13
     14        * rendering/RenderPath.cpp:
     15        (WebCore::RenderPath::fillAndStrokePath):
     16        (WebCore::RenderPath::paint):
     17        * rendering/RenderPath.h:
     18
    1192010-08-24  Adam Barth  <abarth@webkit.org>
    220
  • trunk/WebCore/rendering/RenderPath.cpp

    r65681 r65889  
    128128}
    129129
    130 static inline void fillAndStrokePath(const Path& path, GraphicsContext* context, RenderPath* object)
     130void RenderPath::fillAndStrokePath(GraphicsContext* context)
    131131{
    132132    context->beginPath();
    133     RenderStyle* style = object->style();
    134 
    135     if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(object, style)) {
    136         context->addPath(path);
    137         if (fillPaintingResource->applyResource(object, style, context, ApplyToFillMode))
    138             fillPaintingResource->postApplyResource(object, context, ApplyToFillMode);
    139     }
    140 
    141     if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(object, style)) {
    142         if (style->svgStyle()->vectorEffect() == VE_NON_SCALING_STROKE) {
    143             SVGStyledTransformableElement* element = static_cast<SVGStyledTransformableElement*>(object->node());
    144             AffineTransform transform = element->getScreenCTM(SVGLocatable::DisallowStyleUpdate);
    145             if (!transform.isInvertible())
    146                 return;
    147 
    148             Path transformedPath = path;
    149             context->concatCTM(transform.inverse());
    150             transformedPath.transform(transform);
    151             context->addPath(transformedPath);
    152         } else
    153             context->addPath(path);
    154         if (strokePaintingResource->applyResource(object, style, context, ApplyToStrokeMode))
    155             strokePaintingResource->postApplyResource(object, context, ApplyToStrokeMode);
    156     }
     133    RenderStyle* style = this->style();
     134
     135    if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(this, style)) {
     136        context->addPath(m_path);
     137        if (fillPaintingResource->applyResource(this, style, context, ApplyToFillMode))
     138            fillPaintingResource->postApplyResource(this, context, ApplyToFillMode);
     139    }
     140
     141    RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(this, style);
     142    if (!strokePaintingResource)
     143        return;
     144
     145    bool restoreContext = false;
     146    if (style->svgStyle()->vectorEffect() == VE_NON_SCALING_STROKE) {
     147        SVGStyledTransformableElement* element = static_cast<SVGStyledTransformableElement*>(node());
     148        AffineTransform nonScalingStrokeTransform = element->getScreenCTM(SVGLocatable::DisallowStyleUpdate);
     149        if (!nonScalingStrokeTransform.isInvertible())
     150            return;
     151
     152        Path transformedPath = m_path;
     153        transformedPath.transform(nonScalingStrokeTransform);
     154
     155        context->save();
     156        context->concatCTM(nonScalingStrokeTransform.inverse());
     157        context->addPath(transformedPath);
     158        restoreContext = true;
     159    } else
     160        context->addPath(m_path);
     161
     162    if (strokePaintingResource->applyResource(this, style, context, ApplyToStrokeMode))
     163        strokePaintingResource->postApplyResource(this, context, ApplyToStrokeMode);
     164
     165    if (restoreContext)
     166        context->restore();
    157167}
    158168
     
    181191                    childPaintInfo.context->setShouldAntialias(false);
    182192
    183                 fillAndStrokePath(m_path, childPaintInfo.context, this);
     193                fillAndStrokePath(childPaintInfo.context);
    184194
    185195                if (svgStyle->hasMarkers())
  • trunk/WebCore/rendering/RenderPath.h

    r64275 r65889  
    7171private:
    7272    virtual AffineTransform localTransform() const { return m_localTransform; }
     73    void fillAndStrokePath(GraphicsContext*);
    7374
    7475    bool m_needsBoundariesUpdate : 1;
Note: See TracChangeset for help on using the changeset viewer.