Advertisement

(int)SurfaceDesc.dwHeight = -885........... HUH??

Started by January 06, 2001 06:24 PM
1 comment, last by MindWipe 24 years ago
  
        int height, width;
	
        if(aRect==NULL){
	 	SurfaceToBlit->Lock(NULL, &SurfaceDesc,0,0);
	 	height = (int)SurfaceDesc.dwHeight;
		width = (int)SurfaceDesc.dwWidth;
		aRect = new RECT;
		SetRect(aRect,0,0,height ,width );
		
	}
 	  
The problem is that: width = -885.... something. And I know that''s the problem because: SetRect(aRect,0,0,640,480); works fine. What could it be? /MindWipe "If it doesn''t fit, force it; if it breaks, it needed replacement anyway."
"To some its a six-pack, to me it's a support group."
The fact that you''re casting it implies that it was something else before... an unsigned int? In which case, casting a large unsigned int to an int might cause a problem. Seems unlikely in this case, but there you go.

Maybe you should be checking the return value of Lock(), too. If Lock() failed, then any kind of garbage could be in SurfaceDesc.

Oh... and I hope you are deleting that ''new Rect'' that you allocate?
Advertisement
i think SurfaceDesc has a member called dwSize, and you didnt initialize it? that could be the mistake!

This topic is closed to new replies.

Advertisement