gfx.setDrawOffset within gfx.pushContext/popContext isn't cleaned up properly

See image for reference:
playdate-20240424-001439

The camera uses setDrawOffset to change the game's main view. The time in the top-right is drawn using the following code:

gfx.pushContext()
	gfx.setDrawOffset(0, 0)
	gfx.drawTextAligned(time, 400, 27, kTextAlignment.right)
gfx.popContext()

As you can see, this causes odd black bars to appear over the 'Weathered Warehouse' graphics when moving the camera. This issue disappears when the drawing code is surrounded by getting and resetting the drawOffset manually:

gfx.pushContext()
	local offsetX, offsetY = gfx.getDrawOffset()
	gfx.setDrawOffset(0, 0)
	gfx.drawTextAligned(time, 400, 27, kTextAlignment.right)
	gfx.setDrawOffset(offsetX, offsetY)
gfx.popContext()
1 Like