• Announcements

Archived

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

DirectDraw Blitting

Recommended Posts

I''m trying to blit using a direct draw surface, and everything is great, but whenever the image is just barely off the surface, it won''t blit the image at all. So if even a pixel of the blit is off, nothing shows up, but if it''s on teh surface it''s fine. I''m using BltFast, and like this: backSurface->BltFast(x,y,ball,NULL,DDBLTFAST_WAIT | DDBLTFAST_SRCCOLORKEY); and then i''m flipping the surfaces with while(result == DDERR_WASSTILLDRAWING) result = primarySurface->Flip(NULL, DDFLIP_WAIT); if anyone can help, ill be very appriciative

Share on other sites
BltFast doesn''t handle clipping. You can either make sure the BltFast stuff doesn''t ever go off the screen (a few if... statements will do the trick) or you can attach an IDirectDrawClipper and use Blt instead of BltFast.

Share on other sites
Can you still use Bltfast after attaching a clipper? or is it impossible?

I''d like to use Bltfast to blit my background image, because it might be just that little bit faster. but it doesn''t work at all :/

It''''s nice to be important, but it''''s more important to be nice.

Share on other sites
quote:
Can you still use Bltfast after attaching a clipper? or is it impossible?

BltFast reference says...

quote:
This method works only on display memory surfaces and cannot clip when blitting. If you use this method on a surface with an attached clipper, the call fails, and the method returns DDERR_UNSUPPORTED.

quote:
I'd like to use Bltfast to blit my background image, because it might be just that little bit faster. but it doesn't work at all :/

...and the survey says...

quote:
The software implementation of IDirectDrawSurface7::BltFast is 10 percent faster than the IDirectDrawSurface7::Blt method. However, there is no speed difference between the two if display hardware is used.

(Note: I don't know the effect that a clipper has in terms of speed. I'd be surprised if it made a significant difference, though.)

[edited by - Alimonster on October 19, 2002 8:20:29 PM]

Share on other sites
You can do your own clipping by adjusting the SrcRect in the BltFast parameters.

    // sX,sY = sprite pos// sWidth,sHeight = sprite size//  RECT srect = { 0, 0, sWidth, sHeight }; int dX = sX, dY = sY;  // Adjust right/bottom if ( sX + sWidth > SCREEN_WIDTH )   srect.right = SCREEN_WIDTH - sX;  if ( sY + sHeight > SCREEN_HEIGHT )  srect.bottom = SCREEN_HEIGHT - sY;  // Adjust top/left if ( sX < 0 ) srect.left = - sX;  if ( sY < 0 ) srect.top = - sY;  if ( dX < 0 ) dX = 0; if ( dY < 0 ) dY = 0;  lpDDSBack->BltFast( dX, dY, lpDDSGfx, &srect, 0);

[edited by - Prototype on October 19, 2002 9:16:24 PM]

Share on other sites
Adjusting the SrcRECT seems to be the quickest. I have been working with the same issue. I did some testing and stuck with that.

• Forum Statistics

• Total Topics
627744
• Total Posts
2978902

• 10
• 10
• 21
• 14
• 14