Archived

This topic is now archived and is closed to further replies.

spudulike

DDraw Blitting And Strange RECT values

Recommended Posts

Hi, I have a OFFSCREEN surface to which I have drawn a bitmap. I then use Blt to copy the bitmap from the off-screen surface to the back-buffer, which I then flip to the primary surface. My problem is that I seem to lose the last few columns and rows from the bitmap during the blitting. Now the bitmap routine draws the bitmap correctly, because I''ve checked, and the RECTs I use for the blitting are very simple. I draw the bitmap onto the off-screen surface at 0,0,40,40. I then blit this to the back buffer using a destination RECT of 0,0,40,40. The only way I can get the correct sized bitmap using the Blt is to add anything from 1 to 4 in the RECT.right/RECT.bottom calculations. Is there a specific size of RECTs that Blt will work with? Does anyone know what the problem could be? Many thanks in advance for your help. Regards, Mike

Share this post


Link to post
Share on other sites

The Blt code uses the DirectDraw Blt function.

First I draw bitmap of 40,40 pixels to the offscreen buffer at position 0,0. This part uses my own DrawBitmap function which works fine because when I draw to the primary surface it draw correctly.

I then setup to RECT structs, dst and src. The values of these structures are the same. So the src will be 0,0,40,40 and dst is the same.

I then use DirectDraw Blt using the offscreen buffer as the source. Then I flip the back buffer to the primary and its is here I find some columns/rows missing.

The only blitting function I use is DDs Blt.

Share this post


Link to post
Share on other sites
It seems that the RECT.bottom value needs to be one more than the size of the image.

So a 55x55 image would look like:
RECT.left = RECT.top = 0;
RECT.right = 55;
RECT.bottom = 56;

Do you think this could be a problem with Blt or the way I''m doing things?

Thanks,

Mike

Share this post


Link to post
Share on other sites