mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-19 04:33:27 +02:00
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:
@@ -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