[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Segmentation Fault in PolyPlay 1.3 Walker demo
Forget that last observation. The traceback doesn't show the arguments
correctly. I have traced the problem to clipaaline. When pts[0] is 0 and
pts[2] is 1 or pts[1] is 0 and pts[3] is 1 it copies pts[2] and pts[3]
to pts[0] and pts[1]. This causes a divided by 0.0 later in drawaaline
which leads to a memory access problem. It doesn't matter if the surface
is 24 or 32 bit.
So for an (800x400) surface s these fail:
aaline(s, color, (0, 0), (1, 248))
aaline(s, color, (0, 0), (248, 1))
These work:
aaline(s, color, (0, 0), (2, 248))
aaline(s, color, (1, 0), (1, 248))
aaline(s, color, (0, 0), (248, 2))
aaline(s, color, (0, 1), (248, 1))
clipaaline has some kind of while loop thing going. I don't feel
qualified enough to guess how it is supposed to work. I will leave it to
someone with a better understanding of antialiasing to fix.
Lenard
Lenard Lindstrom wrote:
To me the traceback shows drawaaline called with surf set to NULL. Am
I reading it incorrectly.
Lenard
René Dudfield wrote:
Cool.
Here's the traceback:
0x01546d05 in drawaaline (surf=0x0, color=0, x1=0, y1=0, x2=1, y2=248,
blend=1) at src/draw.c:1023
1023 DRAWPIX32(pixel, colorptr, brightness1, blend)
(gdb) where
#0 0x01546d05 in drawaaline (surf=0x0, color=0, x1=0, y1=0, x2=1,
y2=248, blend=1) at src/draw.c:1023
#1 0x0154849d in aaline (self=0x0, arg=0x21480) at src/draw.c:660
Marcus von Appen wrote:
DRAWPIX32() seems to be the source as Rene tracked it down and after
giving it a short glance. My guess is that it does not take the
necessary shifts for 24bpp surfaces into account (in fact it does not do
any shifts, but assumes the 3 bytes follow up on each other and are
aligned properly).