Author: Tim Felgentreff <[email protected]>
Branch:
Changeset: r265:f24368c0ec5a
Date: 2013-04-15 10:12 +0200
http://bitbucket.org/pypy/lang-smalltalk/changeset/f24368c0ec5a/
Log: Cast SDL pixelbuffer into ULONGP, so we can set words instead of
bytes
diff --git a/spyvm/display.py b/spyvm/display.py
--- a/spyvm/display.py
+++ b/spyvm/display.py
@@ -61,7 +61,7 @@
assert self.screen
def get_pixelbuffer(self):
- return self.screen.c_pixels
+ return rffi.cast(rffi.ULONGP, self.screen.c_pixels)
def flip(self):
RSDL.Flip(self.screen)
diff --git a/spyvm/model.py b/spyvm/model.py
--- a/spyvm/model.py
+++ b/spyvm/model.py
@@ -807,17 +807,15 @@
@jit.unroll_safe
def setword(self, n, word):
self._real_depth_buffer[n] = word
- pos = n * NATIVE_DEPTH * 4
+ pos = n * NATIVE_DEPTH
mask = r_uint(1)
mask <<= 31
for i in xrange(32):
bit = mask & word
- self.pixelbuffer[pos] = rffi.r_uchar(0xff * (bit == 0))
- self.pixelbuffer[pos + 1] = rffi.r_uchar(0xff * (bit == 0))
- self.pixelbuffer[pos + 2] = rffi.r_uchar(0xff * (bit == 0))
- self.pixelbuffer[pos + 3] = rffi.r_uchar(0xff)
+ pixel = r_uint((0x00ffffff * (bit == 0)) | r_uint(0xff000000))
+ self.pixelbuffer[pos] = pixel
mask >>= 1
- pos += 4
+ pos += 1
# XXX Shouldn't compiledmethod have class reference for subclassed compiled
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit