From 6c2787afa769a815c577ac9f244e2108dfdc0030 Mon Sep 17 00:00:00 2001 From: Nicola Fontana Date: Thu, 27 Aug 2009 00:29:09 +0200 Subject: [PATCH] [AdgPath] Using CpmlPath where applicable Adopted the CpmlPath struct instead of cairo_path_t where the former makes more sense than the latter. --- adg/adg-path-private.h | 2 +- adg/adg-path.c | 19 ++++++++++--------- adg/adg-path.h | 18 +++++++++--------- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/adg/adg-path-private.h b/adg/adg-path-private.h index 207702bf..de2e8d5e 100644 --- a/adg/adg-path-private.h +++ b/adg/adg-path-private.h @@ -52,8 +52,8 @@ struct _AdgPathPrivate { gboolean cp_is_valid; AdgPair cp; GArray *path; - cairo_path_t cpml_path; cairo_path_t cairo_path; + CpmlPath cpml_path; CpmlPrimitive last; AdgOperation operation; }; diff --git a/adg/adg-path.c b/adg/adg-path.c index f4333297..6a09b15e 100644 --- a/adg/adg-path.c +++ b/adg/adg-path.c @@ -22,9 +22,9 @@ * SECTION:adg-path * @short_description: The basic model representing a generic path * - * The #AdgPath model is a virtual path: in a few words, it is a - * simple conceptual #cairo_path_t struct. This class implements - * methods to manipulate the underlying cairo path. + * The #AdgPath model is a virtual path: in other words it is a + * non-rendered #cairo_path_t struct. This class implements methods + * to manipulate the underlying cairo path. * * Although some of the provided methods are clearly based on the * original cairo path manipulation API, their behavior could be @@ -63,7 +63,7 @@ static void finalize (GObject *object); static void changed (AdgModel *model); static void clear_cairo_path (AdgPath *path); static cairo_path_t * get_cairo_path (AdgPath *path); -static cairo_path_t * get_cpml_path (AdgPath *path); +static CpmlPath * get_cpml_path (AdgPath *path); static GArray * arc_to_curves (GArray *array, const cairo_path_data_t *src); @@ -206,12 +206,13 @@ adg_path_get_cairo_path(AdgPath *path) * path as long as its size is retained and its data contains a * valid path. * - * Keep in mind any changes to @path makes the value returned by - * this function useless, as it is likely to contain plain garbage. + * Any changes to the @path instance will make the returned pointer + * useless because probably the internal #CpmlPath will be relocated + * and the old #CpmlPath will likely contain plain garbage. * * Returns: a pointer to the internal cpml path or %NULL on errors **/ -cairo_path_t * +CpmlPath * adg_path_get_cpml_path(AdgPath *path) { g_return_val_if_fail(ADG_IS_PATH(path), NULL); @@ -776,11 +777,11 @@ get_cairo_path(AdgPath *path) return cairo_path; } -static cairo_path_t * +static CpmlPath * get_cpml_path(AdgPath *path) { AdgPathPrivate *data; - cairo_path_t *cpml_path; + CpmlPath *cpml_path; data = path->data; cpml_path = &data->cpml_path; diff --git a/adg/adg-path.h b/adg/adg-path.h index f406637b..9e867cc6 100644 --- a/adg/adg-path.h +++ b/adg/adg-path.h @@ -29,25 +29,25 @@ G_BEGIN_DECLS -#define ADG_TYPE_PATH (adg_path_get_type ()) -#define ADG_PATH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ADG_TYPE_PATH, AdgPath)) -#define ADG_PATH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ADG_TYPE_PATH, AdgPathClass)) -#define ADG_IS_PATH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ADG_TYPE_PATH)) -#define ADG_IS_PATH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ADG_TYPE_PATH)) -#define ADG_PATH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ADG_TYPE_PATH, AdgPathClass)) +#define ADG_TYPE_PATH (adg_path_get_type()) +#define ADG_PATH(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ADG_TYPE_PATH, AdgPath)) +#define ADG_PATH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), ADG_TYPE_PATH, AdgPathClass)) +#define ADG_IS_PATH(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), ADG_TYPE_PATH)) +#define ADG_IS_PATH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), ADG_TYPE_PATH)) +#define ADG_PATH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), ADG_TYPE_PATH, AdgPathClass)) typedef struct _AdgPath AdgPath; typedef struct _AdgPathClass AdgPathClass; struct _AdgPath { /*< private >*/ - AdgModel parent; + AdgModel parent; gpointer data; }; struct _AdgPathClass { /*< private >*/ - AdgModelClass parent_class; + AdgModelClass parent_class; }; @@ -56,7 +56,7 @@ AdgModel * adg_path_new (void); const cairo_path_t * adg_path_get_cairo_path (AdgPath *path); -cairo_path_t * adg_path_get_cpml_path (AdgPath *path); +CpmlPath * adg_path_get_cpml_path (AdgPath *path); void adg_path_get_current_point (AdgPath *path, gdouble *x, gdouble *y); -- 2.11.4.GIT