[clutter/wip/backend-next: 1/5] backend: Provide an implementation of ensure_backend()



commit 8dea202de77f388a2ab485e456534e80302cb0f4
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Thu Nov 3 16:45:56 2011 +0000

    backend: Provide an implementation of ensure_backend()
    
    We can do it for all Cogl-based backends.

 clutter/clutter-backend.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-backend.c b/clutter/clutter-backend.c
index 7243cac..e448a27 100644
--- a/clutter/clutter-backend.c
+++ b/clutter/clutter-backend.c
@@ -50,6 +50,7 @@
 #include "clutter-profile.h"
 #include "clutter-stage-manager-private.h"
 #include "clutter-stage-private.h"
+#include "clutter-stage-window.h"
 #include "clutter-version.h"
 
 #include <cogl/cogl.h>
@@ -206,6 +207,27 @@ clutter_backend_real_font_changed (ClutterBackend *backend)
 }
 
 static void
+clutter_backend_real_ensure_context (ClutterBackend *backend,
+                                     ClutterStage   *stage)
+{
+  ClutterStageWindow *stage_impl;
+  CoglFramebuffer *framebuffer;
+
+  if (stage == NULL)
+    return;
+
+  stage_impl = _clutter_stage_get_window (stage);
+  if (stage_impl == NULL)
+    return;
+
+  framebuffer = _clutter_stage_window_get_active_framebuffer (stage_impl);
+  if (framebuffer == NULL)
+    return;
+
+  cogl_set_framebuffer (framebuffer);
+}
+
+static void
 clutter_backend_real_redraw (ClutterBackend *backend,
                              ClutterStage   *stage)
 {
@@ -316,7 +338,9 @@ clutter_backend_class_init (ClutterBackendClass *klass)
 
   klass->resolution_changed = clutter_backend_real_resolution_changed;
   klass->font_changed = clutter_backend_real_font_changed;
+
   klass->translate_event = clutter_backend_real_translate_event;
+  klass->ensure_context = clutter_backend_real_ensure_context;
   klass->redraw = clutter_backend_real_redraw;
 }
 



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