bltSelection and fill bucket

Boudewijn Rempt boud at valdyas.org
Mon Nov 24 09:10:14 CET 2008


On Sunday 23 November 2008, Cyrille Berger wrote:
> Hi,
>
> Investigating, https://bugs.kde.org/show_bug.cgi?id=174577, I found the
> problem (or shall I say the problems):
> * in kis_fill_painter.cc:223 (function KisFillPainter::genericFillEnd) we
> call selectedExactRect which return the intersection of the exact rect of
> selection with the exact rect of the current layer (which becomes null in
> case of an empty layer)

I guess this bug is caused by me removing the reference to the image from the 
paint device: we used to use the image dimensions in these cases. But I think 
that perhaps the entire idea of bounding the selection by the size of the 
paint device might be wrong.

> * the second problem comes from bltSelection, which interest the rectangle
> where we want to apply the selection with the exactBounds of the paint
> device, it's line kis_painter.cc:410 :
>      srcRect &= srcdev->exactBounds();

That's weird, though, since here the src dev is the filled paint device, which 
is isn't empty, but filled to the size of m_width and m_height. Unless we do 
that through setting the default pixel, but that doesn't seem the case, so if 
srcRect is correct, then this line should not be a problem.

> The solution to the first problem is easy, calling
>     bltSelection(0, 0, compositeOp(), filled, m_fillSelection, opacity(),
> 0, 0, m_width, m_height);
> instead would work.

Yes -- or unite rc with filled.bounds().

> But I am not sure how to solve the problem of bltSelection intersecting the
> rect. Shall I remove the line kis_painter.cc:410 ? Any better idea ?

I'm not sure: I see that the fill painter unittest is pretty basic at the 
moment (to say the least), but the painter test is already quite good. We need 
to add better tests for the fill painter :-)

-- 
Boudewijn Rempt | http://www.valdyas.org


More information about the kimageshop mailing list