Title: [166203] trunk/Source/WebKit2
Revision
166203
Author
[email protected]
Date
2014-03-24 16:14:22 -0700 (Mon, 24 Mar 2014)

Log Message

REGRESSION (r165872): Double-applying device scale to snapshots
https://bugs.webkit.org/show_bug.cgi?id=130697
<rdar://problem/16396629>

Reviewed by Simon Fraser.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::scaledSnapshotWithOptions):
Drive-by, make scaledSnapshotWithOptions respect SnapshotOptionsExcludeDeviceScaleFactor.

(WebKit::WebPage::snapshotAtSize):
Divide the device scale out of the scale factor

* WebProcess/WebPage/WebPage.h:
Rename the scale argument to scaledSnapshotWithOptions to clarify
that it is an additional scale on top of the device scale.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (166202 => 166203)


--- trunk/Source/WebKit2/ChangeLog	2014-03-24 23:11:43 UTC (rev 166202)
+++ trunk/Source/WebKit2/ChangeLog	2014-03-24 23:14:22 UTC (rev 166203)
@@ -1,3 +1,22 @@
+2014-03-24  Tim Horton  <[email protected]>
+
+        REGRESSION (r165872): Double-applying device scale to snapshots
+        https://bugs.webkit.org/show_bug.cgi?id=130697
+        <rdar://problem/16396629>
+
+        Reviewed by Simon Fraser.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::scaledSnapshotWithOptions):
+        Drive-by, make scaledSnapshotWithOptions respect SnapshotOptionsExcludeDeviceScaleFactor.
+
+        (WebKit::WebPage::snapshotAtSize):
+        Divide the device scale out of the scale factor
+
+        * WebProcess/WebPage/WebPage.h:
+        Rename the scale argument to scaledSnapshotWithOptions to clarify
+        that it is an additional scale on top of the device scale.
+
 2014-03-24  Brent Fulgham  <[email protected]>
 
         Activate WebVTT Tests Once Merging is Complete

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (166202 => 166203)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2014-03-24 23:11:43 UTC (rev 166202)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2014-03-24 23:14:22 UTC (rev 166203)
@@ -1531,14 +1531,17 @@
     send(Messages::WebPageProxy::ImageCallback(handle, callbackID));
 }
 
-PassRefPtr<WebImage> WebPage::scaledSnapshotWithOptions(const IntRect& rect, double scaleFactor, SnapshotOptions options)
+PassRefPtr<WebImage> WebPage::scaledSnapshotWithOptions(const IntRect& rect, double additionalScaleFactor, SnapshotOptions options)
 {
     IntRect snapshotRect = rect;
     if (options & SnapshotOptionsRespectDrawingAreaTransform)
         snapshotRect = m_drawingArea->rootLayerTransform().inverse().mapRect(snapshotRect);
 
     IntSize bitmapSize = snapshotRect.size();
-    bitmapSize.scale(scaleFactor * corePage()->deviceScaleFactor());
+    double scaleFactor = additionalScaleFactor;
+    if (!(options & SnapshotOptionsExcludeDeviceScaleFactor))
+        scaleFactor *= corePage()->deviceScaleFactor();
+    bitmapSize.scale(scaleFactor);
 
     return snapshotAtSize(rect, bitmapSize, options);
 }
@@ -1569,8 +1572,11 @@
 
     graphicsContext->fillRect(IntRect(IntPoint(), bitmapSize), frameView->baseBackgroundColor(), ColorSpaceDeviceRGB);
 
-    if (!(options & SnapshotOptionsExcludeDeviceScaleFactor))
-        graphicsContext->applyDeviceScaleFactor(corePage()->deviceScaleFactor());
+    if (!(options & SnapshotOptionsExcludeDeviceScaleFactor)) {
+        double deviceScaleFactor = corePage()->deviceScaleFactor();
+        graphicsContext->applyDeviceScaleFactor(deviceScaleFactor);
+        scaleFactor /= deviceScaleFactor;
+    }
 
     graphicsContext->scale(FloatSize(scaleFactor, scaleFactor));
     graphicsContext->translate(-snapshotRect.x(), -snapshotRect.y());

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (166202 => 166203)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2014-03-24 23:11:43 UTC (rev 166202)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2014-03-24 23:14:22 UTC (rev 166203)
@@ -421,7 +421,7 @@
     WebCore::IntPoint screenToRootView(const WebCore::IntPoint&);
     WebCore::IntRect rootViewToScreen(const WebCore::IntRect&);
 
-    PassRefPtr<WebImage> scaledSnapshotWithOptions(const WebCore::IntRect&, double scaleFactor, SnapshotOptions);
+    PassRefPtr<WebImage> scaledSnapshotWithOptions(const WebCore::IntRect&, double additionalScaleFactor, SnapshotOptions);
     PassRefPtr<WebImage> snapshotAtSize(const WebCore::IntRect&, const WebCore::IntSize& bitmapSize, SnapshotOptions);
 
     static const WebEvent* currentEvent();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to