Commit 65bea7c
OLED: undo vertical offsetY shift introduced in upstream OpenStickCommunity#1594
Upstream PR OpenStickCommunity#1594 ("clean-up build warnings") silenced a PVS-Studio
"unused variable" warning on `offsetY` in GPButton::draw() and
GPShape::draw() by adding that value to `baseY`:
baseY = ((this->y) * scaleY + viewport.top) + offsetY;
where offsetY = (display_height - viewport_height_scaled) / 2, i.e.
the would-be amount to center the viewport vertically within the
display. On any board whose viewport doesn't fill the full display
height (which is most of them — the header bar always reserves a
few rows at the top), that addition shifts every on-screen button
layout and shape downward by several pixels. Visible regression on
this board's Button Layout Screen.
`baseY` was computed correctly from `viewport.top` before — vertical
origin is already set by the viewport. The offsetY value is simply
unused; the horizontal offsetX is genuinely needed for centering
because viewports typically span the full width. Delete the stray
offsetY computation rather than route around the warning.
If future work wants a real vertically-centered layout, compute it
into the viewport's top/bottom fields at construction time, not
into a per-draw post-shift.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 1242dba commit 65bea7c
2 files changed
Lines changed: 14 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
30 | 37 | | |
31 | 38 | | |
32 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
| |||
0 commit comments