[pypy-svn] r23472 - pypy/dist/pypy/translator/tool/pygame

arigo at codespeak.net arigo at codespeak.net
Sun Feb 19 01:10:06 CET 2006


Author: arigo
Date: Sun Feb 19 01:10:04 2006
New Revision: 23472

Modified:
   pypy/dist/pypy/translator/tool/pygame/drawgraph.py
Log:
Fix for old SDL or Pygame versions on X: avoid sending it very large
rectangle coordinates for the background fill.


Modified: pypy/dist/pypy/translator/tool/pygame/drawgraph.py
==============================================================================
--- pypy/dist/pypy/translator/tool/pygame/drawgraph.py	(original)
+++ pypy/dist/pypy/translator/tool/pygame/drawgraph.py	Sun Feb 19 01:10:04 2006
@@ -525,11 +525,23 @@
         self.computevisible()
 
         bbox = self.getboundingbox()
-        self.screen.fill((224, 255, 224), bbox)
-
-        # gray off-bkgnd areas
         ox, oy, width, height = bbox
         dpy_width, dpy_height = self.screen.get_size()
+        # some versions of the SDL misinterpret widely out-of-range values,
+        # so clamp them
+        if ox < 0:
+            width += ox
+            ox = 0
+        if oy < 0:
+            height += oy
+            oy = 0
+        if width > dpy_width:
+            width = dpy_width
+        if height > dpy_height:
+            height = dpy_height
+        self.screen.fill((224, 255, 224), (ox, oy, width, height))
+
+        # gray off-bkgnd areas
         gray = (128, 128, 128)
         if ox > 0:
             self.screen.fill(gray, (0, 0, ox, dpy_height))



More information about the Pypy-commit mailing list