From 3de73c8508e74834a38f63f5c4584f1fb2012b52 Mon Sep 17 00:00:00 2001 From: Neil Date: Tue, 1 May 2018 14:14:45 +1000 Subject: Backport: Add IntegerRectangle to simplify drawing lines without casting. Backport of changeset 6773:9a027c16f8c3. --- src/MarginView.cxx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/MarginView.cxx') diff --git a/src/MarginView.cxx b/src/MarginView.cxx index 2b40b10bc..804ffcfcd 100644 --- a/src/MarginView.cxx +++ b/src/MarginView.cxx @@ -28,6 +28,7 @@ #include "StringCopy.h" #include "Position.h" +#include "IntegerRectangle.h" #include "UniqueString.h" #include "SplitVector.h" #include "Partitioning.h" @@ -58,16 +59,18 @@ void DrawWrapMarker(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourDesired wrapColour) { surface->PenColour(wrapColour); + const IntegerRectangle ircPlace(rcPlace); + enum { xa = 1 }; // gap before start - const int w = static_cast(rcPlace.right - rcPlace.left) - xa - 1; + const int w = ircPlace.Width() - xa - 1; const bool xStraight = isEndMarker; // x-mirrored symbol for start marker - const int x0 = static_cast(xStraight ? rcPlace.left : rcPlace.right - 1); - const int y0 = static_cast(rcPlace.top); + const int x0 = xStraight ? ircPlace.left : ircPlace.right - 1; + const int y0 = ircPlace.top; - const int dy = static_cast(rcPlace.bottom - rcPlace.top) / 5; - const int y = static_cast(rcPlace.bottom - rcPlace.top) / 2 + dy; + const int dy = ircPlace.Height() / 5; + const int y = ircPlace.Height() / 2 + dy; struct Relative { Surface *surface; -- cgit v1.2.3