Title: [247846] trunk/Source/WebCore
Revision
247846
Author
[email protected]
Date
2019-07-25 17:40:26 -0700 (Thu, 25 Jul 2019)

Log Message

Subpixel fringes around TextIndicator snapshots at non-integral scale factors
https://bugs.webkit.org/show_bug.cgi?id=200145

Reviewed by Simon Fraser.

* page/FrameSnapshotting.cpp:
(WebCore::snapshotFrameRectWithClip):
* page/FrameSnapshotting.h:
* page/TextIndicator.cpp:
(WebCore::snapshotOptionsForTextIndicatorOptions):
Round the scale factor up, and snappily enclose the clip rects.

TextIndicator doesn't require the use of the precise scale factor that
the page is painted at, but we want it to be sharp, so we overshoot!

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (247845 => 247846)


--- trunk/Source/WebCore/ChangeLog	2019-07-25 23:55:45 UTC (rev 247845)
+++ trunk/Source/WebCore/ChangeLog	2019-07-26 00:40:26 UTC (rev 247846)
@@ -1,3 +1,20 @@
+2019-07-25  Tim Horton  <[email protected]>
+
+        Subpixel fringes around TextIndicator snapshots at non-integral scale factors
+        https://bugs.webkit.org/show_bug.cgi?id=200145
+
+        Reviewed by Simon Fraser.
+
+        * page/FrameSnapshotting.cpp:
+        (WebCore::snapshotFrameRectWithClip):
+        * page/FrameSnapshotting.h:
+        * page/TextIndicator.cpp:
+        (WebCore::snapshotOptionsForTextIndicatorOptions):
+        Round the scale factor up, and snappily enclose the clip rects.
+
+        TextIndicator doesn't require the use of the precise scale factor that
+        the page is painted at, but we want it to be sharp, so we overshoot!
+
 2019-07-25  Brent Fulgham  <[email protected]>
 
         Use IWICBitmap (rather than ID2D1Bitmap) for NativeImagePtr on FTW

Modified: trunk/Source/WebCore/page/FrameSnapshotting.cpp (247845 => 247846)


--- trunk/Source/WebCore/page/FrameSnapshotting.cpp	2019-07-25 23:55:45 UTC (rev 247845)
+++ trunk/Source/WebCore/page/FrameSnapshotting.cpp	2019-07-26 00:40:26 UTC (rev 247846)
@@ -108,6 +108,9 @@
     if (frame.settings().delegatesPageScaling())
         scaleFactor *= frame.page()->pageScaleFactor();
 
+    if (options & SnapshotOptionsPaintWithIntegralScaleFactor)
+        scaleFactor = ceilf(scaleFactor);
+
     std::unique_ptr<ImageBuffer> buffer = ImageBuffer::create(imageRect.size(), Unaccelerated, scaleFactor);
     if (!buffer)
         return nullptr;
@@ -116,7 +119,7 @@
     if (!clipRects.isEmpty()) {
         Path clipPath;
         for (auto& rect : clipRects)
-            clipPath.addRect(rect);
+            clipPath.addRect(encloseRectToDevicePixels(rect, scaleFactor));
         buffer->context().clipPath(clipPath);
     }
 

Modified: trunk/Source/WebCore/page/FrameSnapshotting.h (247845 => 247846)


--- trunk/Source/WebCore/page/FrameSnapshotting.h	2019-07-25 23:55:45 UTC (rev 247845)
+++ trunk/Source/WebCore/page/FrameSnapshotting.h	2019-07-26 00:40:26 UTC (rev 247846)
@@ -47,7 +47,8 @@
     SnapshotOptionsInViewCoordinates = 1 << 2,
     SnapshotOptionsForceBlackText = 1 << 3,
     SnapshotOptionsPaintSelectionAndBackgroundsOnly = 1 << 4,
-    SnapshotOptionsPaintEverythingExcludingSelection = 1 << 5
+    SnapshotOptionsPaintEverythingExcludingSelection = 1 << 5,
+    SnapshotOptionsPaintWithIntegralScaleFactor = 1 << 6,
 };
 typedef unsigned SnapshotOptions;
 

Modified: trunk/Source/WebCore/page/TextIndicator.cpp (247845 => 247846)


--- trunk/Source/WebCore/page/TextIndicator.cpp	2019-07-25 23:55:45 UTC (rev 247845)
+++ trunk/Source/WebCore/page/TextIndicator.cpp	2019-07-26 00:40:26 UTC (rev 247846)
@@ -132,7 +132,7 @@
 
 static SnapshotOptions snapshotOptionsForTextIndicatorOptions(TextIndicatorOptions options)
 {
-    SnapshotOptions snapshotOptions = SnapshotOptionsNone;
+    SnapshotOptions snapshotOptions = SnapshotOptionsPaintWithIntegralScaleFactor;
 
     if (!(options & TextIndicatorOptionPaintAllContent)) {
         if (options & TextIndicatorOptionPaintBackgrounds)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to