| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "config.h" | |
| 6 #include "core/paint/SVGMarkerPainter.h" | |
| 7 | |
| 8 #include "core/paint/SVGContainerPainter.h" | |
| 9 #include "core/rendering/PaintInfo.h" | |
| 10 #include "core/rendering/svg/RenderSVGResourceMarker.h" | |
| 11 #include "core/rendering/svg/SVGMarkerData.h" | |
| 12 #include "core/rendering/svg/SVGRenderSupport.h" | |
| 13 #include "platform/graphics/GraphicsContextStateSaver.h" | |
| 14 | |
| 15 namespace blink { | |
| 16 | |
| 17 void SVGMarkerPainter::paint(PaintInfo& paintInfo, const MarkerPosition& positio
n, float strokeWidth) | |
| 18 { | |
| 19 // An empty viewBox disables rendering. | |
| 20 SVGMarkerElement* marker = toSVGMarkerElement(m_renderSVGMarker.element()); | |
| 21 ASSERT(marker); | |
| 22 if (marker->hasAttribute(SVGNames::viewBoxAttr) && marker->viewBox()->curren
tValue()->isValid() && marker->viewBox()->currentValue()->value().isEmpty()) | |
| 23 return; | |
| 24 | |
| 25 PaintInfo info(paintInfo); | |
| 26 GraphicsContextStateSaver stateSaver(*info.context, false); | |
| 27 info.applyTransform(m_renderSVGMarker.markerTransformation(position.origin,
position.angle, strokeWidth), &stateSaver); | |
| 28 | |
| 29 if (SVGRenderSupport::isOverflowHidden(&m_renderSVGMarker)) { | |
| 30 stateSaver.saveIfNeeded(); | |
| 31 info.context->clip(m_renderSVGMarker.viewport()); | |
| 32 } | |
| 33 | |
| 34 SVGContainerPainter(m_renderSVGMarker).paint(info); | |
| 35 } | |
| 36 | |
| 37 } // namespace blink | |
| OLD | NEW |