From 4098bee4df45d3208aaced3f39acc3b2a92977d2 Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 3 May 2014 12:53:13 +1000 Subject: Convenience Point constructor from integers as common source of shapes. --- src/CallTip.cxx | 13 +++++++------ src/Editor.cxx | 6 +++--- src/LineMarker.cxx | 10 +++++----- 3 files changed, 15 insertions(+), 14 deletions(-) (limited to 'src') 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(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(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(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(rc.left), centreY-halfHeight), + Point(static_cast(rc.right) - 3, centreY - halfHeight), + Point(static_cast(rc.right) - 3 - halfHeight, centreY), + Point(static_cast(rc.right) - 3, centreY + halfHeight), + Point(static_cast(rc.left), centreY + halfHeight), }; surface->Polygon(pts, ELEMENTS(pts), fore, back); } else { // SC_MARK_FULLRECT -- cgit v1.2.3