commit 051b6ce68af2b7b075e1abb89e1e960beae71379
Author: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date:   Mon Feb 4 12:13:01 2019 +0100

    Do not rely on x_ when painting label
    
    Additionally fixes a warning about unused value (from clang-analyzer).
---
 src/RowPainter.cpp  |   10 +++-------
 src/TextMetrics.cpp |    8 ++------
 2 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/src/RowPainter.cpp b/src/RowPainter.cpp
index e547888..9534b20 100644
--- a/src/RowPainter.cpp
+++ b/src/RowPainter.cpp
@@ -429,14 +429,10 @@ void RowPainter::paintLabel() const
        Layout const & layout = par_.layout();
        FontInfo const font = labelFont(false);
        FontMetrics const & fm = theFontMetrics(font);
-       double x = x_;
-
-       if (row_.isRTL())
-               x = xo_ + row_.width() + fm.width(layout.labelsep);
-       else
-               x = x_ - fm.width(layout.labelsep) - fm.width(str);
+       int const x = row_.isRTL() ? row_.width() + fm.width(layout.labelsep)
+                                  : row_.left_margin - 
fm.width(layout.labelsep) - fm.width(str);
 
-       pi_.pain.text(int(x), yo_, str, font);
+       pi_.pain.text(xo_ + x, yo_, str, font);
 }
 
 
diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp
index 094b80d..edc9f69 100644
--- a/src/TextMetrics.cpp
+++ b/src/TextMetrics.cpp
@@ -1934,15 +1934,11 @@ void TextMetrics::drawParagraph(PainterInfo & pi, 
pit_type const pit, int const
                rp.paintDepthBar();
                if (row.needsChangeBar())
                        rp.paintChangeBar();
-               if (i == 0 && !row.isRTL())
+               if (i == 0)
                        rp.paintFirst();
-               if (i == nrows - 1 && row.isRTL())
+               if (i == nrows - 1)
                        rp.paintLast();
                rp.paintText();
-               if (i == nrows - 1 && !row.isRTL())
-                       rp.paintLast();
-               if (i == 0 && row.isRTL())
-                       rp.paintFirst();
                rp.paintTooLargeMarks(row_x + row.left_x() < 0,
                                      row_x + row.right_x() > bv_->workWidth());
                y += row.descent();

Reply via email to