gl2: move POT image scaling to internal/util