aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/Platform.h2
-rw-r--r--src/CallTip.cxx13
-rw-r--r--src/Editor.cxx6
-rw-r--r--src/LineMarker.cxx10
4 files changed, 17 insertions, 14 deletions
diff --git a/include/Platform.h b/include/Platform.h
index e28fa2976..138eb8a75 100644
--- a/include/Platform.h
+++ b/include/Platform.h
@@ -103,6 +103,8 @@ public:
explicit Point(XYPOSITION x_=0, XYPOSITION y_=0) : x(x_), y(y_) {
}
+ explicit Point(int x_, int y_) : x(static_cast<XYPOSITION>(x_)), y(static_cast<XYPOSITION>(y_)) {
+ }
// Other automatically defined methods (assignment, copy constructor, destructor) are fine
diff --git a/src/CallTip.cxx b/src/CallTip.cxx
index 7dc23a4ac..2494313bc 100644
--- a/src/CallTip.cxx
+++ b/src/CallTip.cxx
@@ -114,6 +114,7 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
rcClient.right = rcClient.left + widthArrow;
if (draw) {
const int halfWidth = widthArrow / 2 - 3;
+ const int quarterWidth = halfWidth / 2;
const int centreX = rcClient.left + widthArrow / 2 - 1;
const int centreY = (rcClient.top + rcClient.bottom) / 2;
surface->FillRectangle(rcClient, colourBG);
@@ -123,16 +124,16 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
if (upArrow) { // Up arrow
Point pts[] = {
- Point(centreX - halfWidth, centreY + halfWidth / 2),
- Point(centreX + halfWidth, centreY + halfWidth / 2),
- Point(centreX, centreY - halfWidth + halfWidth / 2),
+ Point(centreX - halfWidth, centreY + quarterWidth),
+ Point(centreX + halfWidth, centreY + quarterWidth),
+ Point(centreX, centreY - halfWidth + quarterWidth),
};
surface->Polygon(pts, ELEMENTS(pts), colourBG, colourBG);
} else { // Down arrow
Point pts[] = {
- Point(centreX - halfWidth, centreY - halfWidth / 2),
- Point(centreX + halfWidth, centreY - halfWidth / 2),
- Point(centreX, centreY + halfWidth - halfWidth / 2),
+ Point(centreX - halfWidth, centreY - quarterWidth),
+ Point(centreX + halfWidth, centreY - quarterWidth),
+ Point(centreX, centreY + halfWidth - quarterWidth),
};
surface->Polygon(pts, ELEMENTS(pts), colourBG, colourBG);
}
diff --git a/src/Editor.cxx b/src/Editor.cxx
index aefca0a85..e96588023 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -1163,13 +1163,13 @@ void Editor::MoveCaretInsideView(bool ensureVisible) {
Point pt = PointMainCaret();
if (pt.y < rcClient.top) {
MovePositionTo(SPositionFromLocation(
- Point(lastXChosen - xOffset, rcClient.top),
+ Point(lastXChosen - xOffset, static_cast<int>(rcClient.top)),
false, false, UserVirtualSpace()),
Selection::noSel, ensureVisible);
} else if ((pt.y + vs.lineHeight - 1) > rcClient.bottom) {
int yOfLastLineFullyDisplayed = rcClient.top + (LinesOnScreen() - 1) * vs.lineHeight;
MovePositionTo(SPositionFromLocation(
- Point(lastXChosen - xOffset, rcClient.top + yOfLastLineFullyDisplayed),
+ Point(lastXChosen - xOffset, static_cast<int>(rcClient.top) + yOfLastLineFullyDisplayed),
false, false, UserVirtualSpace()),
Selection::noSel, ensureVisible);
}
@@ -5024,7 +5024,7 @@ void Editor::PageMove(int direction, Selection::selTypes selt, bool stuttered) {
topLineNew = Platform::Clamp(
topLine + direction * LinesToScroll(), 0, MaxScrollPos());
newPos = SPositionFromLocation(
- Point(lastXChosen - xOffset, pt.y + direction * (vs.lineHeight * LinesToScroll())),
+ Point(lastXChosen - xOffset, static_cast<int>(pt.y) + direction * (vs.lineHeight * LinesToScroll())),
false, false, UserVirtualSpace());
}
diff --git a/src/LineMarker.cxx b/src/LineMarker.cxx
index 708e6a320..dec359a91 100644
--- a/src/LineMarker.cxx
+++ b/src/LineMarker.cxx
@@ -380,11 +380,11 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
} else if (markType == SC_MARK_BOOKMARK) {
int halfHeight = minDim / 3;
Point pts[] = {
- Point(rc.left, centreY-halfHeight),
- Point(rc.right-3, centreY-halfHeight),
- Point(rc.right-3-halfHeight, centreY),
- Point(rc.right-3, centreY+halfHeight),
- Point(rc.left, centreY+halfHeight),
+ Point(static_cast<int>(rc.left), centreY-halfHeight),
+ Point(static_cast<int>(rc.right) - 3, centreY - halfHeight),
+ Point(static_cast<int>(rc.right) - 3 - halfHeight, centreY),
+ Point(static_cast<int>(rc.right) - 3, centreY + halfHeight),
+ Point(static_cast<int>(rc.left), centreY + halfHeight),
};
surface->Polygon(pts, ELEMENTS(pts), fore, back);
} else { // SC_MARK_FULLRECT