optimize code for ppu sprite rendering.