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

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

Issue 105363002: Make SVG images for custom CSS cursors appear sharp on retina displays (Closed) Base URL: http://src.chromium.org/blink/trunk/
Patch Set: Created 7 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
« no previous file with comments | « Source/core/svg/graphics/SVGImage.h ('k') | Source/core/svg/graphics/SVGImageForContainer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/graphics/SVGImage.cpp
===================================================================
--- Source/core/svg/graphics/SVGImage.cpp (revision 162906)
+++ Source/core/svg/graphics/SVGImage.cpp (working copy)
@@ -52,8 +52,9 @@
namespace WebCore {
-SVGImage::SVGImage(ImageObserver* observer)
+SVGImage::SVGImage(ImageObserver* observer, float deviceScaleFactor)
: Image(observer)
+ , m_deviceScaleFactor(deviceScaleFactor)
{
}
@@ -187,16 +188,20 @@
draw(context, dstRect, scaledSrc, compositeOp, blendMode);
}
-PassRefPtr<NativeImageSkia> SVGImage::nativeImageForCurrentFrame()
+PassRefPtr<NativeImageSkia> SVGImage::nativeImageForCurrentFrame(ScaleHint hint)
{
if (!m_page)
return 0;
- OwnPtr<ImageBuffer> buffer = ImageBuffer::create(size(), 1);
+ IntSize scaledSize = size();
+ float scale = hint == PreferDeviceScale ? m_deviceScaleFactor : 1;
+ scaledSize.scale(scale);
+
+ OwnPtr<ImageBuffer> buffer = ImageBuffer::create(scaledSize, 1);
if (!buffer) // failed to allocate image
return 0;
- drawForContainer(buffer->context(), size(), 1, rect(), rect(), CompositeSourceOver, blink::WebBlendModeNormal);
+ drawForContainer(buffer->context(), size(), 1, FloatRect(IntRect(IntPoint(), scaledSize)), rect(), CompositeSourceOver, blink::WebBlendModeNormal);
// FIXME: WK(Bug 113657): We should use DontCopyBackingStore here.
return buffer->copyImage(CopyBackingStore)->nativeImageForCurrentFrame();
« no previous file with comments | « Source/core/svg/graphics/SVGImage.h ('k') | Source/core/svg/graphics/SVGImageForContainer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698