[Cogl] [PATCH] display: add _set_onscreen_template() api
Robert Bragg
robert at sixbynine.org
Fri Jun 7 09:03:48 PDT 2013
From: Robert Bragg <robert at linux.intel.com>
Currently it's only possible to set an onscreen template on a
CoglDisplay by passing a template to cogl_display_new(). For
applications that want to deal with fallbacks then they may want to
replace the onscreen template so this adds a
cogl_display_set_onscreen_template() function.
---
cogl/cogl-display.c | 12 ++++++++++++
cogl/cogl-display.h | 23 ++++++++++++++++++++++-
2 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/cogl/cogl-display.c b/cogl/cogl-display.c
index d943c2c..73d2cfb 100644
--- a/cogl/cogl-display.c
+++ b/cogl/cogl-display.c
@@ -116,6 +116,18 @@ cogl_display_get_renderer (CoglDisplay *display)
return display->renderer;
}
+void
+cogl_display_set_onscreen_template (CoglDisplay *display,
+ CoglOnscreenTemplate *onscreen_template)
+{
+ if (onscreen_template)
+ cogl_object_ref (onscreen_template);
+
+ cogl_object_unref (display->onscreen_template);
+
+ display->onscreen_template = onscreen_template;
+}
+
CoglBool
cogl_display_setup (CoglDisplay *display,
CoglError **error)
diff --git a/cogl/cogl-display.h b/cogl/cogl-display.h
index 1177aee..424e7e6 100644
--- a/cogl/cogl-display.h
+++ b/cogl/cogl-display.h
@@ -85,7 +85,8 @@ typedef struct _CoglDisplay CoglDisplay;
*
* A common use for explicitly allocating a display object is to
* define a template for allocating onscreen framebuffers which is
- * what the @onscreen_template argument is for.
+ * what the @onscreen_template argument is for, or alternatively
+ * you can use cogl_display_set_onscreen_template().
*
* When a display is first allocated via cogl_display_new() it is in a
* mutable configuration mode. It's designed this way so we can
@@ -122,6 +123,26 @@ CoglRenderer *
cogl_display_get_renderer (CoglDisplay *display);
/**
+ * cogl_display_set_onscreen_template:
+ * @display: a #CoglDisplay
+ * @onscreen_template: A template for creating #CoglOnscreen framebuffers
+ *
+ * Specifies a template for creating #CoglOnscreen framebuffers.
+ *
+ * Depending on the system, the constraints for creating #CoglOnscreen
+ * framebuffers need to be known before setting up a #CoglDisplay because the
+ * final setup of the display may constrain how onscreen framebuffers may be
+ * allocated. If Cogl knows how an application wants to allocate onscreen
+ * framebuffers then it can try to make sure to setup the display accordingly.
+ *
+ * Since: 1.16
+ * Stability: unstable
+ */
+void
+cogl_display_set_onscreen_template (CoglDisplay *display,
+ CoglOnscreenTemplate *onscreen_template);
+
+/**
* cogl_display_setup:
* @display: a #CoglDisplay
* @error: return location for a #CoglError
--
1.8.2.1
More information about the Cogl
mailing list