]> git.imager.perl.org - imager.git/blobdiff - Imager.xs
- improve the transform2() documentation
[imager.git] / Imager.xs
index 0ccba04787900435f9b83043b23744efce06d71c..963277ad227f9a8916372675a059e3b509d70261 100644 (file)
--- a/Imager.xs
+++ b/Imager.xs
@@ -2973,18 +2973,19 @@ i_count_colors(im,maxc)
                int     maxc
 
 void
-get_anonymous_colour_usage(Imager::ImgRaw im)
-    PPCODE:
+i_get_anonymous_color_histo(im, maxc = 0x40000000)
+   Imager::ImgRaw  im
+   int maxc
+    PREINIT:
         int i;
-        unsigned int ** col_usage = (unsigned int **) mymalloc(sizeof(unsigned int *));
-        unsigned int * p;
-        int col_cnt = get_anonymous_color_histo(im, col_usage);
+        unsigned int * col_usage = NULL;
+        int col_cnt;
+    PPCODE:
+       col_cnt = i_get_anonymous_color_histo(im, &col_usage, maxc);
         EXTEND(SP, col_cnt);
-        p = *col_usage;
-        for (i = 0; i < col_cnt; )  {
-            PUSHs(sv_2mortal(newSViv( p[i++])));
+        for (i = 0; i < col_cnt; i++)  {
+            PUSHs(sv_2mortal(newSViv( col_usage[i])));
         }
-        myfree(p);
         myfree(col_usage);
         XSRETURN(col_cnt);
 
@@ -3992,8 +3993,10 @@ i_glinf(im, l, r, y)
       PREINIT:
         i_fcolor *vals;
         int count, i;
-        i_fcolor zero = { 0 };
+        i_fcolor zero;
       PPCODE:
+       for (i = 0; i < MAXCHANNELS; ++i)
+         zero.channel[i] = 0;
         if (l < r) {
           vals = mymalloc((r-l) * sizeof(i_fcolor));
           for (i = 0; i < r-l; ++i)