[cairo] Problems with InvalidateRect under Windows
adrianlopezroche at gmail.com
Mon Jun 7 13:11:24 PDT 2010
Hi. I'm using Cairo 1.8.10 (precompiled from the GTK+ for Windows page). I
don't know what version of pixman, if any, it's compiled against.
My drawing code looks like this:
HDC hdc = BeginPaint(hwnd, &ps);
HDC memDC = CreateCompatibleDC(hdc);
HBITMAP newbitmap = CreateCompatibleBitmap(hdc, rect.right - rect.left,
rect.bottom - rect.top);
HGDIOBJ oldbitmap = SelectObject(memDC, newbitmap);
cairo_surface_t *surface = cairo_win32_surface_create(memDC);
cairo_t *cr = cairo_create(surface);
/* >>> drawing commands go here <<< */
BitBlt(hdc, 0, 0, rect.right - rect.left, rect.bottom - rect.top, memDC,
0, 0, SRCCOPY);
On Mon, Jun 7, 2010 at 4:40 AM, Tim Teulings <tim at framstag.com> wrote:
> Thanks for your response!
> > 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
> > 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.
> I already tested converting the coordinates 10, 10 using cairo
> user_to_device and device_to_user conversion methods and in both cases got
> 10,10 back, which leads me to the assumption that user and device
> coordinates are the same in my case (identity matrix). Note also that the
> same code work perfectly if I use Windows native drawing functionality and
> using cairo under X11, so it is likely a problem in the interoperation
> between Windows and cairo.
> Could you send me (or point me at) the code for your windows and HDC
> initialization. Possibly there is a difference between your and my code that
> triggers my problem. Can you also state which versions of cairo and pixmap
> you use?
> cairo mailing list
> cairo at cairographics.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cairo