Skip to content

qtfb: fix scaled partial updates collapsing to empty rects - #66

Open
dcasselwork123 wants to merge 1 commit into
asivery:masterfrom
dcasselwork123:fix-scaled-partial-updates
Open

qtfb: fix scaled partial updates collapsing to empty rects#66
dcasselwork123 wants to merge 1 commit into
asivery:masterfrom
dcasselwork123:fix-scaled-partial-updates

Conversation

@dcasselwork123

Copy link
Copy Markdown

The bug

FBController::markedUpdate(const QRect&) computes the scaled repaint rect with integer division:

(rect.x() / image->width()) * this->width()

For any rect inside the framebuffer, rect.x() / image->width() is 0 (and likewise the width/height terms), so on an allowScaling: true canvas every partial update requests an empty repaint. Clients that use MESSAGE_UPDATE/UPDATE_PARTIAL render into the SHM correctly but the screen never changes; only UPDATE_ALL (which calls markedUpdate() with no rect) repaints.

Observed on a reMarkable 2 (OS 3.27.1, AppLoad v0.5.3) with a native qtfb client: the app's initial full update painted, then all subsequent partial updates were silently dropped. Working around it client-side with UPDATE_ALL per stroke makes writing latency unusable on the GPU-less rM2, since each update becomes a full-window software repaint.

The fix

Scale in qreal, flooring the origin and ceiling the size with 1px slop so the damaged area is always covered. Also guards against a zero-sized image.

Tested on the rM2: partial updates repaint correctly and pen latency with a 35 ms update cadence is good.

🤖 Generated with Claude Code

FBController::markedUpdate computed the scaled update rect with integer
division (rect.x() / image->width() == 0 for any x inside the image), so
every partial update on an allowScaling canvas requested an empty repaint
and the screen never changed; only MESSAGE_UPDATE/UPDATE_ALL repainted.

Scale with qreal instead, flooring the origin and ceiling the size (+1px
slop) so the damaged area is always covered.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant