mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-20 22:30:30 +01:00
[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:
@@ -19,5 +19,16 @@ KDColor KDContext::getPixel(KDPoint p) {
|
||||
|
||||
void KDContext::getPixels(KDRect r, KDColor * pixels) {
|
||||
KDRect rect = r.translatedBy(m_origin);
|
||||
pullRect(rect, pixels);
|
||||
if (m_clippingRect.containsRect(rect)) {
|
||||
pullRect(rect, pixels);
|
||||
return;
|
||||
}
|
||||
int i = 0;
|
||||
KDCoordinate yMax = r.y()+r.height();
|
||||
KDCoordinate xMax = r.x()+r.width();
|
||||
for (int y = r.y(); y < yMax; y++) {
|
||||
for (int x = r.x(); x < xMax; x++) {
|
||||
pixels[i++] = getPixel(KDPoint(x, y));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user