Jump to content
  • Advertisement
Sign in to follow this  

GDI Clipping Region question

This topic is 4718 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

Hi I am having some trouble figuring out the best way to proceed. I am trying to make a Solitaire clone. However I have some performance issues when moving cards. I know this is because I redraw every card when moving a single card. So here is a simple rundown of my code: 1. Beginpaint 2. ExcludeCardregions (avoid flickering effect ... using RectVisible() to - improve performance here) 3. DrawTableBackGround (Causes flickering if I don't do step 2) 4. SelectClipRegion(hDC, NULL) 5. DrawCards 6. Endpaint My problem is step 4. By doing this I remove the clipping region set by the update region. Now I can't use RectVisible() in step 5 to improve performance as all the cards will still be drawn I was thinking of copying the Clipregion between 1 and 2 and then passing that as a value at 4 instead of NULL. However, I am unsure of how to proceed here. I have looked at GetClipRgn() but it says it only gets the application specific regions not the one set by BeginPaint-EndPaint. What would be the best way to do this Thanks

Share this post


Link to post
Share on other sites
Advertisement
Just a progress report. I decided to try and use the RECT in the PAINSTRUCT from BeginPaint like so (inserted):

1.1 HRGN hRgn = CreateRectRgn(...using the PAINTSTRUCT...)

4. SelectClipRgn(hDC, hRgn)

This, however isn't working. It just result in the updated portion becoming smaller and smaller until ... well it doesn't draw anymore.

Share this post


Link to post
Share on other sites
I figured it out myself!!!!!

I was working on the assumption that the region I specified with SelectClipRgn() is removed at the end of EndPaint() or WM_PAINT. It wasn't! I fixed it by just calling SelectClipRgn(hDC, NULL) at the end.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!