[cairo] Problems with InvalidateRect under Windows

Adrian Lopez adrianlopezroche at gmail.com
Sun Jun 6 11:17:21 PDT 2010


I'm using Cairo under Windows with the same approach and have not
experienced any problems with InvalidateRect. InvalidateRect expects
coordinates in what Cairo calls device space, so make sure the rectangle you
pass to InvalidateRect is defined in device space rather than user space.
Call cairo_user_to_device to convert from user space to device space.

On Sun, Jun 6, 2010 at 5:54 AM, Tim Teulings <tim at framstag.com> wrote:

> Hello!
>
> I now started using cairo not only under X11 but also under Windows. My
> code is designed that way, that I only draw within the WM_PAINT event,
> creating a cairo surface using the HDC returned by BeginPaint (AFAIK this is
> the recommended way). For getting parts of the windows repainted because of
> changes (in reaction to user input) I call InvalidateRect (I also tried
> RedrawWindow with same results) with the RECT to get redrawn to trigger
> WM_PAINT message for the given region (AFAIK this is also the recommended
> way).
>
> This works fine for WM_PAINT messages created by the system (initial
> WM_PAINT on window open, WM_PAINT messages on window resize) but it fails
> for WM_PAINT messages created by InvalidateRect - if a valid RECT* is handed
> over. While the content of WM_PAINT is correct and cairo_clip_extents() on
> the temporary surface shows reasonable values in all cases (while having the
> coordinate origin obviously in lower left, instead upper left) , nothing
> gets drawn at all. As soon as I pass NULL as RECT*, redraw works like a
> charm. However doing full screen refresh on every redraw is obviously not a
> long term solution ;-) I assume that cases where the cliping reagion on the
> HDC is not the full window are differently (and possibly wrongly?) handled
> or I'm doing something wrong (e.g. are there any coordinate system
> transformations necessary on the Windows or cairo side I'm missing?).
>
> I'm using cairo-1.9.6 together with pixmap-0.18.2
>
> --
> Gruß...
> Tim
>
>
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20100606/aafd309f/attachment.html>


More information about the cairo mailing list