From kde-commits Wed Jun 30 22:21:05 2004 From: Maks Orlovich Date: Wed, 30 Jun 2004 22:21:05 +0000 To: kde-commits Subject: kdenonbeta/style-workshop/largeimagelib Message-Id: <20040630222105.4DD139447 () office ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=108863407111739 CVS commit by orlovich: Fix the major scaling bug: Do not create tiles in the basic plane as reconstructable just because there is a scaled plane. Oops. Also,instead of discarding swapped out loader backing store, keep track of dirtiness, and update it. M +3 -4 frame.cpp 1.15 M +13 -6 imagetile.cpp 1.3 M +6 -1 imagetile.h 1.2 --- kdenonbeta/style-workshop/largeimagelib/frame.cpp #1.14:1.15 @@ -208,5 +208,5 @@ const QImage& Frame::image(bool forceBas */ ImageManager::imageCache()->acquireSpot(); - ts.image = ImageTile::create(scaledPlane, &ts, tw, th, format); + ts.image = ImageTile::create(usePlane == scaledPlane, &ts, tw, th, format); ImageManager::imageCache()->addEntry(ts.image); } @@ -460,7 +460,6 @@ void Frame::notifyScanline(uchar version format.depth() * basicPlane->tileWidth(tileX)); - //Invalidate the backing store, if any - if (ts.swappedInfo.exists()) - ImageManager::vmMan()->free(ts.swappedInfo); + //Mark as dirty.. + ts.image->setDirty(); } --- kdenonbeta/style-workshop/largeimagelib/imagetile.cpp #1.2:1.3 @@ -36,4 +36,5 @@ ImageTile* ImageTile::create(bool recons tile->owner = owner; tile->reconstructable = reconst; + tile->dirty = false; //Give the proper geometry, set palette if needed be @@ -71,5 +72,7 @@ ImageTile* ImageTile::restore(TileStack* void ImageTile::discard() { - if (!reconstructable && !owner->swappedInfo.exists()) //we don't swap out things we can rebuild anyway + if (!reconstructable) //we don't swap out things we can rebuild anyway + { + if (!owner->swappedInfo.exists()) { int size = image.width() * image.height() * (image.depth() / 8); @@ -77,4 +80,8 @@ void ImageTile::discard() owner->swappedInfo = ImageManager::vmMan()->alloc(size); + dirty = true; //must write out the first time + } + + if (dirty) owner->swappedInfo.swapOut(image.bits()); } --- kdenonbeta/style-workshop/largeimagelib/imagetile.h #1.1:1.2 @@ -48,4 +48,5 @@ private: bool reconstructable; + bool dirty; friend class Pool; @@ -63,4 +64,8 @@ public: } + void setDirty() + { + dirty = true; + } };