[librsvg/rustification] rsvg-path: New function rsvg_path_builder_add_to_cairo_context()
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/rustification] rsvg-path: New function rsvg_path_builder_add_to_cairo_context()
- Date: Mon, 31 Oct 2016 20:43:53 +0000 (UTC)
commit 00baf53cc11750e429a9e278f6b94c5ba12c6d7e
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Oct 31 14:05:32 2016 -0600
rsvg-path: New function rsvg_path_builder_add_to_cairo_context()
We'll use this to pass the cairo_path_t from an RsvgPathBuilder
directly into a cairo_t, without copying the path first.
rsvg-path.c | 16 ++++++++++++++++
rsvg-path.h | 3 +++
2 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/rsvg-path.c b/rsvg-path.c
index 27dbb7b..401cdae 100644
--- a/rsvg-path.c
+++ b/rsvg-path.c
@@ -200,6 +200,22 @@ rsvg_path_builder_copy_path (RsvgPathBuilder *builder)
return path;
}
+void
+rsvg_path_builder_add_to_cairo_context (RsvgPathBuilder *builder, cairo_t *cr)
+{
+ cairo_path_t *path;
+
+ g_assert (builder != NULL);
+ g_assert (cr != NULL);
+
+ path = rsvg_path_builder_copy_path (builder);
+
+ cairo_new_path (cr);
+ cairo_append_path (cr, path);
+
+ rsvg_cairo_path_destroy (path);
+}
+
static void
rsvg_path_arc_segment (RsvgPathBuilder *builder,
double xc, double yc,
diff --git a/rsvg-path.h b/rsvg-path.h
index 68269e0..1ecd355 100644
--- a/rsvg-path.h
+++ b/rsvg-path.h
@@ -75,6 +75,9 @@ void rsvg_path_builder_close_path (RsvgPathBuilder *builder);
G_GNUC_INTERNAL
cairo_path_t *rsvg_path_builder_copy_path (RsvgPathBuilder *builder);
G_GNUC_INTERNAL
+void rsvg_path_builder_add_to_cairo_context (RsvgPathBuilder *builder, cairo_t *cr);
+
+G_GNUC_INTERNAL
cairo_path_t *rsvg_parse_path (const char *path_str);
G_GNUC_INTERNAL
void rsvg_cairo_path_destroy (cairo_path_t *path);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]