Paint the bounding rect of the dirty region instead of individual rectangles when...
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Apr 2011 21:24:46 +0000 (21:24 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Apr 2011 21:24:46 +0000 (21:24 +0000)
covers at least 3/4 of its bounds.

Reviewed by Sam Weinig.

* WebProcess/WebPage/DrawingAreaImpl.cpp:
(WebKit::shouldPaintBoundsRect): Use floating point math so that the logic that was supposed to
achieve this actually works.

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

Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp

index 60206b5..cd0cf3e 100644 (file)
@@ -1,3 +1,14 @@
+2011-04-22  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Paint the bounding rect of the dirty region instead of individual rectangles when the region
+        covers at least 3/4 of its bounds.
+
+        * WebProcess/WebPage/DrawingAreaImpl.cpp:
+        (WebKit::shouldPaintBoundsRect): Use floating point math so that the logic that was supposed to
+        achieve this actually works.
+
 2011-04-22  Jer Noble  <jer.noble@apple.com>
 
         Reviewed by Maciej Stachowiak.
index 9ced7e6..4833b5b 100644 (file)
@@ -524,7 +524,7 @@ void DrawingAreaImpl::display()
 static bool shouldPaintBoundsRect(const IntRect& bounds, const Vector<IntRect>& rects)
 {
     const size_t rectThreshold = 10;
-    const float wastedSpaceThreshold = 0.75f;
+    const double wastedSpaceThreshold = 0.75;
 
     if (rects.size() <= 1 || rects.size() > rectThreshold)
         return true;
@@ -537,7 +537,7 @@ static bool shouldPaintBoundsRect(const IntRect& bounds, const Vector<IntRect>&
     for (size_t i = 0; i < rects.size(); ++i)
         rectsArea += rects[i].width() * rects[i].height();
 
-    float wastedSpace = 1 - (rectsArea / boundsArea);
+    double wastedSpace = 1 - (static_cast<double>(rectsArea) / boundsArea);
 
     return wastedSpace <= wastedSpaceThreshold;
 }