Move declarations to the top of drawText()
Add an assert for srcHeight != 0
Move declarations to the top of putData()
Move declarations to the top of checkImageType()
Move declarations to the top of createImage()
Remove empty lines in declarations
Move string literals to the bottom of declarations
Remove redundant initialization