Add annotations such as (transfer-none) (out) (element-type ClutterActor),
and so forth to the doc comments as appropriate.
The annotations added here are a combination of the annotations previously
in gir-repository for Clutter and annotations found in a review of all
return values with that were being parsed with a transfer of "full".
http://bugzilla.openedhand.com/show_bug.cgi?id=1452
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1464 - clutter_timeline_list_markers should set n_markers=0 when
there are no markers
If no markers are registered and we bail out we should also set the
n_markers out parameter to 0 so that code checking the number of
markers will still work.
Like clutter_timeline_advance(), calling advance_to_marker() will
not emit ::new-frame for the frame where the marker is set on; it
will also not emit ::marker-reached for the marker we are advancing
the timeline to.
When calling clutter_timeline_advance(), a timeline will not emit
the ::new-frame signal for the frame we are advancing to, as this
would break the invariants of the timeline behaviour.
The documentation should make this clear.
The clutter_timeline_new() constructor is not checking the full
range of the passed :fps property. The ParamSpec of the property
and the setter method perform this check, so the ctor should as
well.
The "is-timeline-complete" condition is pretty long, spanning
four lines and four logical sub-conditions. It is possible to
neatly move it into an is_complete() function and make the
code more readable.
The long description of the ClutterTimeline class is very C
developer-oriented. Since many language bindings will refer to
the C API reference we should probably be more verbose and
language agnostic -- at least in the class description.
The methods documentation also requires a little pass to increase
the consistency of the terminology, the grammar and the syntax.
Finally, comments never killed anyone.
Since not every timeline will have markers it's unfair to make
all of them crete two empty hash tables (with a preallocated
fixed size).
This commit moves the responsibility of creating the hash tables
to the marker API itself, and adds the relative checks.
Since we are using milliseconds granularity to integrate timelines
with the GLib main loop, we cannot allow values of the :fps
property bigger than 1000. This means validating the fps value both
in the GParamSpec and the clutter_timeline_set_speed() accessor
function.
This should also fix floating point exceptions when trying to
perform "n_frames = milliseconds / (1000 / fps)".
See bug 1354:
http://bugzilla.openedhand.com/show_bug.cgi?id=1354
The special check to invert the progress when the timeline direction
is backwards is not necessary because the actual frame number will be
decreasing in that case. Inverting just makes it progress forwards
again.
This is more apparent since the float-alpha-value branch merge because
the clutter_linear function directly returns the value from
get_progress. For example in test-depth, the animations loop instead
of oscillating back and forth.
This is the result of running a number of sed and perl scripts over the code to
do 90% of the work in converting from 16.16 fixed to single precision floating
point.
Note: A pristine cogl-fixed.c has been maintained as a standalone utility API
so that applications may still take advantage of fixed point if they
desire for certain optimisations where lower precision may be acceptable.
Note: no API changes were made in Clutter, only in Cogl.
Overview of changes:
- Within clutter/* all usage of the COGL_FIXED_ macros have been changed to use
the CLUTTER_FIXED_ macros.
- Within cogl/* all usage of the COGL_FIXED_ macros have been completly stripped
and expanded into code that works with single precision floats instead.
- Uses of cogl_fixed_* have been replaced with single precision math.h
alternatives.
- Uses of COGL_ANGLE_* and cogl_angle_* have been replaced so we use a float for
angles and math.h replacements.
Bug 1309 - clutter_timeline_new and clutter_timeline_set_speed
have two standard of the fps limitation
* clutter/clutter-timeline.c:
(clutter_timeline_class_init): Set the maximum value of the
:fps property to be G_MAXUINT. (Zhang Wei)
* clutter/clutter-timeline.c (timeline_timeout_func): Move the
code for firing the new-frame and marker-reached signals into a
separate static function so that it can also be called when the
last frame is reached. Also fix an issue where the frame numbers
were changed in the wrong direction when detecting missed markers
in a reversed timeline. Based on a patch by Michael Boccara.
* tests/test-timeline.c: Now tries to automatically verify whether
the test worked by keeping track of all the signal emissions. The
timelines are run a second time with an extra timeout that causes
delays to simulate skipped frames.
Bug 1209 - Move fixed point API in COGL
* clutter/cogl/cogl-fixed.h:
* clutter/cogl/cogl.h.in:
* clutter/cogl/common/Makefile.am:
* clutter/cogl/common/cogl-fixed.c: Add fixed point API, modelled
after the ClutterFixed. The CoglFixed API supercedes the ClutterFixed
one and avoids the dependency of COGL on Clutter's own API.
* clutter/cogl/common/cogl-clip-stack.c:
* clutter/cogl/common/cogl-primitives.c:
* clutter/cogl/common/cogl-primitives.h: Update internal usage of
ClutterFixed to CoglFixed.
* clutter/cogl/gl/Makefile.am:
* clutter/cogl/gl/cogl-primitives.c:
* clutter/cogl/gl/cogl-texture.c:
* clutter/cogl/gl/cogl.c: Ditto, in the GL implementation of the
COGL API.
* clutter/cogl/gles/Makefile.am:
* clutter/cogl/gles/cogl-fbo.c:
* clutter/cogl/gles/cogl-gles2-wrapper.c:
* clutter/cogl/gles/cogl-primitives.c:
* clutter/cogl/gles/cogl-texture.c:
* clutter/cogl/gles/cogl.c: Ditto, in the GLES implementation of
the COGL API.
* clutter/pango/pangoclutter-glyph-cache.c:
* clutter/pango/pangoclutter-glyph-cache.h: Ditto, in the Pango
renderer glyphs cache.
* clutter/clutter-fixed.c:
* clutter/clutter-fixed.h: ClutterFixed and related API becomes
a simple transition API for bindings and public Clutter API.
* clutter/clutter-actor.c:
* clutter/clutter-alpha.c:
* clutter/clutter-backend.c:
* clutter/clutter-behaviour-depth.c:
* clutter/clutter-behaviour-ellipse.c:
* clutter/clutter-behaviour-path.c:
* clutter/clutter-behaviour-rotate.c:
* clutter/clutter-behaviour-scale.c:
* clutter/clutter-clone-texture.c:
* clutter/clutter-color.c:
* clutter/clutter-entry.c:
* clutter/clutter-stage.c:
* clutter/clutter-texture.c:
* clutter/clutter-timeline.c:
* clutter/clutter-units.h: Move from the internal usage of
ClutterFixed to CoglFixed.
* doc/reference/clutter/clutter-sections.txt:
* doc/reference/cogl/cogl-docs.sgml:
* doc/reference/cogl/cogl-sections.txt: Update the documentation.
* tests/test-cogl-tex-tile.c:
* tests/test-project.c: Fix tests after the API change
* README: Add release notes.
* clutter/clutter-timeline.c: Calculate the 'duration' property
on-demand instead of storing it as a member variable. Notify
duration property changes whenever the fps or num_frames changes.
* clutter/clutter-main.h: Make the priority constants public.
* clutter/clutter-stage.c: Use CLUTTER_PRIORITY_REDRAW.
* clutter/clutter-timeline.c: Use CLUTTER_PRIORITY_TIMELINE.
Bug #967 - Mismatch of Timeline::marker-reached signal signature
* clutter/clutter-marshal.list:
* clutter/clutter-timeline.c:
(clutter_timeline_class_init): Fix the type of the frame_num
argument in the ::marker-reached signal creation to match the
signal class handler. (Armin Burgmeier)
Bug#959 - Multiple minor improvements
* configure.ac: pick up GDKPIXBUF_PREFIX from gdk-pixbuf-2.0
module, not pango
* clutter/clutter-keysyms-table.h: cosmetic fix for ifdef guard
name in the comment (leftover from earlier commit)
* tests/test-textures.c: don't depend on GdkPixbuf as we're not
using any actual features from it, just plain pixel buffer
manipulation
* clutter/clutter-timeline.c
* clutter/clutter-timeline.h (clutter_timeline_list_markers): Use
gsize* to return number of items, not guint*
* tests/test-paint-wrapper.c: use correct type (guint*) in call
to clutter_actor_get_size()
* tests/test-depth.c (janus_group): properly take height2 into
account when calculating needed height for the rectangle
* tests/test-cogl-tex-getset.c: use rowstride, not width*4, when
calculating pixel offsets
* tests/test-cogl-tex-getset.c: Don't assume/force RGBA format,
also support ARGB format (needed with quartz imageloader.)
* clutter/clutter-frame-source.h:
* clutter/clutter-frame-source.c:
New files that contain a replacement for g_timeout that try to
cope with system delays.
* clutter/Makefile.am: Added clutter-frame-source.{c,h}
* clutter/clutter-timeline.c (timeout_add): Use a frame source
instead of a g_timeout.
* clutter/clutter-main.c (clutter_threads_add_frame_source_full)
(clutter_threads_add_frame_source): New public functions to wrap a
frame source and grab the Clutter mutex.
* clutter/clutter-timeout-pool.c: Now calculates the timeout
expiration times in the same way as a frame source does so that it
counts time in frame intervals instead of setting the next
expiration time as an offset from the current time.
* clutter/clutter-timeline.c (clutter_timeline_get_progressx): Fix
arithmetic for calculating the reverse progress when the timeline
is backward. (Should subtract from one instead of taking the
reciprocal).
* clutter/clutter-score.[ch]: Remove all the API changes, and
just add a clutter_score_append_at_marker(); the implementation
remains the same, but the marker must be explicitly created by
the developer. The ids are no longer used to create implicit
markers, so they can return to be unsigned integers.
* clutter/clutter-timeline.[ch]:
(clutter_timeline_has_marker): Add a function to query a timeline
for a marker being set.
* tests/test-score.c (main): Update with the API changes.
* clutter.symbols: Update exported symbols.
* clutter/clutter-marshal.list: Add signature for the
::marker-reached signal marshaller.
* clutter/clutter-timeline.[ch]: Add timeline marker API;
using markers it is possible to add a unique identifier to
a particular frame of the timeline, and receive a signal
notification when reaching that particular marker while
playing the timeline. (#641)
* tests/test-timeline.c: Update the test case to check for
the marker-reached signal emission.
* clutter.symbols: Add new symbols.
* clutter/clutter-timeline.c:
Timeline changes to fix the issues identified in bugzilla #439
Notably, this includes some tweaks to timeline semantics. So e.g. for a
10 frame timeline here are some points about the new timeline code:
- When you create a timeline it starts with current_frame_num == 0
- After starting a timeline, the first timeout is for
current_frame_num == 1 (Notably it isn't 0 since there is a delay
before the first timeout signals so re-asserting the starting point
would give a longer than average first frame.)
- For a non looping timeline the last timeout would be for
current_frame_num == 10
- For a looping timeline the timeout for current_frame_num == 10 would
be followed by a timeout for current_frame_num == 1 and frame 0 is
considered == frame 10.
- Asking for a timeline of N frames might better be described as asking
for a timeline of _length_ N.
Warning: Although I tried to test things, I guess it's quite likely that
this breaks somthing depending on a specific quirk of the previous
timeline code.
* clutter/clutter-actor.c:
(clutter_actor_get_property): Use clutter_actor_get_reactive()
instead of the IS_REACTIVE() macro.
(clutter_actor_set_reactive): Emit the notify signal for the
reactive property.
* clutter/clutter-timeline.c:
(timeline_timeout_func),
(clutter_timeline_get_delta): Coding style fixes.
* clutter/clutter-timeline.c (clutter_timeline_skip): Don't
add the frames outside the direction check. (thanks to benoar
on clutter-list for spotting it)
number of milliseconds passed between new-frame events instead of
since new-frame events, thus making sure that the sum of _get_delta's
returned for all new-frame events is equal to total time elapsed.
* clutter/clutter-timeline.h:
* clutter/clutter-timeline.c
(timeline_timeout_func),
(clutter_timeline_get_delta): Add a function for retrieving
the number of frames and the time (in milliseconds) elapsed
since the last timeline ::new-frame signal. This can be useful
for implementing a physics engine or just for knowing how if
and how many frames have been skipped.
* clutter/clutter-timeline.[ch]: Add ClutterTimeline:direction
property, defining the direction (forward or backward) of the
timeline.
* tests/test-timeline.c: Test the direction property.
* clutter.symbols: Update exported symbols
* clutter/clutter-timeline.[ch]: Added ClutterTimeline:duration,
a property for setting the duration of a timeline in milliseconds.
The property comes with accessors and a new constructor. The
frame rate used is the default value.
* clutter/clutter-private.h:
* clutter/clutter-main.[ch]: Add clutter_get_default_frame_rate()
and clutter_set_default_frame_rate(); these two functions control
the default frame rate to be used when creating timelines. Currently
is set to 60 frames-per-second.
Emit the ClutterTimeline::new-frame signal only if we arrive there with an
active timeout source. Also, make sure to take a reference on the timeout
when emitting signals.
If the timeline is advancing of zero frames, bump it up to one frame. (bug
471, Rob Bradford)
If the user called clutter_timeline_pause() while in the ::new-frame handler
the timeout is removed and the timeline is reset, while the correct behaviour
should be to simply return. (#371, Johan Bilien)
If we skipped the last frames and we ended up over the frame number, emit
the ::new-frame signal with the last frame before emitting the ::completed
signal.
Remove the call to clutter_timeline_stop() when reaching the end of the
timeline: it was used just to remove the timeout source and it emitted the
::paused signal, which doesn't make any sense. Also rewind the timeline
after emitting the ::completed signal, so that calling get_current_frame()
in the ::completed signal handlers still work.
All the ClutterTimeline share a ClutterTimeoutPool by default. This might
cause problems if an application is using a heavily threaded library that
does not play nicely with the main loop (like libneon). If this is the
case, using the CLUTTER_TIMELINE environment variable set to "no-pool"
makes the ClutterTimeline objects discard the pool and allocate a slice
of the main loop.
Use a per-class timeout pool into ClutterTimeline so that every timeline
instance will use a pooled timeout function to execute the tick. This
should make multiple timelines not starve the main loop.