Archived

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

olle55

problem with the blitter.

Recommended Posts

Hello. I am trying to blit from one ofscreen surface to another. It compiles fine without errors and warnings. But when i start the program it terminates imediatly. I have traced the problem to a part in my code i recently added. Im trying to blit from one DDSCAPS_OFFSCREENPLAIN surface to another. Is this supposed to work or is it just me writing bad code? Blitting from anywhere to the backbuffer or primarysurface works just fine. This is my ofscreen surface, the other surface, the on im trying to blit from comes from the DDLoadBitmap() function in ddutil.h:
  
DDSURFACEDESC2 ddsd; // used to create surface

LPDIRECTDRAWSURFACE7		ddoffscreensurf;
    memset(&ddsd,0,sizeof(ddsd));
    ddsd.dwSize  = sizeof(ddsd);
    ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
    ddsd.dwWidth  = bob->width + bob->width_fill;
    ddsd.dwHeight = bob->height;

    // set surface to offscreen plain

    ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | mem_flags;

    // create the surfaces

    if (lpdd->CreateSurface(&ddsd,&ddoffscreensurf,NULL)!=DD_OK)
        return(0);
  
The ddutil.h bitmap surface:
   
LPDIRECTDRAWSURFACE7		ddloadbmp;
ddloadbmp = DDLoadBitmap(lpdd, "test.bmp", 0, 0);
  
And finaly, this is how i blit:
   
RECT fill_area;  // this contains the destination rectangle

	fill_area.left		= 1;
	fill_area.top		= 1;
	fill_area.right		= 20;
	fill_area.bottom	= 20;

		
ddoffscreensurf->Blt(&fill_area, // ptr to dest rectangle

                  ddloadbmp,       // ptr to source surface, NA            

                  NULL,       // ptr to source rectangle, NA

                  DDBLT_WAIT | DDBLT_KEYSRC,   // fill and wait                   

                  NULL);  // ptr to DDBLTFX structure	

  
Thanks in advance for any help. //Olle55

Share this post


Link to post
Share on other sites