GLib deprecated g_thread_init(), and threading support is initialized
by GObject, so Clutter already runs with threading support enabled. We
can drop the clutter_threads_init() call requirement, and initialize the
Big Clutter Lock™ on clutter_init(). This reduces the things that have
to be done when dealing with threads with Clutter, and the things that
can possibly go wrong.
This adds a simple conformance test which sets up a few shader effects
using both the old style with clutter_shader_effect_set_source and the
new style by overriding get_static_shader_source. The effects are then
verified to confirm that they drew the right pixel colour.
https://bugzilla.gnome.org/show_bug.cgi?id=660512
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
Setting :use-markup and :text is currently not idempotent, and it
depends on the ordering, e.g.:
g_object_set (actor, "use-markup", TRUE, "text", value, NULL);
does not yield the same results as:
g_object_set (actor, "text", value, "use-markup", TRUE, NULL);
This is particularly jarring when using ClutterText from ClutterScript,
but in general GObject properties should not rely on the order when used
from g_object_set().
The fix is to store the contents of the ClutterText as a separate string
from the displayed text, and use the contents, instead of the displayed
text, when toggling the :use-markup property.
Let's also add a unit test for good measure, to try and catch
regressions.
https://bugzilla.gnome.org/show_bug.cgi?id=651940
The easing test is a nice example of what ClutterAnimation and
clutter_actor_animate() can do. The "tween ball to the pointer
event coordinates" is a bit of a staple in animation libraries
and their documentation.
Because we have had several reports about significant performance
regressions since we enabled offscreen redirection by default for
handling correct opacity we are now turning this feature off by default.
We feel that clutter should prioritize performance over correctness in
this case. Correct opacity is still possible if required but the
overhead of the numerous offscreen allocations as well as the cost of
many render target switches per-frame seems too high relative the
improvement in quality for many cases.
On reviewing the offscreen_redirect property so we have a way to
disable redirection by default we realized that it makes more sense for
it to take a set of flags instead of an enum so we can potentially
extend the number of things that might result in offscreen redirection.
We removed the ability to say REDIRECT_ALWAYS_FOR_OPACITY, since it
seems that implies you don't trust the implementation of an actor's
has_overlaps() vfunc which doesn't seem right.
The default value if actor::redirect_offscreen is now 0 which
effectively means don't ever redirect the actor offscreen.
The Animatable interface allows object classes to provide and animate
properties outside of the usual GObject property introspection API.
This change allows ClutterState to defer to the animatable objects the
property introspection and animation, just like ClutterAnimation does.
Currently, only clutter_model_iter_set_valist() is in charge of emitting
the ClutterModel::row-changed signal. Both the set() and the
set_valist() functions can be called with multiple columns, so we
coalesce the signal emission at the end of the set_valist(), to have a
single ::row-changed emission per change.
The clutter_model_iter_set_value() function is just a thin wrapper
around the set_value() virtual function, but since it's called
internally we cannot add the signal emission there as well, as we'd
break the signal coalescing.
For this reason, we need some code refactoring inside the various set()
variants of ClutterModelIter:
- we only use the internal va_arg variant for both the set() and
set_valist() public functions, to avoid multiple type checks;
- the internal set_valist() calls an internal set_value() method
which calls the virtual function from the iterator vtable;
- a new internal emit_row_changed() method is needed to retrieve
the ClutterModel from the iterator, and emit the signal;
Now, all three variants of the value setter will call an internal
ClutterModelIter::set_value() wrapper, and emit the ::row-changed
signal.
To check that the intended behaviour has been implemented, and it's not
going to be broken, the test suite has grown a new unit which populates
a model and changes a random row.
Keeping the backing Cairo surface of a CairoTexture canvas in sync with
the actor's allocation is tedious and prone to mistakes. We can
definitely do better by simply exposing a property that does the surface
resize and invalidation automagically on ::allocate.
The current "create context/draw/destroy context" pattern presents
various problems. The first issue is that it defers memory management to
the caller of the create() or create_region() methods, which makes
bookkeeping of the cairo_t* harder for language bindings and third party
libraries. The second issue is that, while it's easier for
draw-and-forget texturs, this API is needlessly complicated for contents
that have to change programmatically - and it introduces constraints
like calling the drawing code explicitly after a surface resize (e.g.
inside an allocate() implementation).
By using a signal-based approach we can make the CairoTexture actor
behave like other actors, and like other libraries using Cairo as their
2D drawing API.
The semantics of the newly-introduced ::draw signal are the same as the
one used by GTK+:
- the signal is emitted on invalidation;
- the cairo_t* context is owned by the actor;
- it is safe to have multiple callbacks attached to the same
signal, to allow composition;
- the cairo_t* is already clipped to the invalidated area, so
that Cairo can discard geometry immediately before we upload
the texture data.
There are possible future improvements, like coalescing multiple
invalidations inside regions, and performing clipped draws during
the paint cycle; we could even perform clipped redraws if we know the
extent of the invalidated area.
Some of the tests are making direct GL calls. Eventually we want
Clutter not to link directly against any GL library so that it can
leave Cogl to load it dynamically. As a step towards getting this to
work this patch changes the tests to resolve the symbols using
cogl_get_proc_address instead of linking directly.
Rather than using the #ifdefs and assuming that only one Cogl driver
is compiled in (which is no longer true), the test now calls
glGetString to check the GL_VERSION. This is kind of a hack but the
test is already calling GL functions directly anyway.
test-cogl-materials had a weird comment about glReadPixels using
inverted coordinates but the test now uses cogl_read_pixels instead of
glReadPixels so it is irrelevant.
The class is of dubious utility, now that we have a complex animation
API in ClutterAnimator and ClutterState, as opposed to a simple one
in ClutterBehaviour. The Score API also suffers from some naïve design
issues that made it far less useful than intended.
This adds a simple test which creates a material and a copy of
it. Both materials are then immediately unref'd. The test checks
whether the materials were actually freed by registering some user
data with a destroy callback. This should catch a bug that Cogl had
where it add an extra reference to the parent when a pipeline is
copied.
Signed-off-by: Robert Bragg <robert@linux.intel.com>
This adds a performance tracking framework that can run a set of tests over
specified git revisions. The ruby script for generating the reports comes from
similar performance tracking in GEGL. The framework permits evaluating new
tests against older version of clutter.
The tests themselves go through a few hoops for disabling framerate limiting in
both mesa and clutter.
When running make check the tests will be run and lines of the form:
@ test-state: 40.51 fps
will be left in the output, a script can scrape these lines out of a build log
on a buildbot to in other ways track performance.
We were checking HAVE_COGL_GLES2 but this is not publicly defined by
Cogl so since splitting Cogl from Clutter test-cogl-materials.c would
not have built against gles2 since it would end up enabling the GL
specific code path which would reference an undefined symbol.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Complete the quest of commit bc548dc862
by making the ClutterStage methods for controlling the per-actor motion
and crossing event delivery public, and deprecating the global ones.