void SVGShapePainter::paintMarker(const PaintInfo& paintInfo, RenderSVGResourceMarker& marker, const MarkerPosition& position, float strokeWidth) { // An empty viewBox disables rendering. SVGMarkerElement* markerElement = toSVGMarkerElement(marker.element()); ASSERT(markerElement); if (markerElement->hasAttribute(SVGNames::viewBoxAttr) && markerElement->viewBox()->currentValue()->isValid() && markerElement->viewBox()->currentValue()->value().isEmpty()) return; OwnPtr<DisplayItemList> displayItemList; if (RuntimeEnabledFeatures::slimmingPaintEnabled()) displayItemList = DisplayItemList::create(); GraphicsContext recordingContext(nullptr, displayItemList.get()); recordingContext.beginRecording(m_renderSVGShape.paintInvalidationRectInLocalCoordinates()); PaintInfo markerPaintInfo(paintInfo); markerPaintInfo.context = &recordingContext; { TransformRecorder transformRecorder(*markerPaintInfo.context, marker.displayItemClient(), marker.markerTransformation(position.origin, position.angle, strokeWidth)); OwnPtr<FloatClipRecorder> clipRecorder; if (SVGRenderSupport::isOverflowHidden(&marker)) clipRecorder = adoptPtr(new FloatClipRecorder(recordingContext, marker.displayItemClient(), markerPaintInfo.phase, marker.viewport())); SVGContainerPainter(marker).paint(markerPaintInfo); } if (displayItemList) displayItemList->replay(&recordingContext); RefPtr<const SkPicture> recording = recordingContext.endRecording(); paintInfo.context->drawPicture(recording.get()); }
void RenderSVGResourceMarker::draw(PaintInfo& paintInfo, const AffineTransform& transform) { // An empty viewBox disables rendering. SVGMarkerElement* marker = toSVGMarkerElement(element()); ASSERT(marker); if (marker->hasAttribute(SVGNames::viewBoxAttr) && marker->viewBoxCurrentValue().isValid() && marker->viewBoxCurrentValue().isEmpty()) return; PaintInfo info(paintInfo); GraphicsContextStateSaver stateSaver(*info.context); info.applyTransform(transform); RenderSVGContainer::paint(info, IntPoint()); }
void SVGShapePainter::paintMarker(const PaintInfo& paintInfo, LayoutSVGResourceMarker& marker, const MarkerPosition& position, float strokeWidth) { // An empty viewBox disables rendering. SVGMarkerElement* markerElement = toSVGMarkerElement(marker.element()); ASSERT(markerElement); if (markerElement->hasAttribute(SVGNames::viewBoxAttr) && markerElement->viewBox()->currentValue()->isValid() && markerElement->viewBox()->currentValue()->value().isEmpty()) return; TransformRecorder transformRecorder(paintInfo.context, marker, marker.markerTransformation(position.origin, position.angle, strokeWidth)); Optional<FloatClipRecorder> clipRecorder; if (SVGLayoutSupport::isOverflowHidden(&marker)) clipRecorder.emplace(paintInfo.context, marker, paintInfo.phase, marker.viewport()); SVGContainerPainter(marker).paint(paintInfo); }
void RenderSVGResourceMarker::draw(PaintInfo& paintInfo, const AffineTransform& transform) { clearInvalidationMask(); // An empty viewBox disables rendering. SVGMarkerElement* marker = toSVGMarkerElement(element()); ASSERT(marker); if (marker->hasAttribute(SVGNames::viewBoxAttr) && marker->viewBox()->currentValue()->isValid() && marker->viewBox()->currentValue()->value().isEmpty()) return; PaintInfo info(paintInfo); GraphicsContextStateSaver stateSaver(*info.context, false); if (!transform.isIdentity()) { stateSaver.save(); info.applyTransform(transform, false); } RenderSVGContainer::paint(info, IntPoint()); }
void SVGMarkerPainter::paint(PaintInfo& paintInfo, const MarkerPosition& position, float strokeWidth) { // An empty viewBox disables rendering. SVGMarkerElement* marker = toSVGMarkerElement(m_renderSVGMarker.element()); ASSERT(marker); if (marker->hasAttribute(SVGNames::viewBoxAttr) && marker->viewBox()->currentValue()->isValid() && marker->viewBox()->currentValue()->value().isEmpty()) return; PaintInfo info(paintInfo); GraphicsContextStateSaver stateSaver(*info.context, false); info.applyTransform(m_renderSVGMarker.markerTransformation(position.origin, position.angle, strokeWidth), &stateSaver); if (SVGRenderSupport::isOverflowHidden(&m_renderSVGMarker)) { stateSaver.saveIfNeeded(); info.context->clip(m_renderSVGMarker.viewport()); } SVGContainerPainter(m_renderSVGMarker).paint(info); }