exactBounds

Cyrille Berger cberger at cberger.net
Tue Jul 17 15:45:14 CEST 2007


On Tuesday 17 July 2007, Sven Langkamp wrote:
> On 7/17/07, Cyrille Berger <cberger at cberger.net> wrote:
> > Hi,
> >
> > KisPaintDevice::exactBounds is intented to return the bound of the paint
> > device, aka the rectangle where there are pixels on the paint device, and
> > it has allways been the case in 1.5/1.6, and if its different in 2.0,
> > then you have found a bug ;) . Beside, a paint device is not necesseraly
> > use with an image.
>
> In selectedExactRect there is (for defaultpixel != SELECTED_MIN):
> exactBounds().unite(m_parentPaintDevice->exactBounds());
> Which I think should return the image bounds.

Well from the dox:
    /**
     * Slow, but exact way of determining the rectangle
     * that encloses the selection
     */

So unless the selection covers the complete image, it should just return the 
bound of the selection. But I don't really understand the union with the 
parent paint device.

Anyway exactBound needs to return the bound of the data on the infinite layer, 
if you need the size of the image, you can get it from the image.

> > >  Affected
> > > by this are e.g. setDirty and selectedExact rect.
> > > At the moment I'm using setDirty(image->bounds()) to work around that.
> > > So either exactBounds() is wrong or it was misused in 1.6.
> >
> > why is it a problem for setDirty ? If you want to dirty the complete
> > paint device, just call setDirty();
>
> setDirty will only dirty the exactBounds, but it should dirty the
> whole paintdevice e.g. after changing the defaultpixel.
Ah yes indeed, I see your problem now :) There is no problem at using 
setDirty(QRect(0,0, image->width(), image->height))

-- 
Cyrille Berger


More information about the kimageshop mailing list