feat: scrolling

This commit is contained in:
2026-08-06 09:05:02 -04:00
parent 26f3fdb6e6
commit e5ed980294
9 changed files with 527 additions and 37 deletions
+30
View File
@@ -137,6 +137,36 @@ public:
// clean up ghosting all stay here. A live LCD has nothing pending and does
// nothing.
virtual void commit() = 0;
// Offscreen band for composited repaints. beginBuffer opens a RAM surface
// covering the screen rectangle (x, y, w, h); every subsequent draw keeps its
// screen coordinates (the driver translates into the band) and clips to it,
// so a caller re-walks the same tree per band without renumbering anything.
// present() blits the band back to (x, y) and returns drawing to the panel.
// Re-rasterizing into RAM and pushing once collapses a per-primitive bus
// transaction storm into a streamed write, which is what direct-to-panel
// drawing cannot make smooth. A driver with no spare RAM (or an e-ink panel
// that gains nothing) refuses the band, so the painter draws to the panel.
virtual bool beginBuffer(int32_t x, int32_t y, int32_t w, int32_t h) {
(void)x;
(void)y;
(void)w;
(void)h;
return false;
}
virtual void present() {}
// Clips every draw to this screen rectangle until clearClip(). The painter
// wraps a custom node in its own box, because a node owns its box and nothing
// else's: a band is usually taller than the node it covers, so a painter that
// draws outside itself -- a list row half scrolled off the top -- would
// otherwise land on whatever else that band covers. Not clipping is only safe
// while no custom node ever overdraws.
virtual void setClip(int32_t x, int32_t y, int32_t w, int32_t h) {
(void)x;
(void)y;
(void)w;
(void)h;
}
virtual void clearClip() {}
virtual void fillPolygon(const int32_t* xs, const int32_t* ys, size_t count,
int32_t color) = 0;
// Null coordinates centre the image; null bounds fall back to the panel size.