[Lazarus] Getting update rect/region in Windows

Max Vlasov max.vlasov at gmail.com
Sun May 22 11:37:26 CEST 2011


Hi,
I encountered a problem I don't know how to solve.

Some background. Any OS does a great job avoiding unnecessary drawing even
if the program tries to draw everything in the window. But there are
exceptions.
- There are some functions, for example region-related in windows that
nevertheless process full job even if the area the developer is drawing is
not included in the window update region
- There are internal off-screen manipulation so the developer himself have
to do the job of avoiding extra processing so needs to know what the update
region is .

In Delphi I used the following trick. In the WM_Paint before inheried call I
got update region with successive calls to GetUpdateRect (to determine if it
exists) and GetUpdateRgn afterwards. This allowed to get the correct region
before BeginPaint is called (it validates the region so getting it after
BeginPaint makes no sense).

But in Lazarus WM_Paint handler already contains DC and also GetUpdateRect
call is failed. As I understand, this is because the WindowProc from
win32callback.inc already did BeginPaint and provided the dc for the
following call to the control WM_Paint.

So the questions are:
- is there a chance to intervene into lazarus drawing chain to get the
update region before lazarus root windowproc call.
- if the first is not possible (or too complex)  is it possible for lazarus
to save the update region somewhere before BeginPaint or maybe do this
optionally based on the special property value sure set to false by default

Thanks

Max Vlasov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110522/c31a13cd/attachment-0002.html>


More information about the Lazarus mailing list