Modified: trunk/Source/WebKit2/Platform/cg/CGUtilities.cpp (115265 => 115266)
--- trunk/Source/WebKit2/Platform/cg/CGUtilities.cpp 2012-04-26 00:29:41 UTC (rev 115265)
+++ trunk/Source/WebKit2/Platform/cg/CGUtilities.cpp 2012-04-26 00:46:26 UTC (rev 115266)
@@ -48,10 +48,10 @@
CGContextRestoreGState(context);
}
-void paintBitmapContext(CGContextRef context, CGContextRef bitmapContext, CGPoint destination, CGRect source)
+void paintBitmapContext(CGContextRef context, CGContextRef bitmapContext, CGPoint destination, CGRect source, CGFloat scaleFactor)
{
RetainPtr<CGImageRef> image(AdoptCF, CGBitmapContextCreateImage(bitmapContext));
- paintImage(context, image.get(), 1, destination, source);
+ paintImage(context, image.get(), scaleFactor, destination, source);
}
} // namespace WebKit
Modified: trunk/Source/WebKit2/Platform/cg/CGUtilities.h (115265 => 115266)
--- trunk/Source/WebKit2/Platform/cg/CGUtilities.h 2012-04-26 00:29:41 UTC (rev 115265)
+++ trunk/Source/WebKit2/Platform/cg/CGUtilities.h 2012-04-26 00:46:26 UTC (rev 115266)
@@ -29,7 +29,7 @@
namespace WebKit {
void paintImage(CGContextRef, CGImageRef, CGFloat scaleFactor, CGPoint destination, CGRect source);
-void paintBitmapContext(CGContextRef, CGContextRef bitmapContext, CGPoint destination, CGRect source);
+void paintBitmapContext(CGContextRef, CGContextRef bitmapContext, CGPoint destination, CGRect source, CGFloat scaleFactor);
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/mac/BackingStoreMac.mm (115265 => 115266)
--- trunk/Source/WebKit2/UIProcess/mac/BackingStoreMac.mm 2012-04-26 00:29:41 UTC (rev 115265)
+++ trunk/Source/WebKit2/UIProcess/mac/BackingStoreMac.mm 2012-04-26 00:46:26 UTC (rev 115266)
@@ -97,16 +97,21 @@
return;
}
+ IntSize scaledSize = m_scrolledRect.size();
+ scaledSize.scale(m_deviceScaleFactor);
+
RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
- RetainPtr<CGContextRef> context(AdoptCF, CGBitmapContextCreate(0, m_scrolledRect.size().width(), m_scrolledRect.size().height(), 8, m_scrolledRect.size().width() * 4, colorSpace.get(), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host));
+ RetainPtr<CGContextRef> context(AdoptCF, CGBitmapContextCreate(0, scaledSize.width(), scaledSize.height(), 8, scaledSize.width() * 4, colorSpace.get(), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host));
+ CGContextScaleCTM(context.get(), m_deviceScaleFactor, m_deviceScaleFactor);
+
CGContextTranslateCTM(context.get(), -m_scrolledRect.location().x(), -m_scrolledRect.location().y());
CGContextTranslateCTM(context.get(), 0, m_scrolledRect.size().height());
CGContextScaleCTM(context.get(), 1, -1);
paint(context.get(), m_scrolledRect);
IntRect sourceRect(IntPoint(), m_scrolledRect.size());
- paintBitmapContext(backingStoreContext(), context.get(), m_scrolledRect.location(), sourceRect);
+ paintBitmapContext(backingStoreContext(), context.get(), m_scrolledRect.location(), sourceRect, m_deviceScaleFactor);
m_scrolledRect = IntRect();
m_scrolledRectOffset = IntSize();
@@ -132,7 +137,7 @@
source = part;
source.origin.x += offset.width();
source.origin.y += offset.height();
- paintBitmapContext(context, m_bitmapContext.get(), part.location(), source);
+ paintBitmapContext(context, m_bitmapContext.get(), part.location(), source, m_deviceScaleFactor);
});
}
@@ -154,7 +159,7 @@
if (m_bitmapContext) {
// Paint the contents of the bitmap into the layer context.
- paintBitmapContext(layerContext, m_bitmapContext.get(), CGPointZero, CGRectMake(0, 0, m_size.width(), m_size.height()));
+ paintBitmapContext(layerContext, m_bitmapContext.get(), CGPointZero, CGRectMake(0, 0, m_size.width(), m_size.height()), m_deviceScaleFactor);
m_bitmapContext = nullptr;
}
@@ -163,11 +168,15 @@
if (!m_bitmapContext) {
RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
-
- m_bitmapContext.adoptCF(CGBitmapContextCreate(0, m_size.width(), m_size.height(), 8, m_size.width() * 4, colorSpace.get(), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host));
+ IntSize scaledSize(m_size);
+ scaledSize.scale(m_deviceScaleFactor);
+ m_bitmapContext.adoptCF(CGBitmapContextCreate(0, scaledSize.width(), scaledSize.height(), 8, scaledSize.width() * 4, colorSpace.get(), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host));
+
CGContextSetBlendMode(m_bitmapContext.get(), kCGBlendModeCopy);
+ CGContextScaleCTM(m_bitmapContext.get(), m_deviceScaleFactor, m_deviceScaleFactor);
+
// We want the origin to be in the top left corner so flip the backing store context.
CGContextTranslateCTM(m_bitmapContext.get(), 0, m_size.height());
CGContextScaleCTM(m_bitmapContext.get(), 1, -1);