Should sprite:getImage():clear() require an explicit sprite:markDirty()

Hi!

When I clear the image attached to a sprite, I need to explicitly mark it as dirty or else the display won't update properly.

s:getImage():clear(playdate.graphics.kColorWhite)
s:markDirty()

This does not occur if I immediately draw something to the image. I assume this is because the drawWhatever call correctly flags the image as dirty so gets it redrawn, while as clear() does not. Since this is probably not intended and just an oversight in :clear(), I figured I'd file a bug.

Relatedly, I noticed the SDK documentation for playdate.graphics.sprite.getAlwaysRedraw() was just copy pasted from setAlwaysRedraw.

Thanks!

Sorry I missed this when you posted it! I stumbled across it while looking for previous dirty flag problems for About changing an image mask, so I've added it to the issue I filed for that one. There's a low-level LCDBitmap_clear() function that does set the flag (and which the C API clearBitmap() function calls) but for some reason the Lua version uses a different function which doesn't. I need to go look at the commit logs and try to sort out what happened there.

Thanks for the report and, again, apologies it flew under the radar for so long.

1 Like