Prints microseconds per test over Serial so speed changes can be
compared before and after on the same board and display.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
drawCircleHelper and fillCircleHelper wrote pixels without startWrite,
so direct calls drew nothing on SPI displays (#437). They now open
their own write, and fillCircle, drawRoundRect and fillRoundRect close
theirs first so writes never nest.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Add #pragma once and the Adafruit_GFX include, then run clang-format,
so CI passes.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Deleting a canvas or display through an Adafruit_GFX pointer called
only the base destructor, so the canvas buffer leaked (#369). AVR is
left out because a virtual destructor links malloc and free into
display sketches that never use the heap (+602 bytes on an Uno).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
writePixels and writeColor used hwspi._spi without checking the connection,
so displays on software SPI hung on the first fill.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Each 20000-pixel pass took about 1.65 s with no yield on a 3.5" HX8357,
which tripped the soft watchdog. 5000 pixels is about 0.4 s.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
yield() panics when drawing from a timer or Ticker callback (#285).
optimistic_yield(10000) still yields on long draws so the watchdog
stays fed, and does nothing where yielding is not allowed.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
delay(1) ran on every writeColor call, making small fills about 3x
slower (#479). delay(0) no longer yields on core 3.x and trips the
soft WDT, and yield() panics when drawing from SYS context.
optimistic_yield(10000) yields only after 10 ms and is a no-op where
yielding is not allowed.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
If malloc fails in a GFXcanvas1/8/16 constructor, buffer is NULL and
fillRect, lines and text write through it and crash the board. Set the
canvas size to 0x0 instead so every draw call clips out, and sketches
can check width()/height() or getBuffer().
Based on #441 by @aremmell and the 0x0 idea from @jepler.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Measuring at the button position predicts a line wrap that print()
never does, so a wide label on a button near the right edge moved
off its button. Measure at (0,0) and offset by the returned x/y.
The charBounds virtual change is unrelated to this fix, so it is
dropped.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>