Title: [203543] trunk
Revision
203543
Author
d...@apple.com
Date
2016-07-21 17:48:02 -0700 (Thu, 21 Jul 2016)

Log Message

REGRESSION (r202927): The internal size of the ImageBuffer is scaled twice by the context scaleFactor
https://bugs.webkit.org/show_bug.cgi?id=159981
<rdar://problem/27429465>

Reviewed by Myles Maxfield.

Source/WebCore:

The change to propagate color spaces through ImageBuffers created an
alternate version of createCompatibleBuffer. This version accidentally
attempted to take the display resolution (i.e. hidpi) into account
when creating the buffer, which meant it was being applied twice.

The fix is simply to remove that logic. The caller of the method
will take the resolution into account, the same way they did
with the old createCompatibleBuffer method.

Test: fast/hidpi/pdf-image-scaled.html

* platform/graphics/cg/ImageBufferCG.cpp:
(WebCore::ImageBuffer::createCompatibleBuffer): Don't calculate
a resolution - just use the value of 1.0.

LayoutTests:

* fast/hidpi/pdf-image-scaled-expected.html: Added.
* fast/hidpi/pdf-image-scaled.html: Added.
* fast/hidpi/resources/circle.pdf: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (203542 => 203543)


--- trunk/LayoutTests/ChangeLog	2016-07-22 00:44:27 UTC (rev 203542)
+++ trunk/LayoutTests/ChangeLog	2016-07-22 00:48:02 UTC (rev 203543)
@@ -1,3 +1,15 @@
+2016-07-21  Dean Jackson  <d...@apple.com>
+
+        REGRESSION (r202927): The internal size of the ImageBuffer is scaled twice by the context scaleFactor
+        https://bugs.webkit.org/show_bug.cgi?id=159981
+        <rdar://problem/27429465>
+
+        Reviewed by Myles Maxfield.
+
+        * fast/hidpi/pdf-image-scaled-expected.html: Added.
+        * fast/hidpi/pdf-image-scaled.html: Added.
+        * fast/hidpi/resources/circle.pdf: Added.
+
 2016-07-21  John Wilander  <wilan...@apple.com>
 
         Block mixed content synchronous XHR

Added: trunk/LayoutTests/fast/hidpi/pdf-image-scaled-expected.html (0 => 203543)


--- trunk/LayoutTests/fast/hidpi/pdf-image-scaled-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/hidpi/pdf-image-scaled-expected.html	2016-07-22 00:48:02 UTC (rev 203543)
@@ -0,0 +1,12 @@
+<style>
+body {
+    overflow: hidden;
+}
+img {
+    width: 800px;
+    height: 800px;
+    zoom: 0.2;
+    transform: translate(0);
+}
+</style>
+<img src=""
Property changes on: trunk/LayoutTests/fast/hidpi/pdf-image-scaled-expected.html
___________________________________________________________________

Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Date Revision \ No newline at end of property

Added: svn:mime-type

+text/html \ No newline at end of property

Added: trunk/LayoutTests/fast/hidpi/pdf-image-scaled.html (0 => 203543)


--- trunk/LayoutTests/fast/hidpi/pdf-image-scaled.html	                        (rev 0)
+++ trunk/LayoutTests/fast/hidpi/pdf-image-scaled.html	2016-07-22 00:48:02 UTC (rev 203543)
@@ -0,0 +1,12 @@
+<style>
+body {
+    overflow: hidden;
+}
+img {
+    width: 800px;
+    height: 800px;
+    transform-origin: 0 0;
+    transform: scale(0.2);
+}
+</style>
+<img src=""
Property changes on: trunk/LayoutTests/fast/hidpi/pdf-image-scaled.html
___________________________________________________________________

Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Date Revision \ No newline at end of property

Added: svn:mime-type

+text/html \ No newline at end of property

Added: trunk/LayoutTests/fast/hidpi/resources/circle.pdf


(Binary files differ)
Index: trunk/LayoutTests/fast/hidpi/resources/circle.pdf =================================================================== --- trunk/LayoutTests/fast/hidpi/resources/circle.pdf 2016-07-22 00:44:27 UTC (rev 203542) +++ trunk/LayoutTests/fast/hidpi/resources/circle.pdf 2016-07-22 00:48:02 UTC (rev 203543) Property changes on: trunk/LayoutTests/fast/hidpi/resources/circle.pdf ___________________________________________________________________

Added: svn:mime-type

+application/pdf \ No newline at end of property

Modified: trunk/Source/WebCore/ChangeLog (203542 => 203543)


--- trunk/Source/WebCore/ChangeLog	2016-07-22 00:44:27 UTC (rev 203542)
+++ trunk/Source/WebCore/ChangeLog	2016-07-22 00:48:02 UTC (rev 203543)
@@ -1,3 +1,26 @@
+2016-07-21  Dean Jackson  <d...@apple.com>
+
+        REGRESSION (r202927): The internal size of the ImageBuffer is scaled twice by the context scaleFactor
+        https://bugs.webkit.org/show_bug.cgi?id=159981
+        <rdar://problem/27429465>
+
+        Reviewed by Myles Maxfield.
+
+        The change to propagate color spaces through ImageBuffers created an
+        alternate version of createCompatibleBuffer. This version accidentally
+        attempted to take the display resolution (i.e. hidpi) into account
+        when creating the buffer, which meant it was being applied twice.
+
+        The fix is simply to remove that logic. The caller of the method
+        will take the resolution into account, the same way they did
+        with the old createCompatibleBuffer method.
+
+        Test: fast/hidpi/pdf-image-scaled.html
+
+        * platform/graphics/cg/ImageBufferCG.cpp:
+        (WebCore::ImageBuffer::createCompatibleBuffer): Don't calculate
+        a resolution - just use the value of 1.0.
+
 2016-07-21  John Wilander  <wilan...@apple.com>
 
         Block mixed content synchronous XHR

Modified: trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp (203542 => 203543)


--- trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp	2016-07-22 00:44:27 UTC (rev 203542)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp	2016-07-22 00:48:02 UTC (rev 203543)
@@ -75,8 +75,6 @@
     if (size.isEmpty())
         return nullptr;
 
-    IntSize scaledSize = ImageBuffer::compatibleBufferSize(size, context);
-    float resolutionScale = context.scaleFactor().width();
     RetainPtr<CGColorSpaceRef> colorSpace;
 #if PLATFORM(COCOA)
     CGContextRef cgContext = context.platformContext();
@@ -99,8 +97,9 @@
     colorSpace = sRGBColorSpaceRef();
 #endif
     RenderingMode renderingMode = context.renderingMode();
+    IntSize scaledSize = ImageBuffer::compatibleBufferSize(size, context);
     bool success = false;
-    std::unique_ptr<ImageBuffer> buffer(new ImageBuffer(scaledSize, resolutionScale, colorSpace.get(), renderingMode, success));
+    std::unique_ptr<ImageBuffer> buffer(new ImageBuffer(scaledSize, 1, colorSpace.get(), renderingMode, success));
 
     if (!success)
         return nullptr;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to