Skip to content

Commit

Permalink
Simplify @background initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
kleisauke committed Jan 23, 2025
1 parent aa6db76 commit 4cd6885
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
8 changes: 3 additions & 5 deletions libvips/conversion/arrayjoin.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ typedef struct _VipsArrayjoin {
VipsArrayImage *in;
int across;
int shim;
VipsArea *background;
VipsArrayDouble *background;
VipsAlign halign;
VipsAlign valign;
int hspacing;
Expand Down Expand Up @@ -224,7 +224,7 @@ vips_arrayjoin_build(VipsObject *object)
*/
band = (VipsImage **) vips_object_local_array(object, n);
if (vips__bandalike_vec(class->nickname,
in, band, n, join->background->n))
in, band, n, VIPS_AREA(join->background)->n))
return -1;
in = band;

Expand Down Expand Up @@ -452,9 +452,7 @@ vips_arrayjoin_init(VipsArrayjoin *join)
{
/* Init our instance fields.
*/
join->background =
vips_area_new_array(G_TYPE_DOUBLE, sizeof(double), 1);
((double *) (join->background->data))[0] = 0.0;
join->background = vips_array_double_newv(1, 0.0);
}

static int
Expand Down
6 changes: 2 additions & 4 deletions libvips/conversion/join.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ typedef struct _VipsJoin {
VipsDirection direction;
gboolean expand;
int shim;
VipsArea *background;
VipsArrayDouble *background;
VipsAlign align;
} VipsJoin;

Expand Down Expand Up @@ -286,9 +286,7 @@ vips_join_init(VipsJoin *join)
{
/* Init our instance fields.
*/
join->background =
vips_area_new_array(G_TYPE_DOUBLE, sizeof(double), 1);
((double *) (join->background->data))[0] = 0.0;
join->background = vips_array_double_newv(1, 0.0);
}

/**
Expand Down

0 comments on commit 4cd6885

Please sign in to comment.