mirror of
https://github.com/brl/mutter.git
synced 2024-11-27 02:20:43 -05:00
3540d222e1
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.
115 lines
3.9 KiB
C
115 lines
3.9 KiB
C
/*
|
|
* Clutter.
|
|
*
|
|
* An OpenGL based 'interactive canvas' library.
|
|
*
|
|
* Copyright (C) 2010 Intel Corporation.
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
* Author:
|
|
* Emmanuele Bassi <ebassi@linux.intel.com>
|
|
*/
|
|
|
|
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
|
#error "Only <clutter/clutter.h> can be included directly."
|
|
#endif
|
|
|
|
#ifndef __CLUTTER_EFFECT_H__
|
|
#define __CLUTTER_EFFECT_H__
|
|
|
|
#include <clutter/clutter-actor-meta.h>
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
#define CLUTTER_TYPE_EFFECT (clutter_effect_get_type ())
|
|
#define CLUTTER_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_EFFECT, ClutterEffect))
|
|
#define CLUTTER_IS_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_EFFECT))
|
|
#define CLUTTER_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_EFFECT, ClutterEffectClass))
|
|
#define CLUTTER_IS_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_EFFECT))
|
|
#define CLUTTER_EFFECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_EFFECT, ClutterEffectClass))
|
|
|
|
typedef struct _ClutterEffect ClutterEffect;
|
|
typedef struct _ClutterEffectClass ClutterEffectClass;
|
|
|
|
/**
|
|
* ClutterEffect:
|
|
*
|
|
* The #ClutterEffect structure contains only private data and should
|
|
* be accessed using the provided API
|
|
*
|
|
* Since: 1.4
|
|
*/
|
|
struct _ClutterEffect
|
|
{
|
|
/*< private >*/
|
|
ClutterActorMeta parent_instance;
|
|
};
|
|
|
|
/**
|
|
* ClutterEffectClass:
|
|
* @pre_paint: virtual function
|
|
* @post_paint: virtual function
|
|
*
|
|
* The #ClutterEffectClass structure contains only private data
|
|
*
|
|
* Since: 1.4
|
|
*/
|
|
struct _ClutterEffectClass
|
|
{
|
|
/*< private >*/
|
|
ClutterActorMetaClass parent_class;
|
|
|
|
/*< public >*/
|
|
gboolean (* pre_paint) (ClutterEffect *effect);
|
|
void (* post_paint) (ClutterEffect *effect);
|
|
|
|
gboolean (* get_paint_volume) (ClutterEffect *effect,
|
|
ClutterPaintVolume *volume);
|
|
|
|
/*< private >*/
|
|
void (* _clutter_effect0) (void);
|
|
void (* _clutter_effect1) (void);
|
|
void (* _clutter_effect2) (void);
|
|
void (* _clutter_effect3) (void);
|
|
void (* _clutter_effect4) (void);
|
|
void (* _clutter_effect5) (void);
|
|
void (* _clutter_effect6) (void);
|
|
void (* _clutter_effect7) (void);
|
|
};
|
|
|
|
GType clutter_effect_get_type (void) G_GNUC_CONST;
|
|
|
|
/*
|
|
* ClutterActor API
|
|
*/
|
|
|
|
void clutter_actor_add_effect (ClutterActor *self,
|
|
ClutterEffect *effect);
|
|
void clutter_actor_add_effect_with_name (ClutterActor *self,
|
|
const gchar *name,
|
|
ClutterEffect *effect);
|
|
void clutter_actor_remove_effect (ClutterActor *self,
|
|
ClutterEffect *effect);
|
|
void clutter_actor_remove_effect_by_name (ClutterActor *self,
|
|
const gchar *name);
|
|
GList * clutter_actor_get_effects (ClutterActor *self);
|
|
ClutterEffect *clutter_actor_get_effect (ClutterActor *self,
|
|
const gchar *name);
|
|
void clutter_actor_clear_effects (ClutterActor *self);
|
|
|
|
G_END_DECLS
|
|
|
|
#endif /* __CLUTTER_EFFECT_H__ */
|