[escher] Avoid useless redrawing in ExpressionView::setLayout

This commit is contained in:
Léa Saviot
2020-05-14 17:13:47 +02:00
committed by Émilie Feral
parent e8d97f561c
commit 3e4478454c
2 changed files with 7 additions and 6 deletions

View File

@@ -18,13 +18,11 @@ ExpressionView::ExpressionView(float horizontalAlignment, float verticalAlignmen
}
bool ExpressionView::setLayout(Layout layoutR) {
/* TODO: this would avoid some useless redrawing. However, when we call
* setLayout after raising an Exception that led to erase all
* Poincare::TreePool, accessing m_layout will result in an ACCESS ERROR.
* How do we avoid that? */
/*if (m_layout.isIdenticalTo(layoutR)) {
if (!m_layout.wasErasedByException() && m_layout.isIdenticalTo(layoutR)) {
/* Check m_layout.wasErasedByException(), otherwise accessing m_layout would
* result in an ACCESS ERROR. */
return false;
}*/
}
m_layout = layoutR;
markRectAsDirty(bounds());
return true;

View File

@@ -62,6 +62,9 @@ public:
uint16_t identifier() const { return m_identifier; }
TreeNode * node() const;
bool wasErasedByException() const {
return hasNode(m_identifier) && node() == nullptr;
}
int nodeRetainCount() const { return node()->retainCount(); }
size_t size() const;
void * addressInPool() const { return reinterpret_cast<void *>(node()); }