texture: Handle premult conversions when getting texture data
texture: Handle premult conversions when getting texture data

cogl_texture_get_data uses find_best_gl_get_data_format from the
texture driver which returns the closest format to use for retrieving
pixel data given an intended format. However this function doesn't
know about the texture we are reading data from so it doesn't know
that the data we will actually receive will have the same premult
status as the texture's format. With the GL driver, this function ends
up returning exactly the same format as passed in which means it will
never do a premult conversion. Under GLES it always returns
COGL_PIXEL_FORMAT_RGBA_8888 so it will always make the data unpremult
even if the final requested format is premultiplied.

This patch fixes it so that it copies the premult status of the
closest_format from the format of the underlying texture. That way it
will later convert or not depending on the requested target format.

Note this patch breaks test-sub-texture with the GL driver because
that is incorrectly trying to read the texture data back as RGBA_8888
even though it depends on it not doing a premult conversion. The test
was already broken with GLES2 and remains broken.

Reviewed-by: Robert Bragg <12e9293ec6b30c7fa8a0926af42807e929c1684f@linux.intel.com>

djdeath/cogl-android,Distrotech/cogl,djdeath/cogl,Distrotech/cogl,djdeath/cogl,djdeath/cogl-android,Distrotech/cogl,gcampax/cogl,djdeath/cogl,Distrotech/cogl,gcampax/cogl,gcampax/cogl,gcampax/cogl,djdeath/cogl-android