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

Unified Diff: third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp

Issue 1498683003: Teach SVGImageForContainer::imageForCurrentFrame about the URL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@drop-image-setcontainersize
Patch Set: Created 5 years 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: third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
diff --git a/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp b/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
index 04e8195e089bea7d5ee2afa1b9a2a414a97d1c22..1dde804a5e7eb1f5d5f6d623b4340da3c9233479 100644
--- a/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
+++ b/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
@@ -218,16 +218,7 @@ void SVGImage::drawForContainer(SkCanvas* canvas, const SkPaint& paint, const Fl
PassRefPtr<SkImage> SVGImage::imageForCurrentFrame()
{
- if (!m_page)
- return nullptr;
-
- SkPictureRecorder recorder;
- SkCanvas* canvas = recorder.beginRecording(width(), height());
- drawForContainer(canvas, SkPaint(), FloatSize(size()), 1, rect(), rect(), KURL());
- RefPtr<SkPicture> picture = adoptRef(recorder.endRecording());
-
- return adoptRef(
- SkImage::NewFromPicture(picture.get(), SkISize::Make(width(), height()), nullptr, nullptr));
+ return imageForCurrentFrameForContainer(KURL());
}
void SVGImage::drawPatternForContainer(GraphicsContext* context, const FloatSize containerSize,
@@ -267,6 +258,20 @@ void SVGImage::drawPatternForContainer(GraphicsContext* context, const FloatSize
context->drawRect(dstRect, paint);
}
+PassRefPtr<SkImage> SVGImage::imageForCurrentFrameForContainer(const KURL& url)
+{
+ if (!m_page)
+ return nullptr;
+
+ SkPictureRecorder recorder;
+ SkCanvas* canvas = recorder.beginRecording(width(), height());
+ drawForContainer(canvas, SkPaint(), FloatSize(size()), 1, rect(), rect(), url);
+ RefPtr<SkPicture> picture = adoptRef(recorder.endRecording());
+
+ return adoptRef(
+ SkImage::NewFromPicture(picture.get(), SkISize::Make(width(), height()), nullptr, nullptr));
+}
+
static bool drawNeedsLayer(const SkPaint& paint)
{
if (SkColorGetA(paint.getColor()) < 255)

Powered by Google App Engine
This is Rietveld 408576698