From: Jean-Marc Lasgouttes Date: Sat, 18 Jul 2015 18:37:53 +0000 (+0200) Subject: Rewrite RowPainter::paintOnlyInsets to use row elements X-Git-Tag: 2.2.0alpha1~408^2~4 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=038f003be671995e7c60b2be884c7799303ca840;p=features.git Rewrite RowPainter::paintOnlyInsets to use row elements --- 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();