Commit 597d28b1 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Fix updates in the new transform tool

Batch markers must not be compressed. I thought that returning a fake
LoD would ensure it, but it is not the case. If we have multiple "start"
(or "end") markers, they should not be compressed as well. For this
purpose, I introduced KisUpdateInfo::canBeCompressed(), which returns
false for all the marker info objects.
parent 8bd149b4
...@@ -25,20 +25,23 @@ bool KisCanvasUpdatesCompressor::putUpdateInfo(KisUpdateInfoSP info) ...@@ -25,20 +25,23 @@ bool KisCanvasUpdatesCompressor::putUpdateInfo(KisUpdateInfoSP info)
if (newUpdateRect.isEmpty()) return false; if (newUpdateRect.isEmpty()) return false;
QMutexLocker l(&m_mutex); QMutexLocker l(&m_mutex);
KisUpdateInfoList::iterator it = m_updatesList.begin();
if (info->canBeCompressed()) {
while (it != m_updatesList.end()) { KisUpdateInfoList::iterator it = m_updatesList.begin();
if (levelOfDetail == (*it)->levelOfDetail() && while (it != m_updatesList.end()) {
newUpdateRect.contains((*it)->dirtyImageRect())) { if ((*it)->canBeCompressed() &&
levelOfDetail == (*it)->levelOfDetail() &&
/** newUpdateRect.contains((*it)->dirtyImageRect())) {
* We should always remove the overridden update and put 'info' to the end
* of the queue. Otherwise, the updates will become reordered and the canvas /**
* may have tiles artifacts with "outdated" data * We should always remove the overridden update and put 'info' to the end
*/ * of the queue. Otherwise, the updates will become reordered and the canvas
it = m_updatesList.erase(it); * may have tiles artifacts with "outdated" data
} else { */
++it; it = m_updatesList.erase(it);
} else {
++it;
}
} }
} }
......
...@@ -42,6 +42,11 @@ QRect KisUpdateInfo::dirtyViewportRect() ...@@ -42,6 +42,11 @@ QRect KisUpdateInfo::dirtyViewportRect()
return QRect(); return QRect();
} }
bool KisUpdateInfo::canBeCompressed() const
{
return true;
}
QRect KisPPUpdateInfo::dirtyViewportRect() { QRect KisPPUpdateInfo::dirtyViewportRect() {
return viewportRect.toAlignedRect(); return viewportRect.toAlignedRect();
} }
...@@ -119,3 +124,8 @@ int KisMarkerUpdateInfo::levelOfDetail() const ...@@ -119,3 +124,8 @@ int KisMarkerUpdateInfo::levelOfDetail() const
// with other updates // with other updates
return -1 - (int)m_type; return -1 - (int)m_type;
} }
bool KisMarkerUpdateInfo::canBeCompressed() const
{
return false;
}
...@@ -37,6 +37,7 @@ public: ...@@ -37,6 +37,7 @@ public:
virtual QRect dirtyViewportRect(); virtual QRect dirtyViewportRect();
virtual QRect dirtyImageRect() const = 0; virtual QRect dirtyImageRect() const = 0;
virtual int levelOfDetail() const = 0; virtual int levelOfDetail() const = 0;
virtual bool canBeCompressed() const;
}; };
Q_DECLARE_METATYPE(KisUpdateInfoSP) Q_DECLARE_METATYPE(KisUpdateInfoSP)
...@@ -159,6 +160,7 @@ public: ...@@ -159,6 +160,7 @@ public:
QRect dirtyImageRect() const override; QRect dirtyImageRect() const override;
int levelOfDetail() const override; int levelOfDetail() const override;
bool canBeCompressed() const override;
private: private:
Type m_type; Type m_type;
......
Markdown is supported
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