[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Another blitting surface to itself crash



Ok, I have been informed there is are PyGame blits not derived from SDL, so that explains that.

{pygame_AlphaBlit, pygame_Blit} from clip above looks like

Seems oblivious (sic) now it's pointed out.


On Sat, Aug 16, 2008 at 4:37 PM, Nicholas Dudfield <ndudfield@xxxxxxxxx> wrote:
I had a little play with the test_blit_to_self.py: 

SDL VERSION:

1.2.13 prebuilts

PYGAME:

Mingw compiled, svn r 1619

OBSERVATIONS:

Unmodified the test wouldn't run at all as noted earlier.

I don't know if it's any help but I noticed after commenting out the "blitting screen to self" section that I could get the "blitting surface to self" test and "blitting surface to screen" to run the full 100 cycles if I instantiated the Surface `a` with pygame.SRCALPHA flags.

Also, if using BLEND_RGB_ADD flags "blitting screen to self" worked. Also screen.copy() worked as a source... but eh.

CONCLUSIONS:

s.blit(s, (0,0)) works if SRCALPHA bits set for s
screen.blit(screen, step, None, pygame.BLEND_RGB_ADD)

Is that any help for you guys in debugging?? I have no C-fu or I would have a tinker myself.

Cheers.

ps... attached modified version of test with "use alpha blit" changes


pps.

This is in surface.c around line 1996.... ??

    /* see if we should handle alpha ourselves */
    if (dst->format->Amask && (dst->flags & SDL_SRCALPHA) &&
        !(src->format->Amask && !(src->flags & SDL_SRCALPHA)) &&
        /* special case, SDL works */
        (dst->format->BytesPerPixel == 2 || dst->format->BytesPerPixel == 4))
    {
        result = pygame_AlphaBlit (src, srcrect, dst, dstrect, the_args);
    }
    else if (the_args != 0)
    {
        result = pygame_Blit (src, srcrect, dst, dstrect, the_args);
    }
    else
    {
        result = SDL_BlitSurface (src, srcrect, dst, dstrect);
    }