clutter-actor: Add an 'offscreen-redirect' property
authorNeil Roberts <neil@linux.intel.com>
Mon, 28 Feb 2011 15:05:51 +0000 (15:05 +0000)
committerNeil Roberts <neil@linux.intel.com>
Fri, 13 May 2011 00:46:32 +0000 (01:46 +0100)
commit7f78237ee53c6d1ec1981a2aec47e5aa651923d5
treedfaf91a9dc4b3740022bea164ca6c77e924fe611
parent8df8d4ff0fa667cb25148b451ef754115f5c954b
clutter-actor: Add an 'offscreen-redirect' property

This adds a property which can be used to redirect the actor through
an FBO before painting so that it becomes flattened in an image. The
image can be used as a cache to avoid having to repaint the actor if
something unrelated in the scene changes. It can also be used to
implement correct opacity even if the actor has overlapping
primitives. The property is an enum that takes three values:

CLUTTER_OFFSCREEN_REDIRECT_NEVER: The default behaviour which is to
  never flatten the actor.

CLUTTER_OFFSCREEN_REDIRECT_ALWAYS: The actor is always redirected
  through an FBO.

CLUTTER_OFFSCREEN_REDIRECT_ONLY_FOR_OPACITY: The actor is only
  redirected through an FBO if the paint opacity is not 255. This
  value would be used if the actor wants correct opacity. It will
  avoid the overhead of using an FBO whenever the actor is fully
  opaque.

The property is implemented by installing a ClutterFlattenEffect.
ClutterFlattenEffect is a new internal class which subclasses
ClutterOffscreen to redirect the painting to an FBO. When
ClutterOffscreen paints, the effect sets an opacity override on the
actor so that the image will always contain the actor at full
opacity. The opacity is then applied to the resulting image before
painting it to the stage. This means the actor does not need to be
redrawn while the opacity is being animated.

The effect has a high internal priority so that it will always occur
before any other effects and it gets hidden from the application.
clutter/Makefile.am
clutter/clutter-actor.c
clutter/clutter-actor.h
clutter/clutter-flatten-effect.c [new file with mode: 0644]
clutter/clutter-flatten-effect.h [new file with mode: 0644]
doc/reference/clutter/Makefile.am
doc/reference/clutter/clutter-sections.txt
doc/reference/clutter/offscreen-redirect.png [new file with mode: 0644]