Title: [102198] branches/safari-534.53-branch/Source/WebKit2
Revision
102198
Author
[email protected]
Date
2011-12-06 17:23:39 -0800 (Tue, 06 Dec 2011)

Log Message

Merged r97191.

Modified Paths

Diff

Modified: branches/safari-534.53-branch/Source/WebKit2/ChangeLog (102197 => 102198)


--- branches/safari-534.53-branch/Source/WebKit2/ChangeLog	2011-12-07 01:22:20 UTC (rev 102197)
+++ branches/safari-534.53-branch/Source/WebKit2/ChangeLog	2011-12-07 01:23:39 UTC (rev 102198)
@@ -1,5 +1,25 @@
 2011-12-06  Lucas Forschler  <[email protected]>
 
+    Merge 97191
+
+    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-12-06  Lucas Forschler  <[email protected]>
+
     Merge 92491
 
     2011-08-05  Darin Adler  <[email protected]>

Modified: branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (102197 => 102198)


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2011-12-07 01:22:20 UTC (rev 102197)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2011-12-07 01:23:39 UTC (rev 102198)
@@ -870,11 +870,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();
@@ -893,13 +898,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

Reply via email to