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

Unified Diff: Source/core/svg/graphics/SVGImage.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/svg/graphics/SVGImage.cpp
diff --git a/Source/core/svg/graphics/SVGImage.cpp b/Source/core/svg/graphics/SVGImage.cpp
index edf144eb476899707ddb53f71ca610ab8bcbec71..780de55a76bda19714d75545b875ca3e0789f388 100644
--- a/Source/core/svg/graphics/SVGImage.cpp
+++ b/Source/core/svg/graphics/SVGImage.cpp
@@ -285,27 +285,31 @@ void SVGImage::draw(GraphicsContext* context, const FloatRect& dstRect, const Fl
view->scrollToFragment(m_url);
{
- DisplayItemListContextRecorder contextRecorder(*context);
- GraphicsContext& paintContext = contextRecorder.context();
-
- ClipRecorder clipRecorder(paintContext, *this, DisplayItem::ClipNodeImage, LayoutRect(enclosingIntRect(dstRect)));
-
- bool hasCompositing = compositeOp != SkXfermode::kSrcOver_Mode;
- OwnPtr<CompositingRecorder> compositingRecorder;
- if (hasCompositing || opacity < 1)
- compositingRecorder = adoptPtr(new CompositingRecorder(paintContext, *this, compositeOp, opacity));
-
- // We can only draw the entire frame, clipped to the rect we want. So compute where the top left
- // of the image would be if we were drawing without clipping, and translate accordingly.
- FloatSize scale(dstRect.width() / srcRect.width(), dstRect.height() / srcRect.height());
- FloatSize topLeftOffset(srcRect.location().x() * scale.width(), srcRect.location().y() * scale.height());
- FloatPoint destOffset = dstRect.location() - topLeftOffset;
- AffineTransform transform = AffineTransform::translation(destOffset.x(), destOffset.y());
- transform.scale(scale.width(), scale.height());
- TransformRecorder transformRecorder(paintContext, *this, transform);
-
- view->updateLayoutAndStyleForPainting();
- view->paint(&paintContext, enclosingIntRect(srcRect));
+ LayoutRect paintRect(enclosingIntRect(dstRect));
+ SkPictureBuilder pictureBuilder(paintRect);
+
+ {
+ ClipRecorder clipRecorder(pictureBuilder.context(), *this, DisplayItem::ClipNodeImage, paintRect);
+
+ bool hasCompositing = compositeOp != SkXfermode::kSrcOver_Mode;
+ OwnPtr<CompositingRecorder> compositingRecorder;
+ if (hasCompositing || opacity < 1)
+ compositingRecorder = adoptPtr(new CompositingRecorder(pictureBuilder.context(), *this, compositeOp, opacity));
+
+ // We can only draw the entire frame, clipped to the rect we want. So compute where the top left
+ // of the image would be if we were drawing without clipping, and translate accordingly.
+ FloatSize scale(dstRect.width() / srcRect.width(), dstRect.height() / srcRect.height());
+ FloatSize topLeftOffset(srcRect.location().x() * scale.width(), srcRect.location().y() * scale.height());
+ FloatPoint destOffset = dstRect.location() - topLeftOffset;
+ AffineTransform transform = AffineTransform::translation(destOffset.x(), destOffset.y());
+ transform.scale(scale.width(), scale.height());
+ TransformRecorder transformRecorder(pictureBuilder.context(), *this, transform);
+
+ view->updateLayoutAndStyleForPainting();
+ view->paint(&pictureBuilder.context(), enclosingIntRect(srcRect));
+ }
+
+ pictureBuilder.endRecording()->playback(context->canvas());
ASSERT(!view->needsLayout());
}
« Source/core/paint/SVGShapePainter.cpp ('K') | « Source/core/paint/SVGShapePainter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698