Global selection and defaultBounds

Sven Langkamp sven.langkamp at gmail.com
Sat Mar 27 04:02:07 CET 2010


On Fri, Mar 26, 2010 at 10:13 AM, Boudewijn Rempt <boud at valdyas.org> wrote:

> On Thursday 25 March 2010, Sven Langkamp wrote:
> > Hi,
> >
> > looking at https://bugs.kde.org/show_bug.cgi?id=228983 I found out that
> we
> > currently have a problem with defaultBounds there.
> > I have added a new unit test see
> > KisPixelSelectionTest::testInvertWithImage.
> >
> > The problem is that after inverting the pixel selection selectedExactRect
> > is "infinite". I would expect the it to have the size of the image.
> > The selection has the rootlayer projection as parent and the projection
> has
> > the default defaultBounds which is doesn't use the image bounds.
> >
> > Should we set the defaultBounds on the projection too?
>
> It is worth a try, I think.
>
>
We discussed this on IRC and the problem was bit different. If the selection
has a empty paintdevice as parent it could get problem because the
extent/exactBounds was intersected with the empty extent of the parent.

Here is my patch. Instead of using the parent device it uses
KisDefaultBounds. The new behavior for selectedRect/selectedExactRect is
like this: If the default pixel in MIN_SELECTED than the extent/exactBounds
is used (intersected with defaultBounds to limit to bounds of the image)
else defaultBounds is returned.
DefaultBounds is set for global selection and KisMask.

The patch fixes the crash on inverting a global or local selection.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kimageshop/attachments/20100327/d2723a32/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bounds.diff
Type: text/x-patch
Size: 14793 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kimageshop/attachments/20100327/d2723a32/attachment.diff 


More information about the kimageshop mailing list