Patch: don't save tiles that are equal to the default tile

Dmitry Kazakov dimula73 at gmail.com
Tue Mar 16 17:03:43 CET 2010


On Tue, Mar 16, 2010 at 6:42 PM, Cyrille Berger <cberger at cberger.net> wrote:

> On Tuesday 16 March 2010, Dmitry Kazakov wrote:
> > Selections and cutting should use KisDataManager::clear(), through
> > KisPaintDevice::fill() [1]. This method uses tiles to fill the rect and
> > substitutes default tile, if the fill-pixel is default.
> Should really the data manager knows about selection ? Or maybe we could
> call
> a data manager function to tell it check that area for "default" tiles.
>

Of course it should know nothing! ;) At least not more than we agreed during
filter api discussion.
Selections even don't need the access to datamanager. The only thing they
need:

KisPaintDevice::fill(color, rect)
KisPaintDevice::setDefaultPixel(color)
KisPaintDevice::defaultPixel()
KisPaintDevice::region() [not implemented yet]

Changing the default pixel to e.g. QColor(255,255,255) would create an
infinite selection. And selectedRect() will start to return image->bounds()
instead of empty rect.

Changing the default pixel to QColor(0,0,0) will select nothing by default.

Calling fill() will just select/deselect a rect.

region() is what we were discussing on sprint.

Why do you think data manager should know anything?



>
> > The eraser tool can use clear() too.
> That is starting to be difficult, since it is done through the eraser
> composite
> op (that you can anyway select with any paintop...) But that would be
> marginal, main problem is cutting.
>
yeah...

Well, maybe this deleting default tiles can be useful in some rare
circumstances, but i think this feature should be done at the different
level. It should be something like: KisTileHashTable::purge(). And we
needn't call it every time we save an image, as it is too expensive.


-- 
Dmitry Kazakov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kimageshop/attachments/20100316/252064db/attachment-0001.htm 


More information about the kimageshop mailing list