[gtk/matthiasc/lottie2] Add a placeholder gsk_path_in_fill implementation



commit 483ec384ffeea5c7347d95d83cc387818a0564ba
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Nov 26 19:45:52 2020 -0500

    Add a placeholder gsk_path_in_fill implementation
    
    This is using cairo_in_fill, which we want to
    replace eventually with our own implementation.

 gsk/gskpath.c | 23 +++++++++++++++++++++++
 gsk/gskpath.h |  4 ++++
 2 files changed, 27 insertions(+)
---
diff --git a/gsk/gskpath.c b/gsk/gskpath.c
index 896a58a544..612e131f3a 100644
--- a/gsk/gskpath.c
+++ b/gsk/gskpath.c
@@ -1932,6 +1932,29 @@ gsk_path_foreach_with_tolerance (GskPath            *self,
   return TRUE;
 }
 
+gboolean
+gsk_path_in_fill (GskPath          *path,
+                  graphene_point_t *point,
+                  GskFillRule       fill_rule)
+{
+  cairo_surface_t *dummy;
+  cairo_t *cr;
+  gboolean inside;
+
+  dummy = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1);
+  cr = cairo_create (dummy);
+  cairo_set_fill_rule (cr, (cairo_fill_rule_t)fill_rule);
+
+  gsk_path_to_cairo (path, cr);
+
+  inside = cairo_in_fill (cr, point->x, point->y);
+
+  cairo_destroy (cr);
+  cairo_surface_destroy (dummy);
+
+  return inside;
+}
+
 /* BUILDER */
 
 /**
diff --git a/gsk/gskpath.h b/gsk/gskpath.h
index 415a21c2d8..c1d3182b58 100644
--- a/gsk/gskpath.h
+++ b/gsk/gskpath.h
@@ -89,6 +89,10 @@ gboolean                gsk_path_foreach                        (GskPath
                                                                  GskPathForeachFunc    func,
                                                                  gpointer              user_data);
 
+GDK_AVAILABLE_IN_ALL
+gboolean                gsk_path_in_fill                        (GskPath              *path,
+                                                                 graphene_point_t     *point,
+                                                                 GskFillRule           fill_rule);
 
 #define GSK_TYPE_PATH_BUILDER (gsk_path_builder_get_type ())
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]