Commit Graph

4957 Commits

Author SHA1 Message Date
Robert Bragg
f8a6e36f1b texture: Forward queue redraw/relayout for fbos
When clutter_texture_new_from_actor is use we need to track when the
source actor queues a redraw or a relayout so we can also queue a redraw
or relayout for the texture actor.
2010-09-29 15:12:57 +01:00
Robert Bragg
1ea7145efc Queue clipped redraws work in terms of paint volumes
There is an internal _clutter_actor_queue_redraw_with_clip API that gets
used for texture-from-pixmap to minimize what we redraw in response to
Damage events. It was previously working in terms of a ClutterActorBox
but it has now been changed so an actor can queue a redraw of volume
instead.

The plan is that clutter_actor_queue_redraw will start to transparently
use _clutter_actor_queue_redraw_with_clip when it can determine a paint
volume for the actor.
2010-09-29 15:12:57 +01:00
Robert Bragg
f3bffe5cab blur-effect: fix paint volume padding
For the blur effect we use a BLUR_PADDING constant to pad out the volume
of the source actor on the x and y axis. Previously we were offsetting
the origin negatively using BLUR_PADDING and then adding BLUR_PADDING
to the width and height, but we should have been adding 2*BLUR_PADDING
instead.
2010-09-29 15:12:57 +01:00
Robert Bragg
f60703cb1d debug: CLUTTER_DEBUG_REDRAWS: disable clipped redraws
This ensures that clipped redraws are disabled when using
CLUTTER_PAINT=redraws. This may seem unintuitive given that this option
is for debugging clipped redraws, but we can't draw an outline outside
the clip region and anything we draw inside the clip region is liable to
leave a trailing mess on the screen since it won't be cleared up by
later clipped redraws.
2010-09-29 15:12:57 +01:00
Robert Bragg
066220f983 paint volumes: CLUTTER_PAINT=paint-volumes debug option
This adds a debug option to visualize the paint volumes of all actors.
When CLUTTER_PAINT=paint-volumes is exported in the environment before
running a Clutter application then all actors will have their bounding
volume drawn in green with a label corresponding to the actors type.
2010-09-29 15:12:57 +01:00
Robert Bragg
3540d222e1 paint volumes: another pass at the design
This is a fairly extensive second pass at exposing paint volumes for
actors.

The API has changed to allow clutter_actor_get_paint_volume to fail
since there are times - such as when an actor isn't a descendent of the
stage - when the volume can't be determined. Another example is when
something has connected to the "paint" signal of the actor and we simply
have no way of knowing what might be drawn in that handler.

The API has also be changed to return a const ClutterPaintVolume pointer
(transfer none) so we can avoid having to dynamically allocate the
volumes in the most common/performance critical code paths. Profiling was
showing the slice allocation of volumes taking about 1% of an apps time,
for some fairly basic tests. Most volumes can now simply be allocated on
the stack; for clutter_actor_get_paint_volume we return a pointer to
&priv->paint_volume and if we need a more dynamic allocation there is
now a _clutter_stage_paint_volume_stack_allocate() mechanism which lets
us allocate data which expires at the start of the next frame.

The API has been extended to make it easier to implement
get_paint_volume for containers by using
clutter_actor_get_transformed_paint_volume and
clutter_paint_volume_union. The first allows you to query the paint
volume of a child but transformed into parent actor coordinates. The
second lets you combine volumes together so you can union all the
volumes for a container's children and report that as the container's
own volume.

The representation of paint volumes has been updated to consider that
2D actors are the most common.

The effect apis, clutter-texture and clutter-group have been update
accordingly.
2010-09-29 15:12:57 +01:00
Robert Bragg
48a24a2e08 actor-box: Adds clutter_actor_box_union utility
When using ClutterActorBoxs for representing clip regions it can be
convenient to be able to union multiple boxes together.
2010-09-29 15:12:57 +01:00
Robert Bragg
2da127dcff texture: size fbos using clutter_actor_get_paint_box
Previously we used the transformed allocation but that doesn't take
into account actors with depth which may be projected outside the
area covered by the transformed allocation.
2010-09-29 15:12:57 +01:00
Emmanuele Bassi
044809edb8 docs: Add PaintVolume to the API reference
And document the various related functions.
2010-09-29 15:12:57 +01:00
Emmanuele Bassi
a6e5ecebe3 blur-effect: Add padding to account for the blur
The blur effect will sample pixels on the edges of the offscreen buffer,
so we want to add a padding to avoid clamping the blur.

We do this by creating a larger target texture, and updating the paint
volume of the actor during paint to take that padding into account.
2010-09-29 15:12:57 +01:00
Emmanuele Bassi
5d97ca5f87 offscreen-effect: Use the paint box to size the FBO
We should be using the real, on-screen, transformed size of the actor to
size and position the offscreen buffer we use to paint the actor for an
effect.
2010-09-29 15:12:57 +01:00
Emmanuele Bassi
25abdf09b7 effect: Allow any effect to override the paint volume
An Effect implementation might override the paint volume of the actor to
which it is applied to. The get_paint_volume() virtual function should
be added to the Effect class vtable so that any effect can get the
current paint volume and update it.

The clutter_actor_get_paint_volume() function becomes context aware, and
does the right thing if called from within a ClutterEffect pre_paint()
or post_paint() implementation, by allowing all effects in the chain up
to the caller to modify the paint volume.
2010-09-29 15:12:56 +01:00
Emmanuele Bassi
94ce747f83 actor: Allow querying the paint volume
An actor has an implicit "paint volume", that is the volume in 3D space
occupied when painting itself.

The paint volume is defined as a cuboid with the origin placed at the
top-left corner of the actor; the size of the cuboid is given by three
vectors: width, height and depth.

ClutterActor provides API to convert the paint volume into a 2D box in
screen coordinates, to compute the on-screen area that an actor will
occupy when painted.

Actors can override the default implementation of the get_paint_volume()
virtual function to provide a different volume.
2010-09-29 15:12:56 +01:00
Emmanuele Bassi
27aebb5c9d cally: Do not use deprecated functions
The function g_strcasecmp() has been deprecated since GLib 2.2.
2010-09-29 14:13:51 +01:00
Emmanuele Bassi
e798047ca0 animator: Code style fixes 2010-09-29 11:44:46 +01:00
Stephen Kennedy
3fe10e0bb1 ClutterAnimator doesn't ref timeline properly
ClutterAnimator currently has a number of bugs related to its
referencing of its internal timeline.

1) The default timeline created in _init is not unreffed (it appears the
programmer has wrongly thought ClutterTimeline has a floating reference
based on the use of g_object_ref_sink in _set_timeline)

2) The timeline and slave_timeline vars are unreffed in finalize instead
of dispose

3) The signal handlers set up in _set_timeline are not disconnected when
the animator is disposed

http://bugzilla.clutter-project.org/show_bug.cgi?id=2347

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-09-29 10:57:39 +01:00
Neil Roberts
d0cab85673 Add a conformance test for clutter_actor_contains
This adds a conformance test for clutter_actor_contains to assert that
it gets the expected results for the given tree of actors.
2010-09-28 15:21:49 +01:00
Neil Roberts
3068520752 Simplify the loop for clutter_actor_contains
This reorganizes the loop for clutter_actor_contains so that it is a
for loop rather than a while loop. Although this is mostly just
nitpicking, I think this change could make the loop slightly faster if
not optimized because it doesn't perform the self == descendant check
twice and it is clearer.
2010-09-28 15:21:49 +01:00
Neil Roberts
99adb88e9b Document what happens when self==descendant in clutter_actor_contains
The documentation for clutter_actor_contains didn't specify what
happens when self==descendant. A strict reading of it might lead you
to think that it would return FALSE because in that case the
descendant isn't an immediate child or a deeper descendant. The code
actually would return TRUE. I think this is more useful so this patch
fixes the docs rather than the code.
2010-09-28 15:21:49 +01:00
Emmanuele Bassi
bba1424a44 Post-branch version bump to 1.5.1 2010-09-27 16:46:26 +01:00
Emmanuele Bassi
1971581dfa doap: Remove mallum from the maintainers list 2010-09-26 18:48:04 +01:00
Emmanuele Bassi
43e85836b4 actor: Dispose all constrains
We are leaking the ClutterMetaGroup with all the constraints when
disposing an Actor.
2010-09-26 16:52:58 +01:00
Emmanuele Bassi
fda1f3a8ba json: Allow NULL as a value for strings, arrays and objects
We should not warn when asking for a string, array or object if the
contents were 'null'.

Patch from JSON-GLib.
2010-09-25 20:23:41 +01:00
Emmanuele Bassi
8fe9f3a37d test-clutter-units: Force a known resolution to avoid fuzzyness
Instead of taking the current resolution, whatever it may be, use a
known DPI. This should alleviate fuzzyness and create consistent
results.
2010-09-24 16:21:06 +01:00
Emmanuele Bassi
51a4af9262 Post-release version bump to 1.4.1 2010-09-24 15:25:15 +01:00
Emmanuele Bassi
1f3f718a50 Release 1.4.0 (stable) 2010-09-24 15:07:17 +01:00
Elliot Smith
34407c14b0 cookbook: Reduce complexity of sample ClutterAnimator code for recipe
http://bugzilla.clutter-project.org/show_bug.cgi?id=2341

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-09-24 14:48:53 +01:00
Øyvind Kolås
4640dad6af animator: fix removal of all keys
When removing all keys in a ClutterAnimator, the hash table with
object/property name pairs went out of sync. This change makes
the animator always clear this hash table upon key-removal; and
refreshing it if the animator's timeline is running.

Fixes bug #2335
2010-09-24 13:30:38 +01:00
Robert Bragg
f834b8b138 material: Don't prune ancestry if it owns some layers
Each time a material property changes we look to see if any of its
ancestry has become redundant and if so we prune that redundant
ancestry.

There was a problem with the logic that handles this though because we
weren't considering that a material which is a layer state authority may
still defer to ancestors to define the state of individual layers.

For example a material that derives from a parent with 5 layers can
become a STATE_LAYERS authority by simply changing it's ->n_layers count
to 4 and in that case it can still defer to its ancestors to define the
state of those 4 layers.

This patch checks first if a material is a layer state authority and if
so only tries to prune its ancestry if it also *owns* all the individual
layers it depends on. (I.e. if g_list_length
(material->layer_differences) != material->n_layers then it's not safe
to try pruning its ancestry!)

http://bugzilla-attachments.gnome.org/attachment.cgi?id=170907
2010-09-24 00:12:14 +01:00
Jammy Zhou
ffd5c32209 cogl-framebuffer.c: GL_DEPTH_STENCIL not supported in gles
There is GL_INVALID_ENUM error for GL_DEPTH_STENCIL when call
glRenderbufferStorage() with OpenGL ES backend. So enable this
only for OpenGL backend.

Signed-off-by: Robert Bragg <robert@linux.intel.com>
2010-09-23 17:33:11 +01:00
Emmanuele Bassi
4533edeef0 cookbook: Further clarification of the anchor point
Make sure to add a note on the behaviour of the anchor point. Ideally,
it would be nice to have a recipe about it in the Actor section.
2010-09-23 17:03:17 +01:00
Elliot Smith
ce0bd4e26c cookbook: Recipe for "moving actors"
This recipe explains how to use the three animation
approaches (implicit, State, Animator) to animate movement
of actors.

Includes some guidelines about which approach to use when, with
a full code example for each approach.

The discussion section covers some subtleties around animated
movement; namely: moving actors out of their containers; anchor
points and movement; moving in the depth axis; interactions
between animated movement and constraints.
2010-09-23 16:24:21 +01:00
Elliot Smith
b8d36a364f cookbook: Fixed markup in animations section
Fixed indentation on some mark-up in an unrelated recipe.
2010-09-23 16:24:21 +01:00
Elliot Smith
6307876552 cookbook: Example of animated movement with ClutterAnimator
Added an example showing how to randomly animate the
simultaneous movement on the x axis of three actors,
using ClutterAnimator.
2010-09-23 16:24:21 +01:00
Elliot Smith
f1b2f1e8c5 cookbook: Example of animated movement with ClutterState
Added an example showing how to move two actors between
two states (one minimised, one maximised) using ClutterState
to do the movement. Also shows how movement can be mixed
with other animation (in this case, scaling).
2010-09-23 16:24:21 +01:00
Elliot Smith
5bca30300e cookbook: Example of simple movement animation
Added example showing how to move an actor in one of the
three axes (x,y,z) in response to a button event on the
actor.
2010-09-23 16:24:21 +01:00
Emmanuele Bassi
884ead03e1 Add some more argument validation
This is all internal, so we shouldn't need it; unfortunately, it seems
we're passing invalid data internally, so for the time being catching
inconsistencies should at least emit a warning for us to backtrace.
2010-09-23 16:17:24 +01:00
Robert Bragg
f66e1de0e3 actor: don't pass NULL to _stage_set_pick_buffer_valid
This adds a check in clutter_actor_real_queue_redraw after calling
_clutter_actor_get_stage_internal to check in case the actor doesn't yet
have an associated stage so we can avoid passing a NULL stage pointer to
_clutter_stage_set_pick_buffer_valid which could cause a crash.
2010-09-23 16:03:06 +01:00
Robert Bragg
37d0dbe6b2 docs: Put deprecated Cogl symbols into new section
This adds a "Cogl deprecated API" chapter to the Cogl reference manual
so we can group all the documentation for deprecated symbols together
instead of having them clutter up the documentation of symbols we would
rather developers used.
2010-09-23 15:53:30 +01:00
Robert Bragg
779c780500 docs: update the overview paragraph for Cogl
Instead of describing OpenGL as "a low level OpenGL abstraction
library" it is now summarised as "modern 3D graphics API".
2010-09-23 15:53:30 +01:00
Robert Bragg
2bc739ab44 docs: cogl-texture-3d wasn't listed as experimental
The CoglTexture3D API is only available when defining
COGL_ENABLE_EXPERIMENTAL_API so it should be listed in the experimental
section of the API reference.
2010-09-23 15:53:30 +01:00
Robert Bragg
a89b8f4304 docs: Use "Cogl" not "COGL" in Cogl API reference
Cogl isn't an acronym so we should use "Cogl" instead of "COGL" in
our documentation.
2010-09-23 15:53:29 +01:00
Emmanuele Bassi
4c8867ea07 table-layout: Invert row/column in arguments
*** This is an API change ***

The general pattern for axis-aligned arguments is:

        x argument
        y argument

If we consider columns an x-aligned argument, and row a y-aligned
argument, then we need to update the TableLayout functions to be:

        column
        row

and not:

        row
        column
2010-09-23 15:17:58 +01:00
Emmanuele Bassi
462d4c832a docs: Mention Uncrustify in the coding style document 2010-09-23 13:36:56 +01:00
Emmanuele Bassi
5335689340 Update the uncrustify configuration 2010-09-23 13:36:41 +01:00
Emmanuele Bassi
46357db389 Add uncrustify configuration file
Patch submission should include a pass of uncrustify to conform to the
coding style.

Uncrustify is not perfect - but at least it's a start.
2010-09-23 13:00:06 +01:00
Robert Bragg
56929942a8 picking: Fix tracking of pick buffer validity
We have an optimization to track when there are multiple picks per
frame so we can do a full render of the pick buffer to reduce the
number of pick renders for a static scene.

There was a problem though in that we were tracking this information in
the ClutterMainContext, but conceptually this doesn't really make sense
because the pick buffer is associated with a stage framebuffer and there
can be multiple stages for one context.

This patch moves the state tracking to ClutterStage.
2010-09-23 11:45:27 +01:00
Robert Bragg
b2a56c9cda Revert "picking: Fix tracking of pick buffer validity"
This reverts commit d7e86e2696.

This was a half baked patch that was pushed a bit early since it broke
test-texture-pick-with-alpha + the commit message refers to a change on
the wip/paint-box branch that hasn't happened yet.
2010-09-23 11:45:04 +01:00
Robert Bragg
d7e86e2696 picking: Fix tracking of pick buffer validity
We have an optimization to track when there are multiple picks per
frames so we can do a full render of the pick buffer to reduce the
number of pick renders for a static scene.

There were two problems with how we were tracking this state though.
Firstly we were tracking this information in the ClutterMainContext, but
conceptually this doesn't really make sense because the pick buffer is
associated with a stage framebuffer and there can be multiple stages for
one context.  Secondly - since the change to how redraws are queued - we
weren't marking the pick buffer as invalid when a queuing a redraw, we
were only marking the buffer invalid when signaling/finishing the
queue-redraw process, which is now deferred until just before a paint.
This meant using clutter_stage_get_actor_at_pos after a scenegraph
change could give a wrong result if it just read from an existing (but
technically invalid) pick buffer.

This patch moves the state tracking to ClutterStage, and ensures the
buffer is invalidated in _clutter_stage_queue_actor_redraw.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2283

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-09-23 11:14:56 +01:00
Emmanuele Bassi
60c9dc25df box-layout: Small cleanups 2010-09-22 14:22:23 +01:00