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

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

Issue 1160183003: Use SkPictureBuilder in SVGShapePainter, and generalize SkPictureBuilder. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 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
Index: Source/core/paint/SVGShapePainter.cpp
diff --git a/Source/core/paint/SVGShapePainter.cpp b/Source/core/paint/SVGShapePainter.cpp
index 0cb6aff4f7cf1ed8b7011907e2fc4953563a2ae3..b7bd175c19527b6e7ca768e989198f2c8217ea6e 100644
--- a/Source/core/paint/SVGShapePainter.cpp
+++ b/Source/core/paint/SVGShapePainter.cpp
@@ -17,8 +17,9 @@
#include "core/paint/PaintInfo.h"
#include "core/paint/SVGContainerPainter.h"
#include "core/paint/SVGPaintContext.h"
+#include "core/paint/ScopeRecorder.h"
#include "core/paint/TransformRecorder.h"
-#include "platform/graphics/paint/DisplayItemListContextRecorder.h"
+#include "platform/graphics/paint/SkPictureBuilder.h"
#include "third_party/skia/include/core/SkPaint.h"
#include "third_party/skia/include/core/SkPicture.h"
@@ -100,7 +101,7 @@ void SVGShapePainter::paint(const PaintInfo& paintInfo)
}
break;
case PT_MARKERS:
- paintMarkers(paintContext.paintInfo());
+ paintMarkers(paintContext.paintInfo(), boundingBox);
break;
default:
ASSERT_NOT_REACHED();
@@ -177,7 +178,7 @@ void SVGShapePainter::strokeShape(GraphicsContext* context, const SkPaint& paint
}
}
-void SVGShapePainter::paintMarkers(const PaintInfo& paintInfo)
+void SVGShapePainter::paintMarkers(const PaintInfo& paintInfo, const FloatRect& boundingBox)
{
const Vector<MarkerPosition>* markerPositions = m_layoutSVGShape.markerPositions();
if (!markerPositions || markerPositions->isEmpty())
@@ -195,10 +196,15 @@ void SVGShapePainter::paintMarkers(const PaintInfo& paintInfo)
float strokeWidth = m_layoutSVGShape.strokeWidth();
unsigned size = markerPositions->size();
+ SkPictureBuilder pictureBuilder(boundingBox);
+ PaintInfo markersPaintInfo(paintInfo);
+ markersPaintInfo.context = &pictureBuilder.context();
pdr. 2015/06/02 21:47:52 Lets refactor this just a little. We don't really
for (unsigned i = 0; i < size; ++i) {
+ ScopeRecorder scopeRecorder(*markersPaintInfo.context, m_layoutSVGShape);
if (LayoutSVGResourceMarker* marker = SVGMarkerData::markerForType((*markerPositions)[i].type, markerStart, markerMid, markerEnd))
- paintMarker(paintInfo, *marker, (*markerPositions)[i], strokeWidth);
+ paintMarker(markersPaintInfo, *marker, (*markerPositions)[i], strokeWidth);
}
+ pictureBuilder.endRecording()->playback(paintInfo.context->canvas());
}
void SVGShapePainter::paintMarker(const PaintInfo& paintInfo, LayoutSVGResourceMarker& marker, const MarkerPosition& position, float strokeWidth)
@@ -209,16 +215,9 @@ void SVGShapePainter::paintMarker(const PaintInfo& paintInfo, LayoutSVGResourceM
if (markerElement->hasAttribute(SVGNames::viewBoxAttr) && markerElement->viewBox()->currentValue()->isValid() && markerElement->viewBox()->currentValue()->value().isEmpty())
return;
+ PaintInfo markerPaintInfo(paintInfo);
+ markerPaintInfo.rect = LayoutRect::infiniteIntRect();
{
- DisplayItemListContextRecorder contextRecorder(*paintInfo.context);
- PaintInfo markerPaintInfo(paintInfo);
- markerPaintInfo.context = &contextRecorder.context();
-
- // It's expensive to track the transformed paint cull rect for each
- // marker so just disable culling. The shape paint call will already be
- // culled if it is outside the paint info cull rect.
- markerPaintInfo.rect = LayoutRect::infiniteIntRect();
-
TransformRecorder transformRecorder(*markerPaintInfo.context, marker, marker.markerTransformation(position.origin, position.angle, strokeWidth));
OwnPtr<FloatClipRecorder> clipRecorder;
if (SVGLayoutSupport::isOverflowHidden(&marker))

Powered by Google App Engine
This is Rietveld 408576698