From b0f0bd7c77b7cc184ce9bccdb3a7c126133b5bd3 Mon Sep 17 00:00:00 2001 From: Neil Date: Fri, 20 Apr 2018 08:28:06 +1000 Subject: Avoid casts for DrawIndentGuide. --- src/EditView.cxx | 12 ++++++------ src/EditView.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/EditView.cxx b/src/EditView.cxx index f1d607c8a..1b98d6fe0 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -785,10 +785,10 @@ static ColourDesired TextBackground(const EditModel &model, const ViewStyle &vsD } } -void EditView::DrawIndentGuide(Surface *surface, Sci::Line lineVisible, int lineHeight, Sci::Position start, PRectangle rcSegment, bool highlight) { +void EditView::DrawIndentGuide(Surface *surface, Sci::Line lineVisible, int lineHeight, XYPOSITION start, PRectangle rcSegment, bool highlight) { const Point from = Point::FromInts(0, ((lineVisible & 1) && (lineHeight & 1)) ? 1 : 0); - const PRectangle rcCopyArea = PRectangle::FromInts(static_cast(start + 1), static_cast(rcSegment.top), - static_cast(start + 2), static_cast(rcSegment.bottom)); + const PRectangle rcCopyArea(start + 1, rcSegment.top, + start + 2, rcSegment.bottom); surface->Copy(rcCopyArea, from, highlight ? *pixmapIndentGuideHighlight : *pixmapIndentGuide); } @@ -1700,7 +1700,7 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi indentCount <= (ll->positions[i + 1] - epsilon) / indentWidth; indentCount++) { if (indentCount > 0) { - const int xIndent = static_cast(indentCount * indentWidth); + const XYPOSITION xIndent = floor(indentCount * indentWidth); DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, xIndent + xStart, rcSegment, (ll->xHighlightGuide == xIndent)); } @@ -1779,7 +1779,7 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi indentCount <= (ll->positions[cpos + ts.start + 1] - epsilon) / indentWidth; indentCount++) { if (indentCount > 0) { - const int xIndent = static_cast(indentCount * indentWidth); + const XYPOSITION xIndent = floor(indentCount * indentWidth); DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, xIndent + xStart, rcSegment, (ll->xHighlightGuide == xIndent)); } @@ -1856,7 +1856,7 @@ void EditView::DrawIndentGuidesOverEmpty(Surface *surface, const EditModel &mode } for (int indentPos = model.pdoc->IndentSize(); indentPos < indentSpace; indentPos += model.pdoc->IndentSize()) { - const int xIndent = static_cast(indentPos * vsDraw.spaceWidth); + const XYPOSITION xIndent = floor(indentPos * vsDraw.spaceWidth); if (xIndent < xStartText) { DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, xIndent + xStart, rcLine, (ll->xHighlightGuide == xIndent)); diff --git a/src/EditView.h b/src/EditView.h index 8a194236d..82f2f93ee 100644 --- a/src/EditView.h +++ b/src/EditView.h @@ -121,7 +121,7 @@ public: Sci::Line DisplayFromPosition(Surface *surface, const EditModel &model, Sci::Position pos, const ViewStyle &vs); Sci::Position StartEndDisplayLine(Surface *surface, const EditModel &model, Sci::Position pos, bool start, const ViewStyle &vs); - void DrawIndentGuide(Surface *surface, Sci::Line lineVisible, int lineHeight, Sci::Position start, PRectangle rcSegment, bool highlight); + void DrawIndentGuide(Surface *surface, Sci::Line lineVisible, int lineHeight, XYPOSITION start, PRectangle rcSegment, bool highlight); void DrawEOL(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, PRectangle rcLine, Sci::Line line, Sci::Position lineEnd, int xStart, int subLine, XYACCUMULATOR subLineStart, ColourOptional background); -- cgit v1.2.3