X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Frowpainter.cpp;h=e3dfefba8f9acd60db54af12817cf2100183e8f5;hb=8524ee93c35ed3ca15a0aaafa7b893f2f7d21f47;hp=a949f4d4df2a9c53051787eaaf0f9eecd1b7335f;hpb=6daaf5388b35e88e85cd4c6d531514e764f1edc4;p=lyx.git diff --git a/src/rowpainter.cpp b/src/rowpainter.cpp index a949f4d4df..e3dfefba8f 100644 --- a/src/rowpainter.cpp +++ b/src/rowpainter.cpp @@ -67,7 +67,7 @@ class RowPainter { public: /// initialise and run painter RowPainter(PainterInfo & pi, Text const & text, - pit_type pit, Row const & row, int x, int y); + pit_type pit, Row const & row, Bidi & bidi, int x, int y); // paint various parts void paintAppendix(); @@ -114,9 +114,10 @@ private: ParagraphMetrics const & pm_; int max_width_; - /// bidi cache, static to speed up rowpaint and reduce size. - /// Only one rowpainter is used at a time anyway - static Bidi bidi_; + /// bidi cache, comes from outside the rowpainter because + /// rowpainters are normally created in a for loop and there only + /// one of them is active at a time. + Bidi & bidi_; /// is row erased? (change tracking) bool erased_; @@ -132,18 +133,15 @@ private: }; -Bidi RowPainter::bidi_; - - RowPainter::RowPainter(PainterInfo & pi, - Text const & text, pit_type pit, Row const & row, int x, int y) + Text const & text, pit_type pit, Row const & row, Bidi & bidi, int x, int y) : bv_(*pi.base.bv), pain_(pi.pain), text_(text), text_metrics_(pi.base.bv->textMetrics(&text)), pars_(text.paragraphs()), row_(row), pit_(pit), par_(text.paragraphs()[pit]), pm_(text_metrics_.parMetrics(pit)), max_width_(bv_.workWidth()), - erased_(pi.erased_), + bidi_(bidi), erased_(pi.erased_), xo_(x), yo_(y), width_(text_metrics_.width()) { RowMetrics m = text_metrics_.computeRowMetrics(pit_, row_); @@ -431,7 +429,8 @@ void RowPainter::paintFromPos(pos_type & vpos) // special case languages std::string const & lang = orig_font.language()->lang(); bool const hebrew = lang == "hebrew"; - bool const arabic = lang == "arabic" || lang == "farsi"; + bool const arabic = lang == "arabic_arabtex" || lang == "arabic_arabi" || + lang == "farsi"; // draw as many chars as we can if ((!hebrew && !arabic) @@ -931,6 +930,8 @@ void paintPar RowList::const_iterator const rb = pm.rows().begin(); RowList::const_iterator const re = pm.rows().end(); + Bidi bidi; + y -= rb->ascent(); size_type rowno = 0; for (RowList::const_iterator rit = rb; rit != re; ++rit, ++rowno) { @@ -977,7 +978,7 @@ void paintPar && y - rit->ascent() < ww); // it is not needed to draw on screen if we are not inside. pi.pain.setDrawingEnabled(inside); - RowPainter rp(pi, text, pit, *rit, x, y); + RowPainter rp(pi, text, pit, *rit, bidi, x, y); // Clear background of this row // (if paragraph background was not cleared) if (!repaintAll && @@ -1061,12 +1062,12 @@ void paintText(BufferView & bv, // and grey out above (should not happen later) // lyxerr << "par ascent: " << text.getPar(vi.p1).ascent() << endl; - if (vi.y1 > 0 && vi.update_strategy != SingleParUpdate) + if (vi.y1 > 0 && vi.update_strategy == FullScreenUpdate) pain.fillRectangle(0, 0, bv.workWidth(), vi.y1, Color::bottomarea); // and possibly grey out below // lyxerr << "par descent: " << text.getPar(vi.p1).ascent() << endl; - if (vi.y2 < bv.workHeight() && vi.update_strategy != SingleParUpdate) + if (vi.y2 < bv.workHeight() && vi.update_strategy == FullScreenUpdate) pain.fillRectangle(0, vi.y2, bv.workWidth(), bv.workHeight() - vi.y2, Color::bottomarea); }