Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Update cache when cloning perspective assistants

Dmitry Kazakov73025b43bf68
diff --git a/plugins/assistants/Assistants/PerspectiveAssistant.cc b/plugins/assistants/Assistants/PerspectiveAssistant.cc
index f53bf43dee..a7af9c3468 100644
--- a/plugins/assistants/Assistants/PerspectiveAssistant.cc
+++ b/plugins/assistants/Assistants/PerspectiveAssistant.cc
@@ -40,6 +40,7 @@ PerspectiveAssistant::PerspectiveAssistant(const PerspectiveAssistant &rhs, QMap
, m_cachedTransform(rhs.m_cachedTransform)
, m_cachedPolygon(rhs.m_cachedPolygon)
, m_cacheValid(rhs.m_cacheValid)
+ , m_cache(rhs.m_cache)
{
for (int i = 0; i < 4; ++i) {
m_cachedPoints[i] = rhs.m_cachedPoints[i];
@@ -129,6 +130,7 @@ bool PerspectiveAssistant::contains(const QPointF& pt) const
qreal PerspectiveAssistant::distance(const QPointF& pt) const
{
+ KIS_SAFE_ASSERT_RECOVER_NOOP(m_cacheValid);
return PerspectiveBasedAssistantHelper::distanceInGrid(m_cache, pt);
}
diff --git a/plugins/assistants/Assistants/PerspectiveEllipseAssistant.cc b/plugins/assistants/Assistants/PerspectiveEllipseAssistant.cc
index 9443eb78da..6aa13756ac 100644
--- a/plugins/assistants/Assistants/PerspectiveEllipseAssistant.cc
+++ b/plugins/assistants/Assistants/PerspectiveEllipseAssistant.cc
@@ -342,6 +342,7 @@ PerspectiveEllipseAssistant::PerspectiveEllipseAssistant(const PerspectiveEllips
, KisPaintingAssistant(rhs, handleMap)
, d(new Private())
{
+ updateCache();
}
KisPaintingAssistantSP PerspectiveEllipseAssistant::clone(QMap<KisPaintingAssistantHandleSP, KisPaintingAssistantHandleSP> &handleMap) const
@@ -603,6 +604,7 @@ bool PerspectiveEllipseAssistant::contains(const QPointF &point) const
qreal PerspectiveEllipseAssistant::distance(const QPointF &point) const
{
+ KIS_SAFE_ASSERT_RECOVER_NOOP(d->cacheValid);
return PerspectiveBasedAssistantHelper::distanceInGrid(d->cache, point);
}