[gtk+/wip/otte/shader: 46/48] 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: 46/48] gskslvalue: Add gsk_sl_value_to_string ()
- Date: Tue, 3 Oct 2017 02:16:26 +0000 (UTC)
commit 7bd696e4519607a9da7f88997576083bd2b6c671
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 fce41fa..a143a7f 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 dc8460e..5790e2b 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]