libgimpbase: always allocate GimpPixPipeParams.placement, add docs

This commit is contained in:
Michael Natterer 2019-07-24 02:09:49 +02:00
parent 8bd4a4fac9
commit f28ec4bf86
2 changed files with 23 additions and 6 deletions

View File

@ -61,10 +61,11 @@ gimp_pixpipe_params_init (GimpPixPipeParams *params)
params->dim = 1; params->dim = 1;
params->cols = 1; params->cols = 1;
params->rows = 1; params->rows = 1;
params->placement = "constant"; params->placement = g_strdup ("constant");
params->free_placement_string = FALSE;
for (i = 0; i < GIMP_PIXPIPE_MAXDIM; i++) for (i = 0; i < GIMP_PIXPIPE_MAXDIM; i++)
params->selection[i] = g_strdup ("random"); params->selection[i] = g_strdup ("random");
params->rank[0] = 1; params->rank[0] = 1;
for (i = 1; i < GIMP_PIXPIPE_MAXDIM; i++) for (i = 1; i < GIMP_PIXPIPE_MAXDIM; i++)
params->rank[i] = 0; params->rank[i] = 0;
@ -133,8 +134,8 @@ gimp_pixpipe_params_parse (const gchar *string,
{ {
if (r) if (r)
{ {
g_free (params->placement);
params->placement = g_strdup (r + 1); params->placement = g_strdup (r + 1);
params->free_placement_string = TRUE;
} }
} }
else if (strncmp (p, "rank", strlen ("rank")) == 0 && r) else if (strncmp (p, "rank", strlen ("rank")) == 0 && r)
@ -196,9 +197,8 @@ gimp_pixpipe_params_free (GimpPixPipeParams *params)
{ {
gint i; gint i;
g_free (params->placement);
for (i = 0; i < GIMP_PIXPIPE_MAXDIM; i++) for (i = 0; i < GIMP_PIXPIPE_MAXDIM; i++)
g_free (params->selection[i]); g_free (params->selection[i]);
if (params->free_placement_string)
g_free (params->placement);
} }

View File

@ -40,6 +40,23 @@ G_BEGIN_DECLS
typedef struct _GimpPixPipeParams GimpPixPipeParams; typedef struct _GimpPixPipeParams GimpPixPipeParams;
/**
* GimpPixPipeParams:
* @step: Step
* @ncells: Number of cells
* @dim: Dimension
* @cols: Columns
* @rows: Rows
* @cellwidth: Cell width
* @cellheight: Cell height
* @placement: Placement
* @free_placement_string: Unused, ignore
* @rank: Rank
* @selection: Selection
* @free_selection_string: Unused, ignore
*
* PLease somebody help documenting this.
**/
struct _GimpPixPipeParams struct _GimpPixPipeParams
{ {
gint step; gint step;