Title: [293843] branches/safari-7614.1.12-branch/Source/WebCore
Revision
293843
Author
repst...@apple.com
Date
2022-05-05 09:52:22 -0700 (Thu, 05 May 2022)

Log Message

Cherry-pick r293825. rdar://problem/92635752

    [GPU Process] [iOS] REGRESSION(r293570): Snapshot rendering is not scaled with the device scale factor
    https://bugs.webkit.org/show_bug.cgi?id=240100
    rdar://92635752

    Reviewed by Simon Fraser.

    The scaling factor is not set in the GraphicsContext of the
    ImageBufferShareableBitmapBackend.

    To fix this bug is to make snapshotFrameRectWithClip() handle the scaling
    outside the ImageBuffer creation. This is similar to what we do in
    GraphicsContext::createAlignedImageBuffer() where we scale the size and
    create the ImageBuffer with scaleFactor = 1.

    * page/FrameSnapshotting.cpp:
    (WebCore::snapshotFrameRectWithClip):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@293825 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-7614.1.12-branch/Source/WebCore/ChangeLog (293842 => 293843)


--- branches/safari-7614.1.12-branch/Source/WebCore/ChangeLog	2022-05-05 16:40:55 UTC (rev 293842)
+++ branches/safari-7614.1.12-branch/Source/WebCore/ChangeLog	2022-05-05 16:52:22 UTC (rev 293843)
@@ -1,3 +1,46 @@
+2022-05-05  Russell Epstein  <repst...@apple.com>
+
+        Cherry-pick r293825. rdar://problem/92635752
+
+    [GPU Process] [iOS] REGRESSION(r293570): Snapshot rendering is not scaled with the device scale factor
+    https://bugs.webkit.org/show_bug.cgi?id=240100
+    rdar://92635752
+    
+    Reviewed by Simon Fraser.
+    
+    The scaling factor is not set in the GraphicsContext of the
+    ImageBufferShareableBitmapBackend.
+    
+    To fix this bug is to make snapshotFrameRectWithClip() handle the scaling
+    outside the ImageBuffer creation. This is similar to what we do in
+    GraphicsContext::createAlignedImageBuffer() where we scale the size and
+    create the ImageBuffer with scaleFactor = 1.
+    
+    * page/FrameSnapshotting.cpp:
+    (WebCore::snapshotFrameRectWithClip):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@293825 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-05-05  Said Abou-Hallawa  <s...@apple.com>
+
+            [GPU Process] [iOS] REGRESSION(r293570): Snapshot rendering is not scaled with the device scale factor
+            https://bugs.webkit.org/show_bug.cgi?id=240100
+            rdar://92635752
+
+            Reviewed by Simon Fraser.
+
+            The scaling factor is not set in the GraphicsContext of the
+            ImageBufferShareableBitmapBackend.
+
+            To fix this bug is to make snapshotFrameRectWithClip() handle the scaling
+            outside the ImageBuffer creation. This is similar to what we do in
+            GraphicsContext::createAlignedImageBuffer() where we scale the size and
+            create the ImageBuffer with scaleFactor = 1.
+
+            * page/FrameSnapshotting.cpp:
+            (WebCore::snapshotFrameRectWithClip):
+
 2022-04-29  Don Olmstead  <don.olmst...@sony.com>
 
         The isYahooMail quirk is specific to PLATFORM(IOS_FAMILY)

Modified: branches/safari-7614.1.12-branch/Source/WebCore/page/FrameSnapshotting.cpp (293842 => 293843)


--- branches/safari-7614.1.12-branch/Source/WebCore/page/FrameSnapshotting.cpp	2022-05-05 16:40:55 UTC (rev 293842)
+++ branches/safari-7614.1.12-branch/Source/WebCore/page/FrameSnapshotting.cpp	2022-05-05 16:52:22 UTC (rev 293843)
@@ -115,19 +115,23 @@
     if (options.flags.contains(SnapshotFlags::PaintWithIntegralScaleFactor))
         scaleFactor = ceilf(scaleFactor);
 
+    auto scaledImageRect = imageRect;
+    scaledImageRect.scale(scaleFactor);
+
     auto purpose = options.flags.contains(SnapshotFlags::Shareable) ? RenderingPurpose::ShareableSnapshot : RenderingPurpose::Snapshot;
     auto hostWindow = (document->view() && document->view()->root()) ? document->view()->root()->hostWindow() : nullptr;
 
-    auto buffer = ImageBuffer::create(imageRect.size(), purpose, scaleFactor, options.colorSpace, options.pixelFormat, { }, { hostWindow });
+    auto buffer = ImageBuffer::create(scaledImageRect.size(), purpose, 1, options.colorSpace, options.pixelFormat, { }, { hostWindow });
     if (!buffer)
         return nullptr;
 
-    buffer->context().translate(-imageRect.x(), -imageRect.y());
+    buffer->context().translate(-scaledImageRect.location());
+    buffer->context().scale(scaleFactor);
 
     if (!clipRects.isEmpty()) {
         Path clipPath;
         for (auto& rect : clipRects)
-            clipPath.addRect(encloseRectToDevicePixels(rect, scaleFactor));
+            clipPath.addRect(rect);
         buffer->context().clipPath(clipPath);
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to