Should BlitSurface() update destrect?

I’m trying to track down an issue with rotozoom and found that my calls to
SDL_BlitSurface() appear to update the destrect h and w values. Is this
normal/expected?

I set the destrect h and w values to something like 2 and 2. A printf call
reports the values as expected. I execute SDL_BlitSurface(paddleImage,
NULL, screen, &paddle1Rect). I then printf the paddle1Rect h and w values,
but the result is the original image size (20 and 60). Should the
BlitSurface call have updated the paddle1Rect h and w values?

Thanks,
Jake

Yeah, it changes the destrect to the actual rect used. This is so that it
can then be used by dirty rect routines or other things which need to know
about the actual region used. You’ll notice it as well when drawing smaller
rects near the edge of a surface, as they get clipped. To get around it,
copy the rect, then pass it in.

SDL_Rect destrectcpy = destrect;
SDL_BlitSurface(src, &srcrect, dst, &dstrectcpy);

Jonny DOn Mon, Oct 4, 2010 at 8:53 PM, Jake Magee wrote:

I’m trying to track down an issue with rotozoom and found that my calls to
SDL_BlitSurface() appear to update the destrect h and w values. Is this
normal/expected?

I set the destrect h and w values to something like 2 and 2. A printf call
reports the values as expected. I execute SDL_BlitSurface(paddleImage,
NULL, screen, &paddle1Rect). I then printf the paddle1Rect h and w values,
but the result is the original image size (20 and 60). Should the
BlitSurface call have updated the paddle1Rect h and w values?

Thanks,
Jake


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org