Use iround function, amend c0ce79452f

This commit is contained in:
Yuriy Skalko 2020-11-26 22:10:45 +02:00
parent 8cb728c2d7
commit 59e2becdd8
3 changed files with 8 additions and 5 deletions

View File

@ -26,6 +26,7 @@
#include "support/debug.h"
#include "support/lassert.h"
#include "support/lstrings.h"
#include "support/lyxlib.h"
#include <algorithm>
#include <ostream>
@ -297,7 +298,7 @@ int Row::left_x() const
x += cit->full_width();
++cit;
}
return int(x + 0.5);
return support::iround(x);
}
@ -313,7 +314,7 @@ int Row::right_x() const
else
break;
}
return int(x + 0.5);
return support::iround(x);
}

View File

@ -12,8 +12,9 @@
#include <config.h>
#include "Spacing.h"
#include "support/lstrings.h"
#include "support/convert.h"
#include "support/lstrings.h"
#include "support/lyxlib.h"
#include <ostream>
@ -55,7 +56,7 @@ void Spacing::set(Spacing::Space sp, string const & val)
{
space = sp;
if (sp == Other) {
switch (int(convert<double>(val) * 1000 + 0.5)) {
switch (support::iround(convert<double>(val) * 1000)) {
case 1000:
space = Single;
break;

View File

@ -19,6 +19,7 @@
#include "PreviewLoader.h"
#include "support/FileName.h"
#include "support/lyxlib.h"
using namespace std;
@ -85,7 +86,7 @@ Dimension PreviewImage::dim() const
if (!image)
return dim;
dim.asc = int(pimpl_->ascent_frac_ * double(image->height()) + 0.5);
dim.asc = support::iround(pimpl_->ascent_frac_ * double(image->height()));
dim.des = image->height() - dim.asc;
dim.wid = image->width();
return dim;