display: Add helper methods to Display::clip and Display::clamp_x/y_ (#5003)
* display: `Rect` make most of methods `const` * display: add `clip` and `clamp_x/y_` methods for clipping to `Display`
This commit is contained in:
1 parent
f8df694aa3
commit
1691c13b47
4 files changed
+57
-15
No files matched your search
@@ -60,11 +60,11 @@ void Rect::shrink(Rect rect) {
|
||||
}
|
||||
}
|
||||
|
||||
bool Rect::equal(Rect rect) {
|
||||
bool Rect::equal(Rect rect) const {
|
||||
return (rect.x == this->x) && (rect.w == this->w) && (rect.y == this->y) && (rect.h == this->h);
|
||||
}
|
||||
|
||||
bool Rect::inside(int16_t test_x, int16_t test_y, bool absolute) { // NOLINT
|
||||
bool Rect::inside(int16_t test_x, int16_t test_y, bool absolute) const { // NOLINT
|
||||
if (!this->is_set()) {
|
||||
return true;
|
||||
}
|
||||
@@ -75,7 +75,7 @@ bool Rect::inside(int16_t test_x, int16_t test_y, bool absolute) { // NOLINT
|
||||
}
|
||||
}
|
||||
|
||||
bool Rect::inside(Rect rect, bool absolute) {
|
||||
bool Rect::inside(Rect rect, bool absolute) const {
|
||||
if (!this->is_set() || !rect.is_set()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user