[cairo] Problem with directly drawing to a GDI context

Andrej Mitrovic andrej.mitrovich at gmail.com
Thu Aug 25 07:24:33 PDT 2011


Here's a simple example of drawing with either GDI, cairo directly to
a device context, and cairo to a memory buffer:

http://codepad.org/BVJ6hOjU

If I use the FillGDI() function and try to move another window on top
of the app, the app's client area that becomes visible is filled with
blue and there's no issues.

However If I use FillCairo(), I have this issue: http://i.imgur.com/87BUf.png

This problem goes away if I use cairo to draw into a memory buffer and
then blit to the device context, in this case I use BufferFillCairo().

Is this some kind of a bug or do I always have to use a memory buffer
when drawing with cairo?

If I disable redrawing of the entire background (by returning 1 in the
WM_ERASEBKGND message), the effect is similar:
http://i.imgur.com/ns1xB.png
And again in that case the FillGDI and BufferFillCairo functions work
fine, but FillCairo() has these issues.


More information about the cairo mailing list