python: Allow to dump all images to disk.
authorJosé Fonseca <jfonseca@vmware.com>
Tue, 24 Mar 2009 21:35:10 +0000 (21:35 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Wed, 25 Mar 2009 21:03:22 +0000 (21:03 +0000)
src/gallium/state_trackers/python/retrace/interpreter.py

index 6b9587bf2bf844170beac0df67ae1d2a34db40ce..66d73ed903fea1189749bda3ab212a89f946d739 100755 (executable)
@@ -75,7 +75,13 @@ def show_image(surface):
     root.mainloop()
 
 
+# Verbosity level: 0, 1, 2 
 verbose = 1
+# Dump images to disk instead of showing: True, False
+images = False
+
+
+image_no = 0
 
 
 class Struct:
@@ -538,7 +544,13 @@ class Context(Object):
         self.real.flush()
     
         if self.cbufs and self.cbufs[0]:
-            show_image(self.cbufs[0])
+            if images:
+                global image_no
+                image_no += 1
+                filename = 'cbuf_%04u.png' % image_no 
+                save_image(filename, self.cbufs[0])
+            else:
+                show_image(self.cbufs[0])
     
 
 class Interpreter(parser.TraceDumper):