On 09/18/2014 10:23 AM, Adam Jackson wrote:
First, we drop the "spontaneous combustion" path.  In a composited
environment you're never going to hit that anyway, and even in a classic
environment it's so rare to hit as to not be worth it.  Second, we

You mean running xeyes over a backing store app isn't something everyone does all the time??

delete the declaration of exposures, replace exposures with prgn
to match, and then delete all the redundant conditionals.

Suddenly this looks like a function a mortal could understand.

Signed-off-by: Adam Jackson <a...@redhat.com>
---
  mi/miexpose.c | 53 +++++------------------------------------------------
  1 file changed, 5 insertions(+), 48 deletions(-)

diff --git a/mi/miexpose.c b/mi/miexpose.c
index 23987fa..98112ab 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -423,55 +423,12 @@ miSendExposures(WindowPtr pWin, RegionPtr pRgn, int dx, 
int dy)
  void
  miWindowExposures(WindowPtr pWin, RegionPtr prgn)
  {
-    RegionPtr exposures = prgn;
-
-    if ((prgn && !RegionNil(prgn)) || (exposures && !RegionNil(exposures))) {
-        RegionRec expRec;
-        int clientInterested;
-
-        /*
-         * Restore from backing-store FIRST.
-         */
-        clientInterested =
-            (pWin->eventMask | wOtherEventMasks(pWin)) & ExposureMask;
-        if (clientInterested && exposures &&
-            (RegionNumRects(exposures) > RECTLIMIT)) {
-            /*
-             * If we have LOTS of rectangles, we decide to take the extents
-             * and force an exposure on that.  This should require much less
-             * work overall, on both client and server.  This is cheating, but
-             * isn't prohibited by the protocol ("spontaneous combustion" :-).
-             */
-            BoxRec box;
-
-            box = *RegionExtents(exposures);
-            if (exposures == prgn) {
-                exposures = &expRec;
-                RegionInit(exposures, &box, 1);
-                RegionReset(prgn, &box);
-            }
-            else {
-                RegionReset(exposures, &box);
-                RegionUnion(prgn, prgn, exposures);
-            }
-            /* miPaintWindow doesn't clip, so we have to */
-            RegionIntersect(prgn, prgn, &pWin->clipList);
-        }
-        if (prgn && !RegionNil(prgn))
-            miPaintWindow(pWin, prgn, PW_BACKGROUND);
-        if (clientInterested && exposures && !RegionNil(exposures))
-            miSendExposures(pWin, exposures,
-                            pWin->drawable.x, pWin->drawable.y);
-        if (exposures == &expRec) {
-            RegionUninit(exposures);
-        }
-        else if (exposures && exposures != prgn)
-            RegionDestroy(exposures);
-        if (prgn)
-            RegionEmpty(prgn);
+    if (prgn && !RegionNil(prgn)) {
+        miPaintWindow(pWin, prgn, PW_BACKGROUND);
+        if ((pWin->eventMask | wOtherEventMasks(pWin)) & ExposureMask)
+            miSendExposures(pWin, prgn, pWin->drawable.x, pWin->drawable.y);
+        RegionEmpty(prgn);
      }
-    else if (exposures && exposures != prgn)
-        RegionDestroy(exposures);
  }

  #ifdef ROOTLESS


Reviewed-by: Aaron Plattner <aplatt...@nvidia.com>

--
Aaron
_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to