summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/python/retrace
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2009-02-20 16:50:02 +0000
committerJosé Fonseca <[email protected]>2009-02-20 16:50:02 +0000
commit60e35ebf1476c31eb5d7c207ab8e9db77fcad896 (patch)
tree74784001b694ae1268670932523369707c4f69d2 /src/gallium/state_trackers/python/retrace
parent77388559886dd84c69aaffc9a385ad87c410afa9 (diff)
python: More efficient blits from surfaces.
C code instead of interpreted python code.
Diffstat (limited to 'src/gallium/state_trackers/python/retrace')
-rwxr-xr-xsrc/gallium/state_trackers/python/retrace/interpreter.py14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/gallium/state_trackers/python/retrace/interpreter.py b/src/gallium/state_trackers/python/retrace/interpreter.py
index 2a75ee82d5d..e6999a2211e 100755
--- a/src/gallium/state_trackers/python/retrace/interpreter.py
+++ b/src/gallium/state_trackers/python/retrace/interpreter.py
@@ -44,20 +44,10 @@ except ImportError:
def make_image(surface):
- pixels = gallium.FloatArray(surface.height*surface.width*4)
- surface.get_tile_rgba(0, 0, surface.width, surface.height, pixels)
+ data = surface.get_tile_rgba8(0, 0, surface.width, surface.height)
import Image
- outimage = Image.new(
- mode='RGB',
- size=(surface.width, surface.height),
- color=(0,0,0))
- outpixels = outimage.load()
- for y in range(0, surface.height):
- for x in range(0, surface.width):
- offset = (y*surface.width + x)*4
- r, g, b, a = [int(pixels[offset + ch]*255) for ch in range(4)]
- outpixels[x, y] = r, g, b
+ outimage = Image.fromstring('RGBA', (surface.width, surface.height), data, "raw", 'RGBA', 0, 1)
return outimage
def save_image(filename, surface):