]> git.imager.perl.org - imager.git/blobdiff - convert.im
remove a pointless NULL check from i_flipxy()
[imager.git] / convert.im
index b001f4bd7f6bec026abd7fc6063237d53f09380d..2d5a8a96a6890a57956112b547cae3d7e729c3b0 100644 (file)
@@ -17,6 +17,7 @@ converting from RGBA to greyscale and back.
 =cut
 */
 
+#define IMAGER_NO_CONTEXT
 #include "imager.h"
 
 struct chan_copy {
@@ -65,20 +66,22 @@ Now handles images with more than 8-bits/sample.
 i_img *
 i_convert(i_img *src, const double *coeff, int outchan, int inchan) {
   double work[MAXCHANNELS];
-  int x, y;
+  i_img_dim x, y;
   int i, j;
   int ilimit;
   i_img *im = NULL;
+  dIMCTXim(src);
 
-  mm_log((1,"i_convert(src %p, coeff %p,outchan %d, inchan %d)\n",im,src, coeff,outchan, inchan));
+  im_log((aIMCTX,1,"i_convert(im %p, src %p, coeff %p,outchan %d, inchan %d)\n",
+         im, src, coeff, outchan, inchan));
  
-  i_clear_error();
+  im_clear_error(aIMCTX);
 
   ilimit = inchan;
   if (ilimit > src->channels)
     ilimit = src->channels;
   if (outchan > MAXCHANNELS) {
-    i_push_error(0, "cannot have outchan > MAXCHANNELS");
+    im_push_error(aIMCTX, 0, "cannot have outchan > MAXCHANNELS");
     return 0;
   }
 
@@ -129,8 +132,8 @@ i_convert(i_img *src, const double *coeff, int outchan, int inchan) {
     i_color *colors;
     i_palidx *vals;
 
-    im = i_img_pal_new(src->xsize, src->ysize, outchan, 
-                      i_maxcolors(src));
+    im = im_img_pal_new(aIMCTX, src->xsize, src->ysize, outchan, 
+                       i_maxcolors(src));
 
     /* just translate the color table */
     count = i_colorcount(src);
@@ -275,7 +278,7 @@ Perform a convert that only requires channel copies.
 =cut
 */
 
-i_img *
+static i_img *
 convert_via_copy(i_img *im, i_img *src, struct chan_copy *info) {
 #code src->bits <= i_8_bits
   IM_COLOR *in_line = mymalloc(sizeof(IM_COLOR) * src->xsize);