The old code repeatedly evaluated QImage::colorTable(), which returns
a vector by value.
Instead, factor the checks performed on the color table into
a helper function and pass the color table to it, reducing
the number of evaluations from three to one.
Also makes the code more readable, because the condition now
fits on a single line.
Change-Id: I82773c235047e76b87c8a9d630f7df9440430351
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>