offscreen-effect: Add public accessor for target size

The OffscreenEffect class needs to expose a way for sub-classes to
track the size of FBO it creates, in case it has to do some geometry
deformations like the DeformEffect sub-classes.

Let's move the private symbol we used internally in 1.6 to fix
DeformEffect to the list of public symbols of OffscreenEffect.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2570
This commit is contained in:
Emmanuele Bassi 2011-02-28 14:31:59 +00:00
parent e2b5762571
commit 0c83e6a59a
5 changed files with 39 additions and 14 deletions

View File

@ -184,7 +184,10 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect)
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (effect));
opacity = clutter_actor_get_paint_opacity (actor);
if (!_clutter_offscreen_effect_get_target_size (effect, &width, &height))
/* if we don't have a target size, fall back to the actor's
* allocation, though wrong it might be
*/
if (!clutter_offscreen_effect_get_target_size (effect, &width, &height))
clutter_actor_get_size (actor, &width, &height);
for (i = 0; i < priv->y_tiles + 1; i++)

View File

@ -5,10 +5,6 @@
G_BEGIN_DECLS
gboolean _clutter_offscreen_effect_get_target_size (ClutterOffscreenEffect *effect,
gfloat *width,
gfloat *height);
G_END_DECLS
#endif /* __CLUTTER_OFFSCREEN_EFFECT_PRIVATE_H__ */

View File

@ -476,12 +476,34 @@ clutter_offscreen_effect_create_texture (ClutterOffscreenEffect *effect,
height);
}
/**
* clutter_offscreen_effect_get_target_size:
* @effect: a #ClutterOffscreenEffect
* @width: (out): return location for the target width, or %NULL
* @height: (out): return location for the target height, or %NULL
*
* Retrieves the size of the offscreen buffer used by @effect to
* paint the actor to which it has been applied.
*
* This function should only be called by #ClutterOffscreenEffect
* implementations, from within the <function>paint_target()</function>
* virtual function.
*
* Return value: %TRUE if the offscreen buffer has a valid size,
* and %FALSE otherwise
*
* Since: 1.8
*/
gboolean
_clutter_offscreen_effect_get_target_size (ClutterOffscreenEffect *effect,
gfloat *width,
gfloat *height)
clutter_offscreen_effect_get_target_size (ClutterOffscreenEffect *effect,
gfloat *width,
gfloat *height)
{
ClutterOffscreenEffectPrivate *priv = effect->priv;
ClutterOffscreenEffectPrivate *priv;
g_return_val_if_fail (CLUTTER_IS_OFFSCREEN_EFFECT (effect), FALSE);
priv = effect->priv;
if (priv->target == NULL)
return FALSE;

View File

@ -93,12 +93,15 @@ struct _ClutterOffscreenEffectClass
GType clutter_offscreen_effect_get_type (void) G_GNUC_CONST;
CoglMaterial *clutter_offscreen_effect_get_target (ClutterOffscreenEffect *effect);
CoglMaterial * clutter_offscreen_effect_get_target (ClutterOffscreenEffect *effect);
void clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect);
CoglHandle clutter_offscreen_effect_create_texture (ClutterOffscreenEffect *effect,
gfloat width,
gfloat height);
void clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect);
CoglHandle clutter_offscreen_effect_create_texture (ClutterOffscreenEffect *effect,
gfloat width,
gfloat height);
gboolean clutter_offscreen_effect_get_target_size (ClutterOffscreenEffect *effect,
gfloat *width,
gfloat *height);
G_END_DECLS

View File

@ -2486,6 +2486,7 @@ ClutterOffscreenEffectClass
clutter_offscreen_effect_get_target
clutter_offscreen_effect_create_texture
clutter_offscreen_effect_paint_target
clutter_offscreen_effect_get_target_size
<SUBSECTION Standard>
CLUTTER_TYPE_OFFSCREEN_EFFECT
CLUTTER_OFFSCREEN_EFFECT