[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] Alpha blending



> static int screencroprect(GAME_Rect* r, int w, int h)
> {
> if(r->x >= w || r->y >= h || r->x < 0 || r->y < 0)
> return 0;
> 
> I think that this should be:
> 
> if(r->x >= w || r->y >= h || (r->x + w->w) < 0 || (r->y + r->h) < 0)

indeed. this will mean passing a rectangle to display.update()
that has negative values for the X,Y position should be ignored.

yet strangly enough i've got code that is doing passing rects
that are negative to updaterect and they are being updated
properly.
i'll be looking into things further to see why it is working
now. since, now that it has been pointed out, is plain it should
not be.


this will get filed under the "bugs that made it into 1.0"
category. doh.  fortunately, it is easy enough to be aware of
when writing your code. the easiest way to avoid this problem
is to update the rectangles returned from the blit/fill/draw
commands. all these functions return a rectangle of the final
effected area, so if you blit outside the display (or display
clipping area), the returned rectangle will be only the changed
area.

time for bed then, i just can't take any more scared :]




____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org