From 038f003be671995e7c60b2be884c7799303ca840 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Sat, 18 Jul 2015 20:37:53 +0200 Subject: [PATCH] Rewrite RowPainter::paintOnlyInsets to use row elements --- src/RowPainter.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/RowPainter.cpp b/src/RowPainter.cpp index 946901280a..1c74107296 100644 --- a/src/RowPainter.cpp +++ b/src/RowPainter.cpp @@ -606,27 +606,27 @@ void RowPainter::paintLast() void RowPainter::paintOnlyInsets() { - CoordCache const & cache = pi_.base.bv->coordCache(); - pos_type const end = row_.endpos(); - for (pos_type pos = row_.pos(); pos != end; ++pos) { - // If outer row has changed, nested insets are repaint completely. - Inset const * inset = par_.getInset(pos); - bool const nested_inset = inset && - ((inset->asInsetMath() && - !inset->asInsetMath()->asMacroTemplate()) - || inset->asInsetText() - || inset->asInsetTabular()); - if (!nested_inset) - continue; - if (x_ > pi_.base.bv->workWidth() - || !cache.getInsets().has(inset)) - continue; - x_ = cache.getInsets().x(inset); - Font const font = text_metrics_.displayFont(pit_, pos); - paintInset(inset, font, par_.lookupChange(pos), pos); + Row::const_iterator cit = row_.begin(); + Row::const_iterator const & end = row_.end(); + for ( ; cit != end ; ++cit) { + Row::Element const & e = *cit; + if (e.type == Row::INSET) { + // If outer row has changed, nested insets are repainted completely. + pi_.base.bv->coordCache().insets().add(e.inset, int(x_), yo_); + bool const nested_inset = + (e.inset->asInsetMath() && !e.inset->asInsetMath()->asMacroTemplate()) + || e.inset->asInsetText() || e.inset->asInsetTabular(); + if (!nested_inset) { + x_ += e.full_width(); + continue; + } + paintInset(e.inset, e.font, e.change, e.pos); + } else + x_ += e.full_width(); } } + void RowPainter::paintText() { Row::const_iterator cit = row_.begin(); -- 2.39.2