1
0
Fork 0
Commit graph

1321 commits

Author SHA1 Message Date
Emmanuele Bassi
db3d2e9568 Merge branch 'animatable-iface' into animation-improvements
* animatable-iface:
  [docs] Add ClutterAnimatable to the API reference
  Add license notice to ClutterAnimation files
  [animation] Use ClutterAnimatable inside Animation
  [animation] Add ClutterAnimatable
2009-01-08 13:38:51 +00:00
Emmanuele Bassi
d340de8e00 Add license notice to ClutterAnimation files 2009-01-08 13:18:00 +00:00
Emmanuele Bassi
068ba1caf0 [animation] Extend ClutterAnimation support to all objects
Instead of limiting the use of ClutterAnimation to ClutterActor
instances, relax the constraint to include all GObject classes.

ClutterAnimation is not using actor-specific API, since it is
only using properties.

The only actor-based API is the clutter_actor_animate() family
of functions.
2009-01-08 13:13:39 +00:00
Emmanuele Bassi
60cfa5edb2 [animation] Use ClutterAnimatable inside Animation
ClutterAnimation should check if the object is implementing the
Animatable interface, and if so delegate to it the computation
of the value along the interval initial and final value, depending
on the progress.
2009-01-08 12:59:16 +00:00
Emmanuele Bassi
24808e20b3 [animation] Add ClutterAnimatable
The ClutterAnimatable interface is meant to be used by GObject
classes to override the value computation for an animatable
property within the boundaries of an interval.

It is composed of a single virtual function, animate_property();
its implementation will receive the ClutterAnimation used to
animate the object; the property name; the initial and final
interval values; and the progress factor as retrieved by the
Alpha object bound to the Animation instance.
2009-01-08 12:56:46 +00:00
Emmanuele Bassi
28b0f432b7 [animation] Allow registering custom progress function
A ClutterInterval can change the way the progress is computed
by subclassing and overriding the ::compute_value() virtual function.

It should also be possible to register a custom progress function
in the same way it is possible to register a custom transformation
function between two GValues.

This commit adds an internal, global hash table that maintains a
GType <-> progress function association; each ClutterInterval
will check if there is a progress function registered for the
GType of the initial and final values of the interval and, if
it has been found, it will call it to compute the value of the
interval depending on the progress factor.
2009-01-08 11:15:09 +00:00
Emmanuele Bassi
ff48c3ef7c [animation] Interval::compute_value should return a boolean
If the computation of the interval value depending on the progress
was not successful, ClutterInterval::compute_value() should return
this information to the caller.
2009-01-07 18:18:59 +00:00
Emmanuele Bassi
854cf5d499 Animate ClutterColor properties
We can animate a ClutterColor-based property between an interval
of two colors by simply applying the factor to each color component.
2009-01-06 12:53:30 +00:00
Neil Roberts
ff73fe3e1f Fix some animation_set_* functions so they cope if the value is the same
The following functions are fixed:

clutter_animation_set_actor
clutter_animation_set_timeline
clutter_animation_set_alpha

This is related to bug 1392 which discusses the problem for
behaviour_set_alpha.
2009-01-05 13:19:40 +00:00
Neil Roberts
39f4848b93 Fix some *_set functions so they work if the object is the same value
Bug 1392 - behaviour_set_alpha set same alpha twice lead to warning
and destroy the input alpha

The following functions are fixed:

clutter_actor_set_shader
clutter_alpha_set_timeline
clutter_behaviour_set_alpha
clutter_clone_texture_set_parent_texture

They either now reference the new value before destroying the old
value, or just return immediately if the values are the same.
2009-01-05 13:19:40 +00:00
Neil Roberts
62cfc6487f Fix setting the mode on a ClutterAlpha created with animation_set_alpha(NULL)
It previously attempted to set the mode on the alpha using
clutter_animation_set_mode_internal, but this was setting the mode on
priv->alpha. At that point in the code priv->alpha is always NULL.

clutter_animation_set_mode_internal now takes a parameter to specify
which alpha to modify.
2009-01-05 12:52:46 +00:00
Neil Roberts
2ed60a5270 In clutter_alpha_set_mode, set priv->mode after setting the func
Otherwise the call to clutter_alpha_set_func sets the mode back to
CLUTTER_CUSTOM_MODE so clutter_alpha_get_mode won't get back the same
value that was set.
2009-01-05 12:47:10 +00:00
Emmanuele Bassi
fd2d78918b Merge branch 'units-rework'
* units-rework:
  [texture] Do not mix fixed point and units values
  [tests] Fix the actor detection
  [units] Do not use fixed point and units interchangeably
2009-01-05 11:11:10 +00:00
Robert Bragg
cb569a5443 White space clean up across a number of files (only removing trailing spaces)
Removed trailing white space from the following files:
- clutter-clone-texture.c
- clutter-texture.c
- clutter-texture.h
- cogl/cogl-texture.h
- cogl/gl/cogl-context.c
- cogl/gl/cogl-texture.c
- cogl/gl/cogl-context.h
2008-12-24 00:48:32 +00:00
Emmanuele Bassi
c9cdf1ef0a Fix an empty block
Remove a stray ';' that prevented the get_bounds() method of the
ClutterBehaviourRotate to correctly return the start angle value.
2008-12-23 20:55:35 +00:00
Owen Taylor
6a980793c6 Return something reasonable from clutter_x11_handle_event()
Instead of returning CLUTTER_X11_FILTER_CONTINUE always from
clutter_x11_handle_event() return CLUTTER_X11_FILTER_REMOVE if
the event was on a stage and translated to a ClutterEvent.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2008-12-22 13:11:59 +00:00
Robert Bragg
3a6ffe3b7d [build] Replaces use of #include <cairo/cairo.h> with #include <cairo.h>
The cairo pkg-config is crafted such that #include <cairo.h> should be used.
If building with a private build of cairo installed to a custom prefix
<cairo/cairo.h> can cause an un-intended cairo header to be picked up during
compilation due to /usr/include being in the header search path.
2008-12-21 21:52:50 +00:00
Emmanuele Bassi
4e493d1937 Avoid masking math.h exported variables
Our beloved math.h exports, from bits/mathcalls.h, a bare "y1" symbol.
Apparently, it's unthinkable for code including <math.h> to also declare
arguments or variable named "y0", "y1" and "yn".

Anyway, the quick fix already used elsewhere in Clutter's codebase is
to rename the colliding variables "y_0", "y_1" and "y_n" - and
obviously everything similar to them as well, using the same pattern.
2008-12-19 18:21:36 +00:00
Emmanuele Bassi
c93cd4a096 [docs] Documentation fixes for CairoTexture
Sync up the arguments name inside the gtk-doc annotations with their
name inside the function declaration in the header file.
2008-12-19 17:48:30 +00:00
Emmanuele Bassi
2f23003425 Whitespace fixes
Let's try to honour the coding style document, now that we have one.
2008-12-19 17:44:24 +00:00
Emmanuele Bassi
81541e6940 [docs] Parameter naming fixes
The name of the parameter in the header and the one in the gtk-doc
annotation on top of a function must match.

Unfortunately, there is an index() function declared inside strings.h
which makes gcc complain for the "index" argument as soon as we
enable the extra compiler flags we use when distchecking.

Hence, we need to rename "index" to "index_" in the header and in
the source files.
2008-12-19 17:41:44 +00:00
Emmanuele Bassi
8d98c28dfa Merge branch 'cairo-texture'
* cairo-texture:
  [cairo-texture] Remove the construct only restriction on surface size
  [cairo-texture] Silently discard 0x0 surfaces
  Re-indent ClutterPath header
  Add a test case for the new cairo path functions
  Add clutter_path_to_cairo_path and clutter_path_add_cairo_path
  Warn instead of returning in the IN_PAINT check
  Small documentation fixes
  Print a warning when creating a cairo_t while painting
  Do not set the IN_PAINT flag inside the Stage paint
  Set the IN_PAINT private flag
  [docs] Add ClutterCairoTexture to the API reference
  Add ClutterCairoTexture
  Require Cairo as a Clutter dependency

Conflicts:

  Fix merge conflict in clutter/clutter-path.h
2008-12-19 16:44:40 +00:00
Neil Roberts
64de0411ea [cairo-texture] Remove the construct only restriction on surface size
It is possible to change the surface size after construction with
clutter_cairo_texture_set_surface_size so it doesn't seem right to
restrict changing the properties.

clutter_cairo_texture_resize_surface_internal is called in a handler
for the notify signal. It is called there rather than directly in the
set_property handler so that changing both properties in a single
g_object_set will only cause one resize. The constructed override is
no longer needed.

resize_surface_internal will now bail out if the size of the surface
is already the right size.
2008-12-19 15:35:14 +00:00
Emmanuele Bassi
cf5d69139d [texture] Do not mix fixed point and units values
Like we did for ClutterActor in commit cdb78ec4, fix ClutterTexture
usage of CoglFixed and ClutterUnit values without conversion between
the two types.
2008-12-19 13:42:17 +00:00
Emmanuele Bassi
cdb78ec4d2 [units] Do not use fixed point and units interchangeably
Clutter units are, at the moment, implemented as a value in fixed point
notation using the same format as CoglFixed. This is, though, an
implementation detail. For this reason, units should not be treated as
CoglFixed values and should be converted to and from fixed point using
the provided macros.

This commit updates the usage of units and fixed point values in
ClutterActor and rationalises some of the transformation code that
heavily relied on the equivalency between them.
2008-12-19 12:53:57 +00:00
Robert Bragg
5e0daa8ecd Improves tfp performance on Nvidia
Some drivers (e.g. Nvidia) get upset if you try to create multiple glx pixmaps
for the same server side pixmap object, even though you might have unique
client side names, we now avoid hitting this problem by destroying the current
glx pixmap early within clutter_glx_texture_pixmap_create_glx_pixmap.
2008-12-18 17:54:35 +00:00
Neil Roberts
4168ed09de Fix calculation in clutter_cubic_bezier
The calculation for cubic bezier curves had an extra multiplication by
3 which was causing the curve to go over 1.0 very quickly. This had
the affect of making test-animation appear to complete much before the
completed signal is emitted.
2008-12-18 12:20:46 +00:00
Neil Roberts
2bf815131a [clutter-interval] Fix calculation of interval for unsigned types
The patch makes it cast to double before subtracting the original
value from the target value. Otherwise if the target value is less
than the original value then the subtraction will overflow and the
factor will be multiplied by a very large number instead of the
desired interval.

The problem is demonstrable using the border-width property of
ClutterRectangle.
2008-12-17 19:26:24 +00:00
Emmanuele Bassi
e130e0c9b3 [cairo-texture] Silently discard 0x0 surfaces
The current CairoTexture can be created with a surface size of 0
by 0 pixels, but a warning will be printed.

Worse, the surface can be resized to be 0 by 0 pixels without a
warning. The :surface-width and :surface-height properties accept
a minimum value of 0, and not check is performed on either the
constructor or set_surface_size() parameters to enforce the "greater
than zero" rule.

The correct and consistent behaviour is to allow a 0 by 0 pixels
surface size everywhere; inside surface_resize_internal(), the
current surface will be destroyed and if either :surface-width or
:surface-height are set to 0, the resizing terminates.

Attempting to create a Cairo context from a CairoTexture with
either :surface-width or :surface-height set to 0 will result in
a warning.

This allows:

  - creating a CairoTexture with :surface-width or :surface-height
    set to zero and delaying the surface resize at a later point;
  - resizing the surface to 0 by 0 pixels to destroy the image
    surface used internally;
  - increase the consistency in the usage of CairoTexture.
2008-12-17 15:58:11 +00:00
Neil Roberts
140e4e1be2 Minor fix to documentation for clutter_actor_get_anchor_point
In both versions of clutter_actor_get_anchor_point the description of
the @anchor_y parameter was slightly wrong in different ways.
2008-12-17 15:05:08 +00:00
Neil Roberts
ff92cc9766 Convert clutter_path_get_position to take a gdouble instead of an alpha value
The gdouble value represents an interval along the path from 0.0 to
1.0. This makes more sense than using an alpha value because paths are
not directly related to ClutterAlphas and the rest of the Clutter API
tends to expose gdouble arguments.
2008-12-16 15:39:53 +00:00
Emmanuele Bassi
ca310d49ca Re-indent ClutterPath header
Match the indentation and style of the other Clutter headers.
2008-12-15 15:00:37 +00:00
Emmanuele Bassi
f6feed4386 Fix a typo in the ClutterParamSpecFixed declaration
The ClutterParamSpecFixed constructor is declared in the header
as taking ClutterFixed values, but the implementation takes
ClutterUnit values instead. This obviously works because fixed
and units are exactly the same type.

This commit fixes the wrong parameters.
2008-12-15 14:29:59 +00:00
Emmanuele Bassi
b2f4363d95 Remove a double semi-colon typo
Fixes bug 1351 - Extra ; in clutter-behaviour-ellipse.c

Thanks to Haakon Sporsheim.
2008-12-13 11:53:03 +00:00
Neil Roberts
4e0073cd50 Fix the gtk-doc for some properties in ClutterActor
Some of the properties were specified as ClutterActor::property (with
two colons) but gtk-doc expects one colon so the documentation is not
parsed.
2008-12-12 22:47:46 +00:00
Neil Roberts
cd1992181c Fix the definition of clutter_actor_set_scale to match the declaration
Trivial change to declare the parameter as gdouble instead of double
so that it matches the header.
2008-12-12 17:38:53 +00:00
Neil Roberts
a462d19e14 Add clutter_path_to_cairo_path and clutter_path_add_cairo_path
See bug #1325.

Added doc for new cairo path functions to clutter-sections.txt
2008-12-12 14:31:43 +00:00
Emmanuele Bassi
0e1a3c2124 Warn instead of returning in the IN_PAINT check
It's conceivable that a warning should be deemed enough, instead
of just returning a NULL cairo_t when creating a context for the
CairoTexture actor.
2008-12-12 11:42:16 +00:00
Emmanuele Bassi
4d34872dea Small documentation fixes
Fix the CairoTexture description, and some of the comments inside
the code, especially with regards to the alpha channel unpremultiplication
that we have to perform each time we upload the image surface to
GL.
2008-12-11 15:51:24 +00:00
Emmanuele Bassi
cf9dea7cf6 Print a warning when creating a cairo_t while painting
If you create a Cairo context in the middle of a paint run and then
you destroy it, the CairoTexture will have to upload the contents of
the image surface to the GL pipeline. This usually leads to slow
downs and general performance degradation.

ClutterCairoTexture will warn to the console if Clutter has been
compiled with the debug messages and if create() or create_region()
are called while an actor is in the middle of a paint.
2008-12-11 15:48:43 +00:00
Emmanuele Bassi
1b88122873 Do not set the IN_PAINT flag inside the Stage paint
Since the CLUTTER_ACTOR_IN_PAINT private flag is set as part
of the paint process by clutter_actor_paint(), there is no
need to set it inside the ClutterStage paint function.
2008-12-11 15:41:25 +00:00
Emmanuele Bassi
3f2c9fe6b3 Set the IN_PAINT private flag
When calling clutter_actor_paint() we should be setting the
CLUTTER_ACTOR_IN_PAINT private flag. This allows signalling
to each Actor subclass that we are effectively in the middle
of a paint sequence. Actor subclasses can check for this
private flag and act based on its presence - for instance to
avoid recursion, or to detect performance degradation cases.
2008-12-11 15:39:28 +00:00
Emmanuele Bassi
e934ad03ca Add ClutterCairoTexture
Move the ClutterCairo actor from a separate library to an in-tree
actor.

ClutterCairoTexture is a simple texture subclass that allows you
to retrieve a Cairo context for a private image surface. When the
Cairo context is destroyed it will cause the image surface
contents to be uploaded to a GL texture.

The image surface used is not hardware accelerated.
2008-12-11 15:34:47 +00:00
Emmanuele Bassi
4973b684a6 Resort the main Clutter include file
Just for overall sanity we keep the include file sorted.
2008-12-11 11:11:11 +00:00
Emmanuele Bassi
bc6a107ff6 Do not modify parameters in place
When the apply_transform_to_point() and its relative variant
landed in Clutter 0.3, the initial approach was to modify the
passed vertex as an in-out parameter. This was later dropped
in favour of a more consistent out parameter.

Unfortunately, the implementation never changed: both methods
where modifying the passed vertex with the partial results of
the computations.

This commit copies the contents of the "point" ClutterVertex
argument inside a stack variable and, for good measure, constifies
the argument.

Thanks to Thomas Steinacher for catching this in Python.
2008-12-10 23:00:48 +00:00
Neil Roberts
dc6545ccd1 * clutter/cogl/gl/cogl.c:
* clutter/cogl/gl/cogl-defines.h.in:
	* clutter/cogl/gl/cogl-context.h:
	* clutter/cogl/common/cogl-mesh.c: Rename the glBufferDataSub
	function to glBufferSubData. When calling glXGetProcAddress with
	the former Mesa returns a stub dispatch function which will
	segfault if you try to use it. With NVIDIA it returns NULL so
	_cogl_features_init decides the card doesn't have VBO support.
2008-12-10 12:13:20 +00:00
Neil Roberts
c81a0b3281 Bug 1323 - ClutterBehaviorDepth conflicts with other behaviors
* clutter/clutter-behaviour-ellipse.c (actor_apply_knot_foreach):
	Don't set the depth if there is no x or y tilt. That way it can
	still be used in conjunction with ClutterBehaviourDepth. Thanks to
	Tonny Tzeng.
2008-12-10 11:27:14 +00:00
Emmanuele Bassi
e3dd18dc0c 2008-12-08 Emmanuele Bassi <ebassi@linux.intel.com>
* clutter/clutter-binding-pool.h: Fix the ActivateFunc
	documentation by adding a "return value" annotation.
2008-12-08 14:22:52 +00:00
Emmanuele Bassi
8a537b6299 2008-12-08 Emmanuele Bassi <ebassi@linux.intel.com>
* clutter/Makefile.am:
	* clutter/clutter.h: Add ClutterBindingPool to the build.

	* clutter/clutter-binding-pool.c:
	* clutter/clutter-binding-pool.h: Add ClutterBindingPool, a data
	structure meant to hold (key symbol, modifiers) pairs and associate
	them to a closure. The ClutterBindingPool can be used to install
	key bindings for actors and then execute closures inside the
	key-press-event signal handlers, removing the need for big
	switch() or if() blocks for each key.

	* clutter/clutter-event.c: Consistently use "key symbol" instead
	of "key value".

	* clutter/clutter-event.h: Add more modifier masks.

	* clutter/clutter-marshal.list:

	* tests/conform/Makefile.am:
	* tests/conform/test-binding-pool.c:
	* tests/conform/test-conform-main.c: Add ClutterBindingPool
	conformance test.

	* tests/interactive/Makefile.am:
	* tests/interactive/test-binding-pool.c: Add interactive test (and
	example code) for the ClutterBindingPool usage.
2008-12-08 13:57:10 +00:00
Neil Roberts
008693d8b2 * clutter/clutter-main.c (_clutter_do_pick): Restore the GL_DITHER
state after reading the pixel value instead of before. Suggested
	in bug 1328 thanks to Guy Zadickario.
2008-12-08 12:02:36 +00:00