Commit 7d412c71 authored by Dmitry Kazakov's avatar Dmitry Kazakov
Browse files

Fix Transorm Worker to shrink device bounds when doing scale-down

When doing a scale-down a great portion of the image becomes filled
with the default pixel. If the default pixel of a paint device is not
fully transparent, then the exactBounds() will not shrink automatically.
That is why we need to purge() all the default tiles of the paint device

Note: the Crop visitor needs *not* the same stuff, since
      KisPaintDevice::crop() calls KisDataManager::setExtent() which
      explicitly drops all the tiles outside of the requested area.

Special thanks to Boud, who has found the real cause of the bug!

parent fc3fd9c4
......@@ -525,6 +525,11 @@ void KisPaintDevice::crop(const QRect &rect)
void KisPaintDevice::purgeDefaultPixels()
void KisPaintDevice::setDefaultPixel(const quint8 *defPixel)
......@@ -227,6 +227,12 @@ public:
void clear(const QRect & rc);
* Frees the memory occupied by the pixels containing default
* values. The extents() and exactBounds() of the image will
* probably also shrink
void purgeDefaultPixels();
* Sets the default pixel. New data will be initialised with this pixel. The pixel is copied: the
......@@ -397,6 +397,12 @@ bool KisTransformWorker::run()
* Purge the tiles which might be left after scaling down the
* image
return true;
......@@ -297,6 +297,8 @@ void KisTiledDataManager::purge(const QRect& area)
foreach(KisTileSP tile, tilesToDelete) {
quint8* KisTiledDataManager::duplicatePixel(qint32 num, const quint8 *pixel)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment