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

Re: [pygame] Pygame alpha blits and self blitting



I have refined overlapping blit detection so that SDL is used whenever possible. However, there is a slight difference between the SDL and Pygame blit blends. This means a blit to self differs from a blit to another surface with same format and image. The color differences are small, but noticeable when compared side-by-side. I have attached a small program that displays comparable colors from a Pygame and SDL blit using 16 bit surfaces. 32 bit surfaces give almost identical results. The Pygame colors, on top, are lighter. Note the colors don't differ in all cases.

Lenard

Lenard Lindstrom wrote:

True, but I have already done it the hard way. Now to thoroughly test.

Lenard


Brian Fisher wrote:
A simple shotgun fix to bad blitters when blitting a surface to itself could be blitting to itself from a copy.

On Sat, Feb 14, 2009 at 5:10 PM, Lenard Lindstrom <len-l@xxxxxxxxx <mailto:len-l@xxxxxxxxx>> wrote:

    The SDL blitters are used when the destination has no SRCALPHA and
    colorkey or a different pixel size from the source. As I mentioned
    earlier, it is tricky  identifying a problematic self blit. It is
    done by PygameSoftBlit in alphablit.c, but at that point Pygame
    has committed to doing the blit itself. Of course SDL_Blit could
    be called from PyGameSoftBlit or the address calculations --
    involving resolving Rect boundaries -- can be moved to
    PySurface_Blit in surface.c. For the moment I just want to get it
    working correctly. It can be tweaked later. Besides, if the SDL
    blit bugs are fixed, then this patch becomes unnecessary. A search
    in their Bugzille didn't show any bug reports on colorkey blit
    problems though. I only found a one bug report on a problems
    blitting one part of a large surface onto another part.

    Lenard



    René Dudfield wrote:

        Hi,

        I was seeing if it's possible to use the SDL color key
        blitters for
        the cases where they work?  Since they are all mostly
        optimized mmx...
        but maybe I'm missunderstanding what you've done.

        nice work on all the blitter fix-ups by the way :)


        cheers!



--
Lenard Lindstrom
<len-l@xxxxxxxxx>

Attachment: colordif.py
Description: application/python