diff options
author | Neil <nyamatongwe@gmail.com> | 2014-05-03 20:21:13 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2014-05-03 20:21:13 +1000 |
commit | ce6e4b52401b29e0f34888250b8c8cbb5821bc4d (patch) | |
tree | 0a82dc31e155cc9fd6fed6dbd3e23301fd4948a8 /src | |
parent | 541c8d5574236af65f614289d03db2eb74762c56 (diff) | |
download | scintilla-mirror-ce6e4b52401b29e0f34888250b8c8cbb5821bc4d.tar.gz |
Replacing the int-based constructors for Point and PRectangle with FromInts
static methods as there were too many failures with mixed types and not-quite
matching types.
Diffstat (limited to 'src')
-rw-r--r-- | src/CallTip.cxx | 12 | ||||
-rw-r--r-- | src/Editor.cxx | 40 | ||||
-rw-r--r-- | src/Indicator.cxx | 4 | ||||
-rw-r--r-- | src/LineMarker.cxx | 82 | ||||
-rw-r--r-- | src/XPM.cxx | 2 |
5 files changed, 70 insertions, 70 deletions
diff --git a/src/CallTip.cxx b/src/CallTip.cxx index c1a3582f3..f6f3f10ea 100644 --- a/src/CallTip.cxx +++ b/src/CallTip.cxx @@ -125,16 +125,16 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s, if (upArrow) { // Up arrow Point pts[] = { - Point(centreX - halfWidth, centreY + quarterWidth), - Point(centreX + halfWidth, centreY + quarterWidth), - Point(centreX, centreY - halfWidth + quarterWidth), + Point::FromInts(centreX - halfWidth, centreY + quarterWidth), + Point::FromInts(centreX + halfWidth, centreY + quarterWidth), + Point::FromInts(centreX, centreY - halfWidth + quarterWidth), }; surface->Polygon(pts, ELEMENTS(pts), colourBG, colourBG); } else { // Down arrow Point pts[] = { - Point(centreX - halfWidth, centreY - quarterWidth), - Point(centreX + halfWidth, centreY - quarterWidth), - Point(centreX, centreY + halfWidth - quarterWidth), + Point::FromInts(centreX - halfWidth, centreY - quarterWidth), + Point::FromInts(centreX + halfWidth, centreY - quarterWidth), + Point::FromInts(centreX, centreY + halfWidth - quarterWidth), }; surface->Polygon(pts, ELEMENTS(pts), colourBG, colourBG); } diff --git a/src/Editor.cxx b/src/Editor.cxx index 1e1d7bf07..f1e019b07 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -1164,13 +1164,13 @@ void Editor::MoveCaretInsideView(bool ensureVisible) { Point pt = PointMainCaret(); if (pt.y < rcClient.top) { MovePositionTo(SPositionFromLocation( - Point(lastXChosen - xOffset, static_cast<int>(rcClient.top)), + Point::FromInts(lastXChosen - xOffset, static_cast<int>(rcClient.top)), false, false, UserVirtualSpace()), Selection::noSel, ensureVisible); } else if ((pt.y + vs.lineHeight - 1) > rcClient.bottom) { int yOfLastLineFullyDisplayed = static_cast<int>(rcClient.top) + (LinesOnScreen() - 1) * vs.lineHeight; MovePositionTo(SPositionFromLocation( - Point(lastXChosen - xOffset, static_cast<int>(rcClient.top) + yOfLastLineFullyDisplayed), + Point::FromInts(lastXChosen - xOffset, static_cast<int>(rcClient.top) + yOfLastLineFullyDisplayed), false, false, UserVirtualSpace()), Selection::noSel, ensureVisible); } @@ -2423,8 +2423,8 @@ ColourDesired Editor::TextBackground(ViewStyle &vsDraw, bool overrideBackground, } void Editor::DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, int start, PRectangle rcSegment, bool highlight) { - Point from(0, ((lineVisible & 1) && (lineHeight & 1)) ? 1 : 0); - PRectangle rcCopyArea(start + 1, static_cast<int>(rcSegment.top), start + 2, static_cast<int>(rcSegment.bottom)); + Point from = Point::FromInts(0, ((lineVisible & 1) && (lineHeight & 1)) ? 1 : 0); + PRectangle rcCopyArea = PRectangle::FromInts(start + 1, static_cast<int>(rcSegment.top), start + 2, static_cast<int>(rcSegment.bottom)); surface->Copy(rcCopyArea, from, highlight ? *pixmapIndentGuideHighlight : *pixmapIndentGuide); } @@ -3364,7 +3364,7 @@ void Editor::RefreshPixMaps(Surface *surfaceWindow) { // for scroll bars and Visual Studio for its selection margin. The colour of this pattern is half // way between the chrome colour and the chrome highlight colour making a nice transition // between the window chrome and the content area. And it works in low colour depths. - PRectangle rcPattern(0, 0, patternSize, patternSize); + PRectangle rcPattern = PRectangle::FromInts(0, 0, patternSize, patternSize); // Initialize default colours based on the chrome colour scheme. Typically the highlight is white. ColourDesired colourFMFill = vs.selbar; @@ -3389,7 +3389,7 @@ void Editor::RefreshPixMaps(Surface *surfaceWindow) { pixmapSelPatternOffset1->FillRectangle(rcPattern, colourFMStripes); for (int y = 0; y < patternSize; y++) { for (int x = y % 2; x < patternSize; x+=2) { - PRectangle rcPixel(x, y, x+1, y+1); + PRectangle rcPixel = PRectangle::FromInts(x, y, x + 1, y + 1); pixmapSelPattern->FillRectangle(rcPixel, colourFMStripes); pixmapSelPatternOffset1->FillRectangle(rcPixel, colourFMFill); } @@ -3400,13 +3400,13 @@ void Editor::RefreshPixMaps(Surface *surfaceWindow) { // 1 extra pixel in height so can handle odd/even positions and so produce a continuous line pixmapIndentGuide->InitPixMap(1, vs.lineHeight + 1, surfaceWindow, wMain.GetID()); pixmapIndentGuideHighlight->InitPixMap(1, vs.lineHeight + 1, surfaceWindow, wMain.GetID()); - PRectangle rcIG(0, 0, 1, vs.lineHeight); + PRectangle rcIG = PRectangle::FromInts(0, 0, 1, vs.lineHeight); pixmapIndentGuide->FillRectangle(rcIG, vs.styles[STYLE_INDENTGUIDE].back); pixmapIndentGuide->PenColour(vs.styles[STYLE_INDENTGUIDE].fore); pixmapIndentGuideHighlight->FillRectangle(rcIG, vs.styles[STYLE_BRACELIGHT].back); pixmapIndentGuideHighlight->PenColour(vs.styles[STYLE_BRACELIGHT].fore); for (int stripe = 1; stripe < vs.lineHeight + 1; stripe += 2) { - PRectangle rcPixel(0, stripe, 1, stripe+1); + PRectangle rcPixel = PRectangle::FromInts(0, stripe, 1, stripe + 1); pixmapIndentGuide->FillRectangle(rcPixel, vs.styles[STYLE_INDENTGUIDE].fore); pixmapIndentGuideHighlight->FillRectangle(rcPixel, vs.styles[STYLE_BRACELIGHT].fore); } @@ -3711,8 +3711,8 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { DrawCarets(surface, vs, lineDoc, xStart, rcLine, ll, subLine); if (bufferedDraw) { - Point from(vs.textStart-leftTextOverlap, 0); - PRectangle rcCopyArea(vs.textStart-leftTextOverlap, yposScreen, + Point from = Point::FromInts(vs.textStart-leftTextOverlap, 0); + PRectangle rcCopyArea = PRectangle::FromInts(vs.textStart - leftTextOverlap, yposScreen, static_cast<int>(rcClient.right - vs.rightMarginWidth), yposScreen + vs.lineHeight); surfaceWindow->Copy(rcCopyArea, from, *pixmapLine); @@ -3899,7 +3899,7 @@ long Editor::FormatRange(bool draw, Sci_RangeToFormat *pfr) { ll.containsCaret = false; - PRectangle rcLine( + PRectangle rcLine = PRectangle::FromInts( pfr->rc.left, ypos, pfr->rc.right - 1, @@ -5014,17 +5014,17 @@ void Editor::PageMove(int direction, Selection::selTypes selt, bool stuttered) { int topStutterLine = topLine + caretYSlop; int bottomStutterLine = pdoc->LineFromPosition(PositionFromLocation( - Point(lastXChosen - xOffset, direction * vs.lineHeight * LinesToScroll()))) + Point::FromInts(lastXChosen - xOffset, direction * vs.lineHeight * LinesToScroll()))) - caretYSlop - 1; if (stuttered && (direction < 0 && currentLine > topStutterLine)) { topLineNew = topLine; - newPos = SPositionFromLocation(Point(lastXChosen - xOffset, vs.lineHeight * caretYSlop), + newPos = SPositionFromLocation(Point::FromInts(lastXChosen - xOffset, vs.lineHeight * caretYSlop), false, false, UserVirtualSpace()); } else if (stuttered && (direction > 0 && currentLine < bottomStutterLine)) { topLineNew = topLine; - newPos = SPositionFromLocation(Point(lastXChosen - xOffset, vs.lineHeight * (LinesToScroll() - caretYSlop)), + newPos = SPositionFromLocation(Point::FromInts(lastXChosen - xOffset, vs.lineHeight * (LinesToScroll() - caretYSlop)), false, false, UserVirtualSpace()); } else { @@ -5033,7 +5033,7 @@ void Editor::PageMove(int direction, Selection::selTypes selt, bool stuttered) { topLineNew = Platform::Clamp( topLine + direction * LinesToScroll(), 0, MaxScrollPos()); newPos = SPositionFromLocation( - Point(lastXChosen - xOffset, static_cast<int>(pt.y) + direction * (vs.lineHeight * LinesToScroll())), + Point::FromInts(lastXChosen - xOffset, static_cast<int>(pt.y) + direction * (vs.lineHeight * LinesToScroll())), false, false, UserVirtualSpace()); } @@ -5232,7 +5232,7 @@ void Editor::CursorUpOrDown(int direction, Selection::selTypes selt) { int newY = static_cast<int>(pt.y) + (1 + skipLines) * direction * vs.lineHeight; SelectionPosition posNew = SPositionFromLocation( - Point(lastXChosen - xOffset, newY), false, false, UserVirtualSpace()); + Point::FromInts(lastXChosen - xOffset, newY), false, false, UserVirtualSpace()); if (direction < 0) { // Line wrapping may lead to a location on the same line, so @@ -8058,19 +8058,19 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { break; case SCI_POSITIONFROMPOINT: - return PositionFromLocation(Point(static_cast<int>(wParam) - vs.ExternalMarginWidth(), static_cast<int>(lParam)), + return PositionFromLocation(Point::FromInts(static_cast<int>(wParam) - vs.ExternalMarginWidth(), static_cast<int>(lParam)), false, false); case SCI_POSITIONFROMPOINTCLOSE: - return PositionFromLocation(Point(static_cast<int>(wParam) - vs.ExternalMarginWidth(), static_cast<int>(lParam)), + return PositionFromLocation(Point::FromInts(static_cast<int>(wParam) - vs.ExternalMarginWidth(), static_cast<int>(lParam)), true, false); case SCI_CHARPOSITIONFROMPOINT: - return PositionFromLocation(Point(static_cast<int>(wParam) - vs.ExternalMarginWidth(), static_cast<int>(lParam)), + return PositionFromLocation(Point::FromInts(static_cast<int>(wParam) - vs.ExternalMarginWidth(), static_cast<int>(lParam)), false, true); case SCI_CHARPOSITIONFROMPOINTCLOSE: - return PositionFromLocation(Point(static_cast<int>(wParam) - vs.ExternalMarginWidth(), static_cast<int>(lParam)), + return PositionFromLocation(Point::FromInts(static_cast<int>(wParam) - vs.ExternalMarginWidth(), static_cast<int>(lParam)), true, true); case SCI_GOTOLINE: diff --git a/src/Indicator.cxx b/src/Indicator.cxx index ba20dd941..63735d480 100644 --- a/src/Indicator.cxx +++ b/src/Indicator.cxx @@ -20,7 +20,7 @@ using namespace Scintilla; static PRectangle PixelGridAlign(const PRectangle &rc) { // Move left and right side to nearest pixel to avoid blurry visuals - return PRectangle(int(rc.left + 0.5), int(rc.top), int(rc.right + 0.5), int(rc.bottom)); + return PRectangle::FromInts(int(rc.left + 0.5), int(rc.top), int(rc.right + 0.5), int(rc.bottom)); } void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine) { @@ -148,7 +148,7 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r } else if (style == INDIC_DOTS) { int x = static_cast<int>(rc.left); while (x < static_cast<int>(rc.right)) { - PRectangle rcDot(x, ymid, x+1, ymid+1); + PRectangle rcDot = PRectangle::FromInts(x, ymid, x + 1, ymid + 1); surface->FillRectangle(rcDot, fore); x += 2; } diff --git a/src/LineMarker.cxx b/src/LineMarker.cxx index ced622b75..938288b1f 100644 --- a/src/LineMarker.cxx +++ b/src/LineMarker.cxx @@ -42,7 +42,7 @@ void LineMarker::SetRGBAImage(Point sizeRGBAImage, float scale, const unsigned c } static void DrawBox(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore, ColourDesired back) { - PRectangle rc( + PRectangle rc = PRectangle::FromInts( centreX - armSize, centreY - armSize, centreX + armSize + 1, @@ -51,7 +51,7 @@ static void DrawBox(Surface *surface, int centreX, int centreY, int armSize, Col } static void DrawCircle(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore, ColourDesired back) { - PRectangle rcCircle( + PRectangle rcCircle = PRectangle::FromInts( centreX - armSize, centreY - armSize, centreX + armSize + 1, @@ -60,14 +60,14 @@ static void DrawCircle(Surface *surface, int centreX, int centreY, int armSize, } static void DrawPlus(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore) { - PRectangle rcV(centreX, centreY - armSize + 2, centreX + 1, centreY + armSize - 2 + 1); + PRectangle rcV = PRectangle::FromInts(centreX, centreY - armSize + 2, centreX + 1, centreY + armSize - 2 + 1); surface->FillRectangle(rcV, fore); - PRectangle rcH(centreX - armSize + 2, centreY, centreX + armSize - 2 + 1, centreY+1); + PRectangle rcH = PRectangle::FromInts(centreX - armSize + 2, centreY, centreX + armSize - 2 + 1, centreY + 1); surface->FillRectangle(rcH, fore); } static void DrawMinus(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore) { - PRectangle rcH(centreX - armSize + 2, centreY, centreX + armSize - 2 + 1, centreY+1); + PRectangle rcH = PRectangle::FromInts(centreX - armSize + 2, centreY, centreX + armSize - 2 + 1, centreY + 1); surface->FillRectangle(rcH, fore); } @@ -131,7 +131,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac rcRounded.right = rc.right - 1; surface->RoundedRectangle(rcRounded, fore, back); } else if (markType == SC_MARK_CIRCLE) { - PRectangle rcCircle( + PRectangle rcCircle = PRectangle::FromInts( centreX - dimOn2, centreY - dimOn2, centreX + dimOn2, @@ -139,43 +139,43 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac surface->Ellipse(rcCircle, fore, back); } else if (markType == SC_MARK_ARROW) { Point pts[] = { - Point(centreX - dimOn4, centreY - dimOn2), - Point(centreX - dimOn4, centreY + dimOn2), - Point(centreX + dimOn2 - dimOn4, centreY), + Point::FromInts(centreX - dimOn4, centreY - dimOn2), + Point::FromInts(centreX - dimOn4, centreY + dimOn2), + Point::FromInts(centreX + dimOn2 - dimOn4, centreY), }; surface->Polygon(pts, ELEMENTS(pts), fore, back); } else if (markType == SC_MARK_ARROWDOWN) { Point pts[] = { - Point(centreX - dimOn2, centreY - dimOn4), - Point(centreX + dimOn2, centreY - dimOn4), - Point(centreX, centreY + dimOn2 - dimOn4), + Point::FromInts(centreX - dimOn2, centreY - dimOn4), + Point::FromInts(centreX + dimOn2, centreY - dimOn4), + Point::FromInts(centreX, centreY + dimOn2 - dimOn4), }; surface->Polygon(pts, ELEMENTS(pts), fore, back); } else if (markType == SC_MARK_PLUS) { Point pts[] = { - Point(centreX - armSize, centreY - 1), - Point(centreX - 1, centreY - 1), - Point(centreX - 1, centreY - armSize), - Point(centreX + 1, centreY - armSize), - Point(centreX + 1, centreY - 1), - Point(centreX + armSize, centreY -1), - Point(centreX + armSize, centreY +1), - Point(centreX + 1, centreY + 1), - Point(centreX + 1, centreY + armSize), - Point(centreX - 1, centreY + armSize), - Point(centreX - 1, centreY + 1), - Point(centreX - armSize, centreY + 1), + Point::FromInts(centreX - armSize, centreY - 1), + Point::FromInts(centreX - 1, centreY - 1), + Point::FromInts(centreX - 1, centreY - armSize), + Point::FromInts(centreX + 1, centreY - armSize), + Point::FromInts(centreX + 1, centreY - 1), + Point::FromInts(centreX + armSize, centreY -1), + Point::FromInts(centreX + armSize, centreY +1), + Point::FromInts(centreX + 1, centreY + 1), + Point::FromInts(centreX + 1, centreY + armSize), + Point::FromInts(centreX - 1, centreY + armSize), + Point::FromInts(centreX - 1, centreY + 1), + Point::FromInts(centreX - armSize, centreY + 1), }; surface->Polygon(pts, ELEMENTS(pts), fore, back); } else if (markType == SC_MARK_MINUS) { Point pts[] = { - Point(centreX - armSize, centreY - 1), - Point(centreX + armSize, centreY -1), - Point(centreX + armSize, centreY +1), - Point(centreX - armSize, centreY + 1), + Point::FromInts(centreX - armSize, centreY - 1), + Point::FromInts(centreX + armSize, centreY -1), + Point::FromInts(centreX + armSize, centreY +1), + Point::FromInts(centreX - armSize, centreY + 1), }; surface->Polygon(pts, ELEMENTS(pts), fore, back); @@ -363,14 +363,14 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac } } else if (markType == SC_MARK_SHORTARROW) { Point pts[] = { - Point(centreX, centreY + dimOn2), - Point(centreX + dimOn2, centreY), - Point(centreX, centreY - dimOn2), - Point(centreX, centreY - dimOn4), - Point(centreX - dimOn4, centreY - dimOn4), - Point(centreX - dimOn4, centreY + dimOn4), - Point(centreX, centreY + dimOn4), - Point(centreX, centreY + dimOn2), + Point::FromInts(centreX, centreY + dimOn2), + Point::FromInts(centreX + dimOn2, centreY), + Point::FromInts(centreX, centreY - dimOn2), + Point::FromInts(centreX, centreY - dimOn4), + Point::FromInts(centreX - dimOn4, centreY - dimOn4), + Point::FromInts(centreX - dimOn4, centreY + dimOn4), + Point::FromInts(centreX, centreY + dimOn4), + Point::FromInts(centreX, centreY + dimOn2), }; surface->Polygon(pts, ELEMENTS(pts), fore, back); } else if (markType == SC_MARK_LEFTRECT) { @@ -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(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), + Point::FromInts(static_cast<int>(rc.left), centreY-halfHeight), + Point::FromInts(static_cast<int>(rc.right) - 3, centreY - halfHeight), + Point::FromInts(static_cast<int>(rc.right) - 3 - halfHeight, centreY), + Point::FromInts(static_cast<int>(rc.right) - 3, centreY + halfHeight), + Point::FromInts(static_cast<int>(rc.left), centreY + halfHeight), }; surface->Polygon(pts, ELEMENTS(pts), fore, back); } else { // SC_MARK_FULLRECT diff --git a/src/XPM.cxx b/src/XPM.cxx index b3c9b338f..c2b308acb 100644 --- a/src/XPM.cxx +++ b/src/XPM.cxx @@ -47,7 +47,7 @@ ColourDesired XPM::ColourFromCode(int ch) const { void XPM::FillRun(Surface *surface, int code, int startX, int y, int x) { if ((code != codeTransparent) && (startX != x)) { - PRectangle rc(startX, y, x, y+1); + PRectangle rc = PRectangle::FromInts(startX, y, x, y + 1); surface->FillRectangle(rc, ColourFromCode(code)); } } |