[gtk/wip/otte/lottie: 2494/2503] path fill demo: Use gsk_path_builder_add_layout
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/lottie: 2494/2503] path fill demo: Use gsk_path_builder_add_layout
- Date: Tue, 13 Jul 2021 04:28:09 +0000 (UTC)
commit 1bd7838725b5587750858bdc911323d3ebb0a5db
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Dec 27 01:00:29 2020 -0500
path fill demo: Use gsk_path_builder_add_layout
We have an api now to hide the cairo use.
demos/gtk-demo/path_fill.c | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)
---
diff --git a/demos/gtk-demo/path_fill.c b/demos/gtk-demo/path_fill.c
index e3d608218e..fb0a72ec20 100644
--- a/demos/gtk-demo/path_fill.c
+++ b/demos/gtk-demo/path_fill.c
@@ -189,31 +189,20 @@ create_hexagon (GtkWidget *widget)
static GskPath *
create_path_from_text (GtkWidget *widget)
{
- cairo_surface_t *surface;
- cairo_t *cr;
- cairo_path_t *path;
PangoLayout *layout;
PangoFontDescription *desc;
- GskPath *result;
-
- surface = cairo_recording_surface_create (CAIRO_CONTENT_COLOR_ALPHA, NULL);
- cr = cairo_create (surface);
+ GskPathBuilder *builder;
layout = gtk_widget_create_pango_layout (widget, "Pango power!\nPango power!\nPango power!");
desc = pango_font_description_from_string ("sans bold 36");
pango_layout_set_font_description (layout, desc);
pango_font_description_free (desc);
- pango_cairo_layout_path (cr, layout);
- path = cairo_copy_path_flat (cr);
- result = gsk_path_new_from_cairo (path);
+ builder = gsk_path_builder_new ();
- cairo_path_destroy (path);
- g_object_unref (layout);
- cairo_destroy (cr);
- cairo_surface_destroy (surface);
+ gsk_path_builder_add_layout (builder, layout);
- return result;
+ return gsk_path_builder_free_to_path (builder);
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]