The semantics of shadowing global variables is well defined and it gets
quite annoying to avoid them completely since there are too many
standard APIs with very poor namespacing.
When freeing a framebuffer stack it's possible to have entries with NULL
draw or read buffers so we should check that before calling
cogl_onscreen/offscreen_free. This fixes a crash with the wayland
backend when running conformance tests such as cogl-test-object which
never push a framebuffer.
To support toolkits targeting wayland and using Cogl we allow toolkits
to be responsible for connecting to a wayland display and asking Cogl to
use the toolkit owned display and compositor object. Note: eventually
the plan is that wayland will allow retrospective querying of objects so
we won't need the foreign compositor API when Cogl can simply query it
from the foreign display.
The EGL API doesn't provide for a way to explicitly select a platform
when the driver can support multiple. Mesa allows selection using an
EGL_PLATFORM environment variable though so we set that to "wayland"
when we know that's what we want.
Actually calling cogl_set_default_context isn't required because
cogl_context_new implicitly sets the new context to be the default
context. Since we want to eventually get rid of the concept of a default
context we'd rather not pollute the example with the concept.
Some places were using COGL_HAS_WIN32 but the only macro defined is
COGL_HAS_WIN32_SUPPORT. The similar macros such as COGL_HAS_XLIB are
only defined for compatibility with existing code but COGL_HAS_WIN32
was never defined so there's no need to support it.
One of the places was including the non-existant cogl-win32.h. This
has been removed because the file only temporarily existed during
development of the backend.
In update_primitive_attributes it tries to fill in an array of
pointers with a NULL terminator. However it was only allocating enough
space for a pointer for each of the attributes plus one byte instead
of plus enough bytes for another pointer.
Thomas Wood found this bug with static analysis.
All of the winsys backends didn't handle cleaning up the CoglOnscreen
properly so that they would assert in cogl_onscreen_free because the
winsys pointer is never freed. They also didn't cope if deinit is
called before init (which will be the case if an onscreen is created
and freed without being allocated).
When SetPixelFormat fails, the DC would get released but none of the
other resources would be freed. This patch makes it call
_cogl_winsys_onscreen_deinit on failure to clean up all of the
resources. The patch looks big because it moves the onscreen_deinit
and onscreen_bind functions.
Some of the virtual functions in CoglWinsysVtable only need to be
implemented for specific backends or when a specific feature is
advertised. This splits the vtable struct into two commented sections
marking which are optional and which are required. Wherever an
optional function is used there is now a g_return_if_fail to ensure
there is an implementation.
Wayland now supports integration via standard eglSurfaces which makes it
possible to share more code with other EGL platforms. (though at some
point cogl-winsys-egl.c really needs to gain a more formal
CoglEGLPlatform abstraction so we can rein back on the amount of #ifdefs
we have.)
This pulls in the experimental cogl 2.0 reference manual from the
clutter repository since it wasn't included in the filter-branch when we
split cogl out.
It seems more natural to compile examples after optional libraries as
you could have an example illustrating one of those libraries.
Build the docs and po files at the end too, trying to group the
compilation of C files together.
When creating a new display list the pango renderer tries to add a
callback to the glyph cache so that it can be notified whenever the
atlas is reorganized. However it was always registering the callback
for the glyph cache which doesn't use mipmapping so if mipmapping is
enabled then it wouldn't work correctly.
This patch moves the two sets of caches (pipeline cache and glyph
cache) into one struct so that it's a little bit easier to determine
which pair to use in the code.
Some of the sources need to include <cogl/cogl-defines.h> which is in
the build directory. I think this directory gets added to the include
flags anyway by something so the actual building works but when
building the introspection data out of tree it was not included so it
failed to scan.
When Cogl was sharing Clutter's configure script, it had a check for
the ffs function of libc so that it can provide a fallback if it is
not available. This fallback was missed in the split out so Cogl would
end up always using the fallback.
This removes all the remnants from being able to build Cogl standalone
while it was part of the Clutter repository. Now that Cogl has been
split out then standalone builds are the only option.
We now install cogl-pango-1.0 and cogl-pango-2.0 pkg-config files that
applications should optionally depend on if they want to use the
cogl_pango API.
If a foreign xid has been set on a CoglOnscreen then
cogl_onscreen_x11_get_window_xid doesn't need to defer to the winsys to
get the underlying window xid. This also means it's possible to read
back the xid before the framebuffer is allocated which fixes a crash in
the x11-foreign example app.
Ideally we wouldn't have any private symbols exported, but for now there
are some APIs that coglpango needs access to that aren't public so we
have ensure they are exported. The aim is to get rid of this need at
some point.
When comparing the wrap modes of two pipeline layers it now considers
COGL_WRAP_MODE_AUTOMATIC to be equivalent to CLAMP_TO_EDGE. By the
time the pipeline is in the journal, the upper primitive code is
expected to have overridden this wrap mode with something else if it
wants any other behaviour. This is important for getting text to batch
together with textures because the text explicitly sets the wrap mode
to CLAMP_TO_EDGE on its pipeline.
The material cache will now only set the special combine mode if the
texture only has an alpha component. The atlased textures will have
all four components so it will leave the combine functions at the
default. This increases the chances of batching between glyphs and
images.
When using the global atlas, the glyph from cairo is now rendered into
an ARGB surface rather than an alpha-only surface.
Instead of creating just two materials (one for texturing and one for
solid primitives) the pango renderer now maintains a cache of
pipelines. The display list can request a pipeline for a texture from
the cache. The same pipeline cache is used by all display lists so
that the pipelines can be shared. This avoids changing the texture on
the material during a paint run.
It now avoids trying to reserve space for zero-sized glyphs. That
happens for example when the layout contains a space. This was causing
the regular glyph cache to be used because the global atlas does not
support zero-sized images. That would then break up the
batching. Instead it now still reserves an entry in the cache but
leaves the texture as COGL_INVALID_HANDLE.
When rendering a glyph from a texture, instead of adding the glyph's
texture handle to the display list it now retrieves the base texture
using _cogl_texture_foreach_subtexture_in_region and adds that
instead. That way the display can recognise that glyphs in the global
atlas are sharing the same texture and combine them into one VBO.