summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/python/samples
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/samples
parent77388559886dd84c69aaffc9a385ad87c410afa9 (diff)
python: More efficient blits from surfaces.
C code instead of interpreted python code.
Diffstat (limited to 'src/gallium/state_trackers/python/samples')
-rw-r--r--src/gallium/state_trackers/python/samples/tri.py14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/gallium/state_trackers/python/samples/tri.py b/src/gallium/state_trackers/python/samples/tri.py
index 193479f7d6c..d3ccb6c2f46 100644
--- a/src/gallium/state_trackers/python/samples/tri.py
+++ b/src/gallium/state_trackers/python/samples/tri.py
@@ -31,20 +31,10 @@ from gallium import *
def make_image(surface):
- pixels = 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):