[Win] Small repaint issues when device scale factor != 1.
authorpeavo@outlook.com <peavo@outlook.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 Aug 2015 17:56:52 +0000 (17:56 +0000)
committerpeavo@outlook.com <peavo@outlook.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 Aug 2015 17:56:52 +0000 (17:56 +0000)
https://bugs.webkit.org/show_bug.cgi?id=147825

Reviewed by Alex Christensen.

When scaling, we should scale a FloatRect, and then compute the enclosing IntRect.

* WebView.cpp:
(WebView::repaint):
(WebView::scrollBackingStore):
(WebView::paintIntoBackingStore):

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

Source/WebKit/win/ChangeLog
Source/WebKit/win/WebView.cpp

index 9d42bc4..95143f0 100644 (file)
@@ -1,3 +1,17 @@
+2015-08-10  Per Arne Vollan  <peavo@outlook.com>
+
+        [Win] Small repaint issues when device scale factor != 1.
+        https://bugs.webkit.org/show_bug.cgi?id=147825
+
+        Reviewed by Alex Christensen.
+
+        When scaling, we should scale a FloatRect, and then compute the enclosing IntRect.
+
+        * WebView.cpp:
+        (WebView::repaint):
+        (WebView::scrollBackingStore):
+        (WebView::paintIntoBackingStore):
+
 2015-08-07  Alex Christensen  <achristensen@webkit.org>
 
         Build more testing binaries with CMake on Windows
index 8d2f5dd..b48c30c 100644 (file)
@@ -831,8 +831,9 @@ HRESULT STDMETHODCALLTYPE WebView::close()
 
 void WebView::repaint(const WebCore::IntRect& logicalWindowRect, bool contentChanged, bool immediate, bool repaintContentOnly)
 {
-    WebCore::IntRect windowRect(logicalWindowRect);
-    windowRect.scale(deviceScaleFactor());
+    FloatRect windowRectFloat(logicalWindowRect);
+    windowRectFloat.scale(deviceScaleFactor());
+    IntRect windowRect(enclosingIntRect(windowRectFloat));
 
     if (isAcceleratedCompositing()) {
         // The contentChanged, immediate, and repaintContentOnly parameters are all based on a non-
@@ -939,9 +940,10 @@ void WebView::scrollBackingStore(FrameView* frameView, int logicalDx, int logica
     float scaleFactor = deviceScaleFactor();
     int dx = clampTo<int>(scaleFactor * logicalDx);
     int dy = clampTo<int>(scaleFactor * logicalDy);
-    IntRect scrollViewRect(logicalScrollViewRect);
-    scrollViewRect.scale(scaleFactor);
-    IntRect clipRect(logicalClipRect);
+    FloatRect scrollViewRectFloat(logicalScrollViewRect);
+    scrollViewRectFloat.scale(scaleFactor);
+    IntRect scrollViewRect(enclosingIntRect(scrollViewRectFloat));
+    FloatRect clipRect(logicalClipRect);
     clipRect.scale(scaleFactor);
 
     if (isAcceleratedCompositing()) {
@@ -975,7 +977,7 @@ void WebView::scrollBackingStore(FrameView* frameView, int logicalDx, int logica
 
     // Scroll the bitmap.
     RECT scrollRectWin(scrollViewRect);
-    RECT clipRectWin(clipRect);
+    RECT clipRectWin(enclosingIntRect(clipRect));
     ::ScrollDC(bitmapDC.get(), dx, dy, &scrollRectWin, &clipRectWin, updateRegion.get(), 0);
     RECT regionBox;
     ::GetRgnBox(updateRegion.get(), &regionBox);
@@ -1272,8 +1274,9 @@ void WebView::paintIntoBackingStore(FrameView* frameView, HDC bitmapDC, const In
     float scaleFactor = deviceScaleFactor();
     float inverseScaleFactor = 1.0f / scaleFactor;
 
-    IntRect logicalDirtyRect = dirtyRectPixels;
-    logicalDirtyRect.scale(inverseScaleFactor);
+    FloatRect logicalDirtyRectFloat = dirtyRectPixels;
+    logicalDirtyRectFloat.scale(inverseScaleFactor);    
+    IntRect logicalDirtyRect(enclosingIntRect(logicalDirtyRectFloat));
 
     GraphicsContext gc(bitmapDC, m_transparent);
     gc.setShouldIncludeChildWindows(windowsToPaint == PaintWebViewAndChildren);