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

Matthias Bolte matthias.bolte at googlemail.com
Wed Jul 27 02:54:46 PDT 2011


2011/7/26 Andrea Canciani <ranma42 at gmail.com>:
> On Mon, Jul 25, 2011 at 1:14 PM, Matthias Bolte
> <matthias.bolte at googlemail.com> wrote:
>> 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
>>
>> b713510f213d0a83cb0575d6870416a0f13786c9
>> surface-fallback: Convert to composite rectangles
>>
>> http://cgit.freedesktop.org/cairo/commit/?id=b713510f213d0a83cb0575d6870416a0f13786c9
>>
>> But I could not understand why this commit breaks partial redraws.
>>
>> Today I found a mail on the mailing list about this problem
>>
>> http://lists.cairographics.org/archives/cairo/2011-March/021800.html
>>
>> that refers to a bug report from 2010 about this problem
>>
>> https://bugs.freedesktop.org/show_bug.cgi?id=28541
>>
>> that has a working patch attached
>>
>> http://sprunge.us/KOZU
>>
>> 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.
>
> I just updated the bug with some information.
> I thought that a discussion about this patch happened on
> the mailing lists, but right now I'm unable to find it
> (Probably it was actually on IRC)
>
> Sorry for not having updated the bugreport with the nack-review immediately
>
> Andrea

Thanks for updating the bugreport and thanks to Chris Wilson for
fixing the problem with commit

91faf9c1cf79f44b48c0f14d2d551a68bf38b5a5
composite: Pass unbounded extents to initialisation

-- 
Matthias Bolte
http://photron.blogspot.com


More information about the cairo mailing list