From d19f4319dcc66706ad7a57a2b724b99ab663466d Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Fri, 29 Nov 2024 11:52:57 +0100 Subject: [PATCH] Try to reduce the use of CoordCache::insets().dim() The debug code does not needed it. The code in Cursor is only used in mathed. --- src/Cursor.cpp | 2 ++ src/RowPainter.cpp | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Cursor.cpp b/src/Cursor.cpp index 6514a2b344..11c04691f9 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -2551,6 +2551,8 @@ void Cursor::checkBufferStructure() void Cursor::moveToClosestEdge(int const x, bool const edit) { if (Inset const * inset = nextInset()) { + // This is only used in mathed. + LATTEST(inset->asInsetMath()); // stay in front of insets for which we want to open the dialog // (e.g. InsetMathSpace). if (edit && (inset->hasSettings() || !inset->contextMenuName().empty())) diff --git a/src/RowPainter.cpp b/src/RowPainter.cpp index e84343a7aa..b6bf9a64ef 100644 --- a/src/RowPainter.cpp +++ b/src/RowPainter.cpp @@ -125,10 +125,9 @@ void RowPainter::paintInset(Row::Element const & e) const pi_.selected = pi_selected; #ifdef DEBUG_METRICS - Dimension const & dim = pi_.base.bv->coordCache().insets().dim(e.inset); - int const x2 = x1 + dim.wid; - int const y1 = yo_ + dim.des; - int const y2 = yo_ - dim.asc; + int const x2 = x1 + e.dim.wid; + int const y1 = yo_ + e.dim.des; + int const y2 = yo_ - e.dim.asc; pi_.pain.line(x1, y1, x1, y2, Color_green); pi_.pain.line(x1, y1, x2, y1, Color_green); pi_.pain.line(x2, y1, x2, y2, Color_green);