[gtk+/wip/otte/shader: 79/127] gskslvalue: Add gsk_sl_value_to_string ()
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/otte/shader: 79/127] gskslvalue: Add gsk_sl_value_to_string ()
- Date: Fri, 13 Oct 2017 00:03:04 +0000 (UTC)
commit 754b31736047720d611063798d54232d40c9d45d
Author: Benjamin Otte <otte redhat com>
Date: Tue Oct 3 02:42:45 2017 +0200
gskslvalue: Add gsk_sl_value_to_string ()
Very useful to have in gdb.
gsk/gskslvalue.c | 17 +++++++++++++++++
gsk/gskslvalueprivate.h | 1 +
2 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/gsk/gskslvalue.c b/gsk/gskslvalue.c
index 37bc078..defac16 100644
--- a/gsk/gskslvalue.c
+++ b/gsk/gskslvalue.c
@@ -20,6 +20,7 @@
#include "gskslvalueprivate.h"
+#include "gskslprinterprivate.h"
#include "gsksltypeprivate.h"
#include "gskspvwriterprivate.h"
@@ -279,6 +280,22 @@ gsk_sl_value_print (const GskSlValue *value,
gsk_sl_type_print_value (value->type, printer, value->data);
}
+char *
+gsk_sl_value_to_string (const GskSlValue *value)
+{
+ GskSlPrinter *printer;
+ char *s;
+
+ printer = gsk_sl_printer_new ();
+
+ gsk_sl_value_print (value, printer);
+
+ s = gsk_sl_printer_write_to_string (printer);
+ gsk_sl_printer_unref (printer);
+
+ return s;
+}
+
GskSlType *
gsk_sl_value_get_type (const GskSlValue *value)
{
diff --git a/gsk/gskslvalueprivate.h b/gsk/gskslvalueprivate.h
index 9500de6..0ce2637 100644
--- a/gsk/gskslvalueprivate.h
+++ b/gsk/gskslvalueprivate.h
@@ -42,6 +42,7 @@ void gsk_sl_value_componentwise (GskSlValue
gpointer user_data);
void gsk_sl_value_print (const GskSlValue *value,
GskSlPrinter *printer);
+char * gsk_sl_value_to_string (const GskSlValue *value);
GskSlType * gsk_sl_value_get_type (const GskSlValue *value);
gpointer gsk_sl_value_get_data (const GskSlValue *value);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]