mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Squash warnings reported by gcc 4.9
Most of these are just about conversion from double to int. Of note also the replacement of an horrible reinterpret_cast by a proper solution.
This commit is contained in:
parent
51b28ba1d8
commit
3830ce46db
@ -105,10 +105,9 @@ size_t ParagraphMetrics::computeRowSignature(Row const & row,
|
|||||||
static_cast<char_type>(row.sel_end),
|
static_cast<char_type>(row.sel_end),
|
||||||
row.begin_margin_sel,
|
row.begin_margin_sel,
|
||||||
row.end_margin_sel,
|
row.end_margin_sel,
|
||||||
reinterpret_cast<char_type const *>(&row.separator)[0],
|
|
||||||
reinterpret_cast<char_type const *>(&row.separator)[1],
|
|
||||||
d.wid, d.asc, d.des };
|
d.wid, d.asc, d.des };
|
||||||
crc.process_bytes(b, sizeof(b));
|
crc.process_bytes(b, sizeof(b));
|
||||||
|
crc.process_bytes(&row.separator, sizeof(row.separator));
|
||||||
|
|
||||||
return crc.checksum();
|
return crc.checksum();
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@ void CCItemDelegate::drawCategoryHeader(QPainter * painter, QStyleOptionViewItem
|
|||||||
QFontMetrics fm(font);
|
QFontMetrics fm(font);
|
||||||
int w = fm.width(category);
|
int w = fm.width(category);
|
||||||
int x = opt.rect.x() + (opt.rect.width() - w) / 2;
|
int x = opt.rect.x() + (opt.rect.width() - w) / 2;
|
||||||
int y = opt.rect.y() + 1.5 * fm.ascent();
|
int y = opt.rect.y() + 3 * fm.ascent() / 2;
|
||||||
int left = x;
|
int left = x;
|
||||||
int right = x + w;
|
int right = x + w;
|
||||||
painter->drawText(x, y, category);
|
painter->drawText(x, y, category);
|
||||||
|
@ -162,7 +162,7 @@ int GuiFontMetrics::pos2x(docstring const & s, int const pos, bool const rtl) co
|
|||||||
{
|
{
|
||||||
QTextLayout tl;
|
QTextLayout tl;
|
||||||
setTextLayout(tl, s, font_, rtl);
|
setTextLayout(tl, s, font_, rtl);
|
||||||
return tl.lineForTextPosition(pos).cursorToX(pos);
|
return static_cast<int>(tl.lineForTextPosition(pos).cursorToX(pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ int GuiFontMetrics::x2pos(docstring const & s, int & x, bool const rtl) const
|
|||||||
setTextLayout(tl, s, font_, rtl);
|
setTextLayout(tl, s, font_, rtl);
|
||||||
int pos = tl.lineForTextPosition(0).xToCursor(x);
|
int pos = tl.lineForTextPosition(0).xToCursor(x);
|
||||||
// correct x value to the actual cursor position.
|
// correct x value to the actual cursor position.
|
||||||
x = tl.lineForTextPosition(0).cursorToX(pos);
|
x = static_cast<int>(tl.lineForTextPosition(0).cursorToX(pos));
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -380,7 +380,8 @@ int GuiPainter::text(int x, int y, docstring const & s,
|
|||||||
int const mD = fm.maxDescent();
|
int const mD = fm.maxDescent();
|
||||||
int const h = mA + mD;
|
int const h = mA + mD;
|
||||||
if (w > 0 && h > 0) {
|
if (w > 0 && h > 0) {
|
||||||
pm = QPixmap(pixelRatio() * w , pixelRatio() * h);
|
pm = QPixmap(static_cast<int>(pixelRatio() * w),
|
||||||
|
static_cast<int>(pixelRatio() * h));
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
pm.setDevicePixelRatio(pixelRatio());
|
pm.setDevicePixelRatio(pixelRatio());
|
||||||
#endif
|
#endif
|
||||||
|
@ -162,9 +162,9 @@ public:
|
|||||||
QPainter pain(&splash_);
|
QPainter pain(&splash_);
|
||||||
pain.setPen(QColor(0, 0, 0));
|
pain.setPen(QColor(0, 0, 0));
|
||||||
double const multiplier = splashPixelRatio() / pixelRatio();
|
double const multiplier = splashPixelRatio() / pixelRatio();
|
||||||
int const size = toqstr(lyxrc.font_sizes[FONT_SIZE_LARGE]).toDouble() * multiplier;
|
int const size = static_cast<int>(toqstr(lyxrc.font_sizes[FONT_SIZE_LARGE]).toDouble() * multiplier);
|
||||||
int const x = 190 * multiplier;
|
int const x = static_cast<int>(190 * multiplier);
|
||||||
int const y = 225 * multiplier;
|
int const y = static_cast<int>(225 * multiplier);
|
||||||
LYXERR(Debug::GUI,
|
LYXERR(Debug::GUI,
|
||||||
"widget pixel ratio: " << pixelRatio() <<
|
"widget pixel ratio: " << pixelRatio() <<
|
||||||
" splash pixel ratio: " << splashPixelRatio() <<
|
" splash pixel ratio: " << splashPixelRatio() <<
|
||||||
@ -181,8 +181,8 @@ public:
|
|||||||
|
|
||||||
void paintEvent(QPaintEvent *)
|
void paintEvent(QPaintEvent *)
|
||||||
{
|
{
|
||||||
int const w = splash_.width() / splashPixelRatio();
|
int const w = static_cast<int>(splash_.width() / splashPixelRatio());
|
||||||
int const h = splash_.height() / splashPixelRatio();
|
int const h = static_cast<int>(splash_.height() / splashPixelRatio());
|
||||||
int const x = (width() - w) / 2;
|
int const x = (width() - w) / 2;
|
||||||
int const y = (height() - h) / 2;
|
int const y = (height() - h) / 2;
|
||||||
LYXERR(Debug::GUI,
|
LYXERR(Debug::GUI,
|
||||||
|
@ -126,15 +126,18 @@ struct GuiWorkArea::Private
|
|||||||
delete screen_;
|
delete screen_;
|
||||||
pixel_ratio_ = p->pixelRatio();
|
pixel_ratio_ = p->pixelRatio();
|
||||||
if (lyxrc.use_qimage) {
|
if (lyxrc.use_qimage) {
|
||||||
QImage *x = new QImage(pixel_ratio_ * p->viewport()->width(),
|
QImage *x =
|
||||||
pixel_ratio_ * p->viewport()->height(), QImage::Format_ARGB32_Premultiplied);
|
new QImage(static_cast<int>(pixel_ratio_ * p->viewport()->width()),
|
||||||
|
static_cast<int>(pixel_ratio_ * p->viewport()->height()),
|
||||||
|
QImage::Format_ARGB32_Premultiplied);
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
x->setDevicePixelRatio(pixel_ratio_);
|
x->setDevicePixelRatio(pixel_ratio_);
|
||||||
#endif
|
#endif
|
||||||
screen_ = x;
|
screen_ = x;
|
||||||
} else {
|
} else {
|
||||||
QPixmap *x = new QPixmap(pixel_ratio_ * p->viewport()->width(),
|
QPixmap *x =
|
||||||
pixel_ratio_ * p->viewport()->height());
|
new QPixmap(static_cast<int>(pixel_ratio_ * p->viewport()->width()),
|
||||||
|
static_cast<int>(pixel_ratio_ * p->viewport()->height()));
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
x->setDevicePixelRatio(pixel_ratio_);
|
x->setDevicePixelRatio(pixel_ratio_);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user