[gimp-perl] update to PDL 2.063_01 affine_new API



commit 79ffb470ae51cb006318a620a586fa5a71298f83
Author: Ed J <mohawk2 users noreply github com>
Date:   Tue Dec 21 17:32:14 2021 +0000

    update to PDL 2.063_01 affine_new API

 Changes         |  2 ++
 Makefile.PL     |  2 +-
 lib/Gimp/Lib.xs | 23 +++++------------------
 3 files changed, 8 insertions(+), 19 deletions(-)
---
diff --git a/Changes b/Changes
index f27fc22b..ef42d218 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,5 @@
+- update to PDL 2.063_01 affine_new API
+
 2.35 2021-09-09
 - ignore GEGL-WARNING too
 - use less-obsolete PDL->get_convertedpdl API
diff --git a/Makefile.PL b/Makefile.PL
index 70be25c2..974e1cd8 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -38,7 +38,7 @@ my $pkg = eval {
 
 my $runtime_reqs = {
   'Gtk2'               => 1.0,
-  'PDL'                => '2.037',
+  'PDL'                => '2.063_01', # affine_new non-SV input
   'Data::Dumper'       => 2.0,
   'IO::All'            => 0,
   'Gtk2::Ex::PodViewer'        => 0,
diff --git a/lib/Gimp/Lib.xs b/lib/Gimp/Lib.xs
index 5b835d2d..4fccdfcf 100644
--- a/lib/Gimp/Lib.xs
+++ b/lib/Gimp/Lib.xs
@@ -101,28 +101,15 @@ static void pixel_rgn_pdl_delete_data (pdl *p, size_t param)
   p->data = 0;
 }
 
-/* please optimize! */
 static pdl *redim_pdl (pdl *p, int ndim, int newsize)
 {
   pdl *r = PDL->null ();
-  AV *dims, *dimincs;
-  int i;
-
-  dims    = newAV ();
-  dimincs = newAV ();
-
-  for (i = 0; i < p->ndims; i++)
-    {
-      av_push (dims   , newSViv (p->dims   [i]));
-      av_push (dimincs, newSViv (p->dimincs[i]));
-    }
-
-  sv_setiv (*av_fetch (dims, ndim, 0), newsize);
-
+  PDL_Indx dims[p->ndims], i; /* copy so as to modify */
+  for (i = 0; i < p->ndims; i++) dims[i] = p->dims[i];
+  dims[ndim] = newsize;
   PDL->affine_new (p, r, 0,
-                  sv_2mortal (newRV_noinc ((SV*)dims)),
-                  sv_2mortal (newRV_noinc ((SV*)dimincs)));
-
+                  dims, p->ndims,
+                  p->dimincs, p->ndims);
   return r;
 }
 


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