Archived

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

Clipper Question

This topic is 6362 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey all, Well im haveing a problem with my clipper, here is the code:
      
  
LPDIRECTDRAWCLIPPER  lpddclipper = NULL;
LPRGNDATA           clipper;

       ddrval = CoCreateInstance(&CLSID_DirectDrawClipper, 
       NULL, CLSCTX_ALL, &IID_IDirectDrawClipper, &lpddclipper); 
       if (!FAILED(ddrval)) 
          ddrval = IDirectDrawClipper_Initialize(lpddclipper,  lpDD, 0UL);


        if(FAILED(lpDD->CreateClipper(0, &lpddclipper, NULL))) {

		MessageBox(hwnd, "no dude 1", "", MB_OK);

	}

	clipper = (LPRGNDATA)malloc(sizeof(RGNDATAHEADER)+1*sizeof(RECT));

	clipper->rdh.dwSize = sizeof(RGNDATAHEADER);
	clipper->rdh.iType = RDH_RECTANGLES;
	clipper->rdh.nCount = 1;
	clipper->rdh.nCount = 1 * sizeof(RECT);

	clipper->rdh.rcBound.top = 0;MessageBox(hwnd, "no dude 1", "", MB_OK);
	clipper->rdh.rcBound.left = 0;
	clipper->rdh.rcBound.right = 640;
	clipper->rdh.rcBound.bottom = 480;

	if(FAILED(lpddclipper->SetClipList(clipper, 0))) {

		MessageBox(hwnd, "no dude 2", "", MB_OK);
	}
	if(FAILED(lpDDSBack->SetClipper(lpddclipper))) {

		MessageBox(hwnd, "no dude 3", "", MB_OK);
	}

	free(clipper);
        
does anything look wrong with that? I can't figure out whats wrong, createclipper keeps failing. Well thanks. James Later Edited by - JSCFaith on 7/16/00 8:01:15 AM

Share this post


Link to post
Share on other sites

I think you may have missed that you''re setting clipper->rdh.nCount twice. Get rid of the second assignment; This should be a count, (hence the name of the variable), and not the length of the buffer. Also, don''t set the right and bottom extents of the region to that of the screen size. It has to be the right and bottom-most pixel addressable. So it should be from 0,0 to 639,479.

Also, I think there may be flags that need to be set in the IDIRECTDRAWCLIPPER structure. Check the docs...

Share this post


Link to post
Share on other sites