diff options
author | Neil <nyamatongwe@gmail.com> | 2023-01-16 09:07:09 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2023-01-16 09:07:09 +1100 |
commit | 887da82073d4ab855a3ba95deaa652d475df21e2 (patch) | |
tree | d1d9d02e5915726b3bb21e5ef95da4507a42ec18 /src/Geometry.h | |
parent | 8fe06c8d006a9f149a964f1a69b4f1230082ed00 (diff) | |
download | scintilla-mirror-887da82073d4ab855a3ba95deaa652d475df21e2.tar.gz |
Use intervals for drawing.
Diffstat (limited to 'src/Geometry.h')
-rw-r--r-- | src/Geometry.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Geometry.h b/src/Geometry.h index 354f3ea25..4e4fe95d9 100644 --- a/src/Geometry.h +++ b/src/Geometry.h @@ -66,6 +66,9 @@ public: constexpr bool Intersects(Interval other) const noexcept { return (right > other.left) && (left < other.right); } + constexpr Interval Offset(XYPOSITION offset) const noexcept { + return {left + offset, right + offset}; + } }; /** @@ -112,6 +115,10 @@ public: return (right > other.left) && (left < other.right) && (bottom > other.top) && (top < other.bottom); } + constexpr bool Intersects(Interval horizontalBounds) const noexcept { + return (right > horizontalBounds.left) && (left < horizontalBounds.right); + } + void Move(XYPOSITION xDelta, XYPOSITION yDelta) noexcept { left += xDelta; top += yDelta; @@ -119,6 +126,10 @@ public: bottom += yDelta; } + PRectangle WithHorizontalBounds(Interval horizontal) const noexcept { + return PRectangle(horizontal.left, top, horizontal.right, bottom); + } + constexpr PRectangle Inset(XYPOSITION delta) const noexcept { return PRectangle(left + delta, top + delta, right - delta, bottom - delta); } |