Cleaning up paint(utils)
SquidDev opened this issue · 2 comments
Just having a flick through paint and paintutils, and a couple of things we could definitely improve:
paintutils
-
Redundant type checks: https://github.com/SquidDev-CC/CC-Tweaked/blob/6734af6e4a7ec411e447e0b4fb6066101eb2da8a/src/main/resources/data/computercraft/lua/rom/apis/paintutils.lua#L74-L76
-
Box drawing should use
term.blit
. We should still probably keep theterm.setBackgroundColour
for "backwards compatibility". -
Experiment with using
term.blit
for drawing images. Sadly images are stored using tables of numbers, so we can't blit super efficiently, but worth seeing if it's any faster anyway.It occurs to me that this won't work with transparent images, so may not be possible at all.
paint
- Drawing the initial image is slow. We should replace
drawCanvas
with aterm.blit
based version and see if it is any faster.
Made the paint improvements in aab0cd3. My goodness, it's absurd how much faster it is.