Title: [97191] trunk/Source/WebKit2
- Revision
- 97191
- Author
- [email protected]
- Date
- 2011-10-11 16:05:33 -0700 (Tue, 11 Oct 2011)
Log Message
https://bugs.webkit.org/show_bug.cgi?id=69874
WebKit2 snapshot APIs should take the device scale factor into account
-and corresponding-
<rdar://problem/10269112>
Reviewed by Darin Adler.
Add the deviceScaleFactor as a scale on the snapshot's context to create a
snapshot of the appropriate resolution. This matches the manner in which we scale
the context in DrawingAreaImpl::display().
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::snapshotInViewCoordinates):
(WebKit::WebPage::scaledSnapshotInDocumentCoordinates):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (97190 => 97191)
--- trunk/Source/WebKit2/ChangeLog 2011-10-11 23:04:15 UTC (rev 97190)
+++ trunk/Source/WebKit2/ChangeLog 2011-10-11 23:05:33 UTC (rev 97191)
@@ -1,3 +1,19 @@
+2011-10-11 Beth Dakin <[email protected]>
+
+ https://bugs.webkit.org/show_bug.cgi?id=69874
+ WebKit2 snapshot APIs should take the device scale factor into account
+ -and corresponding-
+ <rdar://problem/10269112>
+
+ Reviewed by Darin Adler.
+
+ Add the deviceScaleFactor as a scale on the snapshot's context to create a
+ snapshot of the appropriate resolution. This matches the manner in which we scale
+ the context in DrawingAreaImpl::display().
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::snapshotInViewCoordinates):
+ (WebKit::WebPage::scaledSnapshotInDocumentCoordinates):
+
2011-10-11 W. James MacLean <[email protected]>
Loss of precision when converting from double to int and double to float in FrameView::zoomAnimatorTransformChanged()
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (97190 => 97191)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2011-10-11 23:04:15 UTC (rev 97190)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2011-10-11 23:05:33 UTC (rev 97191)
@@ -915,11 +915,16 @@
if (!frameView)
return 0;
- RefPtr<WebImage> snapshot = WebImage::create(rect.size(), options);
+ IntSize bitmapSize = rect.size();
+ float deviceScaleFactor = corePage()->deviceScaleFactor();
+ bitmapSize.scale(deviceScaleFactor);
+
+ RefPtr<WebImage> snapshot = WebImage::create(bitmapSize, options);
if (!snapshot->bitmap())
return 0;
OwnPtr<WebCore::GraphicsContext> graphicsContext = snapshot->bitmap()->createGraphicsContext();
+ graphicsContext->scale(FloatSize(deviceScaleFactor, deviceScaleFactor));
graphicsContext->translate(-rect.x(), -rect.y());
frameView->updateLayoutAndStyleIfNeededRecursive();
@@ -938,13 +943,14 @@
if (!frameView)
return 0;
- IntSize size(ceil(rect.width() * scaleFactor), ceil(rect.height() * scaleFactor));
+ float combinedScaleFactor = scaleFactor * corePage()->deviceScaleFactor();
+ IntSize size(ceil(rect.width() * combinedScaleFactor), ceil(rect.height() * combinedScaleFactor));
RefPtr<WebImage> snapshot = WebImage::create(size, options);
if (!snapshot->bitmap())
return 0;
OwnPtr<WebCore::GraphicsContext> graphicsContext = snapshot->bitmap()->createGraphicsContext();
- graphicsContext->scale(FloatSize(scaleFactor, scaleFactor));
+ graphicsContext->scale(FloatSize(combinedScaleFactor, combinedScaleFactor));
graphicsContext->translate(-rect.x(), -rect.y());
frameView->updateLayoutAndStyleIfNeededRecursive();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes