Miscellaneous optimizations to sprite drawing