[clutter/clutter-1.18] actor: Add private getter for the active framebuffer



commit 1b45841414ad92a63ace2d7376a6682d39d9b20c
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Tue Dec 3 12:11:43 2013 +0000

    actor: Add private getter for the active framebuffer
    
    Instead of asking every internal user to get the stage and get the
    active framebuffer from it, we can wrap it up ourselves, and do some
    sanity checks as well.

 clutter/clutter-actor-private.h |    2 ++
 clutter/clutter-actor.c         |   26 ++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-actor-private.h b/clutter/clutter-actor-private.h
index 8bcf26c..29376a6 100644
--- a/clutter/clutter-actor-private.h
+++ b/clutter/clutter-actor-private.h
@@ -320,6 +320,8 @@ void                            _clutter_actor_queue_redraw_on_clones
 void                            _clutter_actor_queue_relayout_on_clones                 (ClutterActor 
*actor);
 void                            _clutter_actor_queue_only_relayout                      (ClutterActor 
*actor);
 
+CoglFramebuffer *               _clutter_actor_get_active_framebuffer                   (ClutterActor 
*actor);
+
 G_END_DECLS
 
 #endif /* __CLUTTER_ACTOR_PRIVATE_H__ */
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index b371183..39b982b 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -20399,3 +20399,29 @@ clutter_actor_has_mapped_clones (ClutterActor *self)
 
   return FALSE;
 }
+
+CoglFramebuffer *
+_clutter_actor_get_active_framebuffer (ClutterActor *self)
+{
+  ClutterStage *stage;
+
+  if (!CLUTTER_ACTOR_IN_PAINT (self))
+    {
+      g_critical ("The active framebuffer of actor '%s' can only be "
+                  "retrieved during the paint sequence. Please, check "
+                  "your code.",
+                  _clutter_actor_get_debug_name (self));
+      return NULL;
+    }
+
+  stage = (ClutterStage *) _clutter_actor_get_stage_internal (self);
+  if (stage == NULL)
+    {
+      g_critical ("The active framebuffer of actor '%s' is only available "
+                  "if the actor is associated to a ClutterStage.",
+                  _clutter_actor_get_debug_name (self));
+      return NULL;
+    }
+
+  return _clutter_stage_get_active_framebuffer (stage);
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]