X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fview%2Fruler.cpp;h=9e639383942ed1149702f9e369b16452a46eba1f;hp=eb658e484bb4af8ec9f522a34869731144005230;hb=64b678ba0bf16e3a3c1aceffef170f3dbcc588d3;hpb=5045f16d20921a6befc0c367a77a1cb838d9278e diff --git a/pv/view/ruler.cpp b/pv/view/ruler.cpp index eb658e48..9e639383 100644 --- a/pv/view/ruler.cpp +++ b/pv/view/ruler.cpp @@ -130,19 +130,17 @@ void Ruler::paintEvent(QPaintEvent*) const double t0 = first_major_division * tick_period; int division = (int)round(first_minor_division - - first_major_division * MinorTickSubdivision); + first_major_division * MinorTickSubdivision) - 1; const int major_tick_y1 = text_height + ValueMargin * 2; const int tick_y2 = height(); const int minor_tick_y1 = (major_tick_y1 + tick_y2) / 2; - while (1) - { - const double t = t0 + division * minor_tick_period; - const double x = (t - _view.offset()) / _view.scale(); + double x; - if (x >= width()) - break; + do { + const double t = t0 + division * minor_tick_period; + x = (t - _view.offset()) / _view.scale(); if (division % MinorTickSubdivision == 0) { @@ -161,7 +159,8 @@ void Ruler::paintEvent(QPaintEvent*) } division++; - } + + } while (x < width()); // Draw the cursors draw_cursors(p, prefix);