tga: Refactor state machine
tga: Refactor state machine

Instead of keeping lots of flags, just keep a function pointer and
reassign to a new function whenever state changes.

GNOME/gdk-pixbuf,GNOME/gdk-pixbuf,Distrotech/gdk-pixbuf,Distrotech/gdk-pixbuf,Distrotech/gdk-pixbuf,Distrotech/gdk-pixbuf,GNOME/gdk-pixbuf,GNOME/gdk-pixbuf,Distrotech/gdk-pixbuf