Consider the following code snippet:
HRGN clip = ::CreateRectRgn(50, 50, 100, 100); ::SelectClipRgn(context, clip); ::Rectangle(context, 0, 0, 50, 50);
Is Microsoft’s clipping implementation intelligent enough to return immediately from the call to Rectangle without attempting to draw anything? I suspect it probably is but have been unable to find confirmation anywhere. The MSDN documentation for clipping is sparse on under the hood details, and Googling turns up nothing but how to use GDI clipping.
EDIT: It dawned on me that I failed to point out that this is running on Windows Mobile so the toolset I have for analysis is limited.
I actually pulled my Petzold (2nd Edition) from the shelf and found that, not surprisingly, clipping was an important feature in the early versions of the Windows SDK. Back then it was necessary for performance reasons to not draw objects that are invisible. I would say that GDI clipping is in fact smart enough and will do nothing when you draw outside the clipping region.