diff options
author | Neil <nyamatongwe@gmail.com> | 2018-05-01 14:14:45 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2018-05-01 14:14:45 +1000 |
commit | 3de73c8508e74834a38f63f5c4584f1fb2012b52 (patch) | |
tree | 9fa739b8d3f2d1a365f923d975f7bf06ff3526bb /src/MarginView.cxx | |
parent | 30808d18f64c63db954cf4b72a879608f0266bd1 (diff) | |
download | scintilla-mirror-3de73c8508e74834a38f63f5c4584f1fb2012b52.tar.gz |
Backport: Add IntegerRectangle to simplify drawing lines without casting.
Backport of changeset 6773:9a027c16f8c3.
Diffstat (limited to 'src/MarginView.cxx')
-rw-r--r-- | src/MarginView.cxx | 13 |
1 files changed, 8 insertions, 5 deletions
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<int>(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<int>(xStraight ? rcPlace.left : rcPlace.right - 1); - const int y0 = static_cast<int>(rcPlace.top); + const int x0 = xStraight ? ircPlace.left : ircPlace.right - 1; + const int y0 = ircPlace.top; - const int dy = static_cast<int>(rcPlace.bottom - rcPlace.top) / 5; - const int y = static_cast<int>(rcPlace.bottom - rcPlace.top) / 2 + dy; + const int dy = ircPlace.Height() / 5; + const int y = ircPlace.Height() / 2 + dy; struct Relative { Surface *surface; |