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

Unified Diff: Source/WebCore/svg/graphics/SVGImage.cpp

Issue 12314169: Merge 143541 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1410/
Patch Set: Created 7 years, 10 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 | « Source/WebCore/svg/graphics/SVGImage.h ('k') | Source/WebCore/svg/graphics/SVGImageCache.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/svg/graphics/SVGImage.cpp
===================================================================
--- Source/WebCore/svg/graphics/SVGImage.cpp (revision 144238)
+++ Source/WebCore/svg/graphics/SVGImage.cpp (working copy)
@@ -141,26 +141,30 @@
setImageObserver(observer);
}
-void SVGImage::drawPatternForContainer(GraphicsContext* context, const FloatSize containerSize, float pageScale, float zoom, const FloatRect& srcRect,
+void SVGImage::drawPatternForContainer(GraphicsContext* context, const FloatSize containerSize, float zoom, const FloatRect& srcRect,
const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace colorSpace, CompositeOperator compositeOp, const FloatRect& dstRect)
{
- ASSERT(pageScale);
-
FloatRect zoomedContainerRect = FloatRect(FloatPoint(), containerSize);
zoomedContainerRect.scale(zoom);
- FloatRect zoomedAndScaledContainerRect = zoomedContainerRect;
- zoomedAndScaledContainerRect.scale(pageScale);
- // FIXME(WK110065): This should take advantage of the ImageBuffer resolution instead of scaling the buffer manually.
- OwnPtr<ImageBuffer> buffer = ImageBuffer::create(expandedIntSize(zoomedAndScaledContainerRect.size()), 1);
- drawForContainer(buffer->context(), containerSize, zoom, zoomedAndScaledContainerRect, zoomedContainerRect, ColorSpaceDeviceRGB, CompositeSourceOver, BlendModeNormal);
+ // The ImageBuffer size needs to be scaled to match the final resolution.
+ AffineTransform transform = context->getCTM();
+ FloatSize imageBufferScale = FloatSize(transform.xScale(), transform.yScale());
+ ASSERT(imageBufferScale.width());
+ ASSERT(imageBufferScale.height());
+
+ FloatRect imageBufferSize = zoomedContainerRect;
+ imageBufferSize.scale(imageBufferScale.width(), imageBufferScale.height());
+
+ OwnPtr<ImageBuffer> buffer = ImageBuffer::create(expandedIntSize(imageBufferSize.size()), 1);
+ drawForContainer(buffer->context(), containerSize, zoom, imageBufferSize, zoomedContainerRect, ColorSpaceDeviceRGB, CompositeSourceOver, BlendModeNormal);
RefPtr<Image> image = buffer->copyImage(CopyBackingStore, Unscaled);
- // Adjust the source rect and transform for image buffer scale due to pageScale.
+ // Adjust the source rect and transform due to the image buffer's scaling.
FloatRect scaledSrcRect = srcRect;
- scaledSrcRect.scale(pageScale);
+ scaledSrcRect.scale(imageBufferScale.width(), imageBufferScale.height());
AffineTransform unscaledPatternTransform(patternTransform);
- unscaledPatternTransform.scale(1 / pageScale);
+ unscaledPatternTransform.scale(1 / imageBufferScale.width(), 1 / imageBufferScale.height());
image->drawPattern(context, scaledSrcRect, unscaledPatternTransform, phase, colorSpace, compositeOp, dstRect);
}
« no previous file with comments | « Source/WebCore/svg/graphics/SVGImage.h ('k') | Source/WebCore/svg/graphics/SVGImageCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698