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

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

Issue 2323853002: SVGImageForContainer::imageForCurrentFrame() needs to account for zoom (Closed)
Patch Set: expectations Created 4 years, 3 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: 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 1a0fa3a5972b631c1d17daa55d420112c789bdf1..b8d3c6d8372230b3e23343cc1cb6f59df5a55942 100644
--- a/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
+++ b/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
@@ -251,7 +251,7 @@ void SVGImage::drawForContainer(SkCanvas* canvas, const SkPaint& paint, const Fl
sk_sp<SkImage> SVGImage::imageForCurrentFrame()
{
- return imageForCurrentFrameForContainer(KURL(), FloatSize(size()));
+ return imageForCurrentFrameForContainer(KURL(), size());
}
void SVGImage::drawPatternForContainer(GraphicsContext& context, const FloatSize containerSize,
@@ -289,23 +289,19 @@ void SVGImage::drawPatternForContainer(GraphicsContext& context, const FloatSize
context.drawRect(dstRect, paint);
}
-sk_sp<SkImage> SVGImage::imageForCurrentFrameForContainer(const KURL& url, const FloatSize& containerSize)
+sk_sp<SkImage> SVGImage::imageForCurrentFrameForContainer(const KURL& url, const IntSize& containerSize)
{
if (!m_page)
return nullptr;
- const FloatRect containerRect(FloatPoint(), containerSize);
+ const FloatRect containerRect((FloatPoint()), FloatSize(containerSize));
SkPictureRecorder recorder;
SkCanvas* canvas = recorder.beginRecording(containerRect);
- drawForContainer(canvas, SkPaint(), containerSize, 1, containerRect, containerRect, url);
+ drawForContainer(canvas, SkPaint(), containerRect.size(), 1, containerRect, containerRect, url);
- const IntSize imageSize = roundedIntSize(containerSize);
- const SkMatrix residualScale = SkMatrix::MakeScale(
- static_cast<float>(imageSize.width()) / containerSize.width(),
- static_cast<float>(imageSize.height()) / containerSize.height());
return SkImage::MakeFromPicture(recorder.finishRecordingAsPicture(),
- SkISize::Make(imageSize.width(), imageSize.height()), &residualScale, nullptr);
+ SkISize::Make(containerSize.width(), containerSize.height()), nullptr, nullptr);
}
static bool drawNeedsLayer(const SkPaint& paint)

Powered by Google App Engine
This is Rietveld 408576698