Fix implicit type conversions in EditSelection

upstream-master
Bryan Tan 5 years ago committed by Bryan Tan
parent e13cfbc3ca
commit 18e18ddeb1
  1. 10
      src/control/tools/EditSelection.cpp
  2. 2
      src/control/tools/EditSelection.h

@ -248,7 +248,7 @@ auto EditSelection::getSourceLayer() -> Layer* { return this->sourceLayer; }
*/
auto EditSelection::getXOnViewAbsolute() -> int {
double zoom = view->getXournal()->getZoom();
return this->view->getX() + this->getXOnView() * zoom;
return this->view->getX() + static_cast<int>(this->getXOnView() * zoom);
}
/**
@ -256,7 +256,7 @@ auto EditSelection::getXOnViewAbsolute() -> int {
*/
auto EditSelection::getYOnViewAbsolute() -> int {
double zoom = view->getXournal()->getZoom();
return this->view->getY() + this->getYOnView() * zoom;
return this->view->getY() + static_cast<int>(this->getYOnView() * zoom);
}
/**
@ -561,7 +561,7 @@ void EditSelection::mouseMove(double mouseX, double mouseY, bool alt) {
if (v && v != this->view) {
XournalView* xournal = this->view->getXournal();
auto pageNr = xournal->getControl()->getDocument()->indexOf(v->getPage());
const auto pageNr = xournal->getControl()->getDocument()->indexOf(v->getPage());
xournal->pageSelected(pageNr);
@ -609,7 +609,7 @@ auto EditSelection::getPageViewUnderCursor() -> XojPageView* {
Layout* layout = gtk_xournal_get_layout(this->view->getXournal()->getWidget());
XojPageView* v = layout->getPageViewAt(hx, hy);
XojPageView* v = layout->getPageViewAt(static_cast<int>(hx), static_cast<int>(hy));
return v;
}
@ -941,7 +941,7 @@ void EditSelection::serialize(ObjectOutputStream& out) {
this->contents->serialize(out);
out.endObject();
out.writeInt(this->getElements()->size());
out.writeInt(static_cast<int>(this->getElements()->size()));
for (Element* e: *this->getElements()) { e->serialize(out); }
}

@ -314,7 +314,7 @@ private: // DATA
/**
* Mouse coordinates for moving / resizing
*/
CursorSelectionType mouseDownType;
CursorSelectionType mouseDownType = CURSOR_SELECTION_NONE;
double relMousePosX{};
double relMousePosY{};
double relMousePosRotX{};

Loading…
Cancel
Save