[kandinsky] In KDContext::getPixels: beware of rects crossing the screen

This fixes a display glitch on the device, when using Python's turtle
module and doing the command forward(200).
This commit is contained in:
Léa Saviot
2018-12-07 11:30:32 +01:00
parent c8a5972243
commit e836593ff9
3 changed files with 23 additions and 1 deletions

View File

@@ -146,6 +146,16 @@ bool KDRect::contains(KDPoint p) const {
return (p.x() >= x() && p.x() <= right() && p.y() >= y() && p.y() <= bottom());
}
bool KDRect::containsRect(const KDRect & other) const {
if (other.isEmpty()) {
return true;
}
if (isEmpty()) {
return false;
}
return contains(other.topLeft()) && contains(other.bottomRight());
}
bool KDRect::isAbove(KDPoint p) const {
return (p.y() >= y());
}