mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 13:31:49 +00:00
Reduce the number of accesses to coord cache when drawing a math row
Each of these accesses is somewhat costly when using large branches with lots of maths Related to bug #12297.
This commit is contained in:
parent
e09158efee
commit
e5bb491e2e
@ -80,6 +80,12 @@ public:
|
|||||||
data_[thing].dim = dim;
|
data_[thing].dim = dim;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Geometry & geometry(T const * thing)
|
||||||
|
{
|
||||||
|
check(thing, "geometry");
|
||||||
|
return data_.find(thing)->second;
|
||||||
|
}
|
||||||
|
|
||||||
Geometry const & geometry(T const * thing) const
|
Geometry const & geometry(T const * thing) const
|
||||||
{
|
{
|
||||||
check(thing, "geometry");
|
check(thing, "geometry");
|
||||||
|
@ -322,18 +322,16 @@ void MathRow::draw(PainterInfo & pi, int x, int const y) const
|
|||||||
// This is hackish: the math inset does not know that space
|
// This is hackish: the math inset does not know that space
|
||||||
// has been added before and after it; we alter its dimension
|
// has been added before and after it; we alter its dimension
|
||||||
// while it is drawing, because it relies on this value.
|
// while it is drawing, because it relies on this value.
|
||||||
Dimension const d = coords.insets().dim(e.inset);
|
Geometry & g = coords.insets().geometry(e.inset);
|
||||||
Dimension d2 = d;
|
g.dim.wid -= e.before + e.after;
|
||||||
d2.wid -= e.before + e.after;
|
|
||||||
coords.insets().add(e.inset, d2);
|
|
||||||
if (pi.pain.develMode() && !e.inset->isBufferValid())
|
if (pi.pain.develMode() && !e.inset->isBufferValid())
|
||||||
pi.pain.fillRectangle(x + e.before, y - d2.ascent(),
|
pi.pain.fillRectangle(x + e.before, y - g.dim.ascent(),
|
||||||
d2.width(), d2.height(), Color_error);
|
g.dim.width(), g.dim.height(), Color_error);
|
||||||
e.inset->draw(pi, x + e.before, y);
|
e.inset->draw(pi, x + e.before, y);
|
||||||
coords.insets().add(e.inset, x, y);
|
g.pos = {x, y};
|
||||||
coords.insets().add(e.inset, d);
|
g.dim.wid += e.before + e.after;
|
||||||
drawMarkers(pi, e, x, y);
|
drawMarkers(pi, e, x, y);
|
||||||
x += d.wid;
|
x += g.dim.wid;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case BEGIN:
|
case BEGIN:
|
||||||
|
Loading…
Reference in New Issue
Block a user