REGRESSION: Canvas is broken in high dpi mode
[WebKit-https.git] / WebCore / html / HTMLCanvasElement.cpp
index 9f59f23..e34880e 100644 (file)
@@ -253,8 +253,9 @@ void HTMLCanvasElement::createImageBuffer() const
     IntSize size = convertLogicalToDevice(unscaledSize);
     if (!size.width() || !size.height())
         return;
-    m_imageBuffer.set(ImageBuffer::create(size, false).release());
 
+    m_imageBuffer.set(ImageBuffer::create(size, false).release());
+    m_imageBuffer->context()->scale(FloatSize(size.width() / unscaledSize.width(), size.height() / unscaledSize.height()));
     m_imageBuffer->context()->setShadowsIgnoreTransforms(true);
 }
 
@@ -273,7 +274,13 @@ ImageBuffer* HTMLCanvasElement::buffer() const
 AffineTransform HTMLCanvasElement::baseTransform() const
 {
     ASSERT(m_createdImageBuffer);
-    return m_imageBuffer->baseTransform();
+    FloatSize unscaledSize(width(), height());
+    IntSize size = convertLogicalToDevice(unscaledSize);
+    AffineTransform transform;
+    if (size.width() && size.height())
+        transform.scale(size.width() / unscaledSize.width(), size.height() / unscaledSize.height());
+    transform.multiply(m_imageBuffer->baseTransform());
+    return transform;
 }
 
 }