[cairo] win32: Bug in partial redrawing triggered by InvalidateRect

Matthias Bolte matthias.bolte at googlemail.com
Mon Jul 25 04:14:24 PDT 2011

I came across this problem while updating from cairo 1.8 to 1.10.

In 1.8 Triggering partial redraws via InvalidateRect works as
expected. In 1.10 it doesn't. The size of the rect is correct but the
offset is lost and the top-left corner of the window is redrawn with
the wrong content as the content comes from the correct offset.

I tracked the problem down to this commit

surface-fallback: Convert to composite rectangles


But I could not understand why this commit breaks partial redraws.

Today I found a mail on the mailing list about this problem


that refers to a bug report from 2010 about this problem


that has a working patch attached


The offending commit seems to have broken the handling of surfaces
that don't have their origin in (0,0) as it switched to the
_cairo_composite_rectangles_init* functions that assume that the
surface has it's origin in (0,0).

The problem seems to be that a BeginPaint call (as a reaction to a
WM_PAINT message triggered by a InvalidateRect) can return a DC with
an origin equal to the offset given in the InvalidateRect. So there is
a DC with an origin different from (0,0).

The referenced patch makes _cairo_composite_rectangles_init* honor
this offset and fixes the problem.

Now I wonder why this patch from October 2010 has neither been
reviewed nor been applied yet. This mail is an attempt to finally get
this problem fixed.

Matthias Bolte

More information about the cairo mailing list