Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Unified Diff: third_party/WebKit/Source/core/paint/SVGShapePainter.cpp

Issue 1914293003: SVG <marker> painting TLC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fold markerContentTransformation. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/paint/SVGShapePainter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/paint/SVGShapePainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/SVGShapePainter.cpp b/third_party/WebKit/Source/core/paint/SVGShapePainter.cpp
index 164a531636222a5ade29705fcbeb3e057d7aa535..0894edc744876aa61c92209bd65f5383ca469adf 100644
--- a/third_party/WebKit/Source/core/paint/SVGShapePainter.cpp
+++ b/third_party/WebKit/Source/core/paint/SVGShapePainter.cpp
@@ -191,10 +191,9 @@ void SVGShapePainter::paintMarkers(const PaintInfo& paintInfo, const FloatRect&
return;
float strokeWidth = m_layoutSVGShape.strokeWidth();
- unsigned size = markerPositions->size();
- for (unsigned i = 0; i < size; ++i) {
- if (LayoutSVGResourceMarker* marker = SVGMarkerData::markerForType((*markerPositions)[i].type, markerStart, markerMid, markerEnd)) {
+ for (const MarkerPosition& markerPosition : *markerPositions) {
+ if (const LayoutSVGResourceMarker* marker = SVGMarkerData::markerForType(markerPosition.type, markerStart, markerMid, markerEnd)) {
SkPictureBuilder pictureBuilder(boundingBox, nullptr, &paintInfo.context);
PaintInfo markerPaintInfo(pictureBuilder.context(), paintInfo);
@@ -203,18 +202,16 @@ void SVGShapePainter::paintMarkers(const PaintInfo& paintInfo, const FloatRect&
// be culled if it is outside the paint info cull rect.
markerPaintInfo.m_cullRect.m_rect = LayoutRect::infiniteIntRect();
- paintMarker(markerPaintInfo, *marker, (*markerPositions)[i], strokeWidth);
+ paintMarker(markerPaintInfo, *marker, markerPosition, strokeWidth);
pictureBuilder.endRecording()->playback(paintInfo.context.canvas());
}
}
}
-void SVGShapePainter::paintMarker(const PaintInfo& paintInfo, LayoutSVGResourceMarker& marker, const MarkerPosition& position, float strokeWidth)
+void SVGShapePainter::paintMarker(
+ const PaintInfo& paintInfo, const 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())
+ if (!marker.shouldPaint())
return;
TransformRecorder transformRecorder(paintInfo.context, marker, marker.markerTransformation(position.origin, position.angle, strokeWidth));
« no previous file with comments | « third_party/WebKit/Source/core/paint/SVGShapePainter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698