Updating PR 1498

Updating PR 1498 with a new NextPOT and fix on the condition trigger to resize the bitmap rendering buffer.