Don't pass texture + rect, but instead have
gdk_memory_texture_new_subtexture()
and use it to generate subtextures and pass them.
This has the advantage of downloading the a too large texture only once
instead of N times.
Pass a format do GdkTextureClass::download(). That way we can download
data in any format.
Also replace gdk_texture_download_texture() with
gdk_memory_texture_from_texture() which again takes a format.
The old functionality is still there for code that wants it: Just pass
gdk_texture_get_format (texture) as the format argument.
For MemoryTexture, this is a simple change.
For GLTexture, we need to query the format at texture creation. This
sounds like a bad idea and extra work until one realizes that we'd
need to do that anyway when using the texure the first time - either
when downloading, or when trying to use it in a rendernode, where we
will soon need that information to determine if the texture prefers high
depth.
Also, now make gdk_memory_convert() the only conversion functions
and allow conversions between any 2 formats by going via a float[4].
This could be optimized via fast-paths, but so far it isn't.
Do custom uploads rather than using gdk_cairo_surface_upload_to_gl(),
because this way we avoids a roundtrip (memcpy and possibly conversion)
to the cairo image surface format.
This is necessary so that bidnings work properly and don't make
gdk_gl_texture_release() a function on GdkTexture.
It also allows code to identify what type of texture they are dealing
with.
Finally, we can now decide to add getters later without screwing
anything up, if we want to allow people to access GL textures directly.
GdkMemoryTexture is a texture implementation for holding data in memory
(read: GBytes). You specify the GdkMemoryFormat that data is in and off
you go.
Renderers can use this to add uploads in various different formats and
don't need to fallback to GDK doing the conersion on the CPU.
Supported formats can be extended if we need new ones, for now I just
added the relevant ones for Cairo and GdkPixbuf.
The constructor is also private still, because I'm not sure we want to
export GdkMemoryFormat.
Wrappers that do from_cairo_surface() and for_pixbuf() do exist though.