• ### Announcements

#### Archived

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

# Very slow blt

## Recommended Posts

Hello everyone. I''m trying to get this function to work right. ATM, a 320x200 image makes this routine go PAINFULLY slow.. It''s quite frustrating, so any input is helpful.
void Frame::Draw()
{

////exit if not created.

if(!this->created)
return;

int flagFlipVert=0, flagFlipHoriz=0;

//if we''re flipping, we need to use a blt fx strucvt

DDBLTFX fx;

//clear the structure

ZeroMemory(&fx,sizeof(fx));
fx.dwSize=sizeof(DDBLTFX);

//ok... now set the flags that we created based on what we have.

if(this->flipHorizontal) {

//we''re flipping horizontal. Use the ddraw flag

flagFlipHoriz= DDBLTFX_MIRRORLEFTRIGHT ;
}

//if we''re flipping vertically...

if(this->flipVertical) {

//set the value to mirror vertically.

flagFlipVert=  DDBLTFX_MIRRORUPDOWN;
}

//now, put the values into the fx structure

fx.dwDDFX=flagFlipVert | flagFlipHoriz;

//retrieve the surface from the frame

LPDIRECTDRAWSURFACE7 surface = Images[this->imageNumber]->GetSurf();

//Get the width and height of the image.

int w=Images[imageNumber]->GetWidth();
int h=Images[imageNumber]->GetHeight();

//the destination will be 0,0 (draws at 0,0) and the width and height.

RECT dest={0,0,w,h};

//draw to the back.

back->Blt(&dest, surface, &dest,DDBLT_WAIT | DDBLT_DDFX | DDBLT_KEYSRC, &fx);

}


I''ve used very similiar code to this in the past. It worked fine, but I''ve never tested it on an image of that size before. Also, I''m running on a abit nf7-s/barton 2500+ /geforce 4 mx440 (pci) I know the graphics card isn''t great. But with my current system, shouldn''t I expect to see this simple low resolution image be able to be flipped without critically hurting my FPS?

##### Share on other sites
I''m pretty sure flipping in DirectDraw was hardware
specific. Their emulation is worth laughing at. Not
to mention that they have to pull that image out
of video memory, flip it onto an entirely different
surface, then copy it all back to video memory.

Either draw two bitmaps or write your own method.