This commit reverses the OpenEXR specific stuff in the OpenEXR commit I
[blender-staging.git] / source / blender / imbuf / intern / writeimage.c
index e4d240977608408a4e5e11a5959d63e3a19cb8a2..150ab8aac26c8f69d6c8e41b089b1a9d0d3c726f 100644 (file)
 #include "IMB_ham.h"
 #include "IMB_hamx.h"
 #include "IMB_amiga.h"
+#include "IMB_png.h"
+#include "IMB_bmp.h"
 
 #include "IMB_iff.h"
 #include "IMB_bitplanes.h"
 #include "IMB_divers.h"
 
-
-short (*IMB_fp_png_encode)(struct ImBuf *ibuf, int file, int flags) = 0;
-
 short IMB_saveiff(struct ImBuf *ibuf,char *naam,int flags)
-{      
+{
        short ok=TRUE,delpl=FALSE;
        int file = -1;
 
        if (ibuf==0) return (FALSE);
        ibuf->flags = flags;
 
+       /* Put formats that take a filename here */
        if (IS_jpg(ibuf)) {
-               if (imb_save_jpeg(naam, ibuf, flags)) return (0);
-               else return (TRUE);
+               return imb_savejpeg(ibuf, naam, flags);
+       }
+       if (IS_png(ibuf)) {
+               return imb_savepng(ibuf,naam,flags);
+       }
+       if (IS_bmp(ibuf)) {
+               return imb_savebmp(ibuf,naam,flags);
+       }
+       if (IS_tga(ibuf)) {
+               return imb_savetarga(ibuf,naam,flags);
        }
+       if (IS_iris(ibuf)) {
+               return imb_saveiris(ibuf,naam,flags);
+       }
+
        file = open(naam, O_BINARY | O_RDWR | O_CREAT | O_TRUNC, 0666);
        if (file < 0) return (FALSE);
 
@@ -77,32 +89,9 @@ short IMB_saveiff(struct ImBuf *ibuf,char *naam,int flags)
                }
        }
 
-       if (IS_png(ibuf) && IMB_fp_png_encode) {
-               ok = IMB_fp_png_encode(ibuf,file,flags);
-               if (ok) {
-                       close (file);
-                       return (ok);
-               }
-       }
-
-       if (IS_tga(ibuf) || IS_png(ibuf)) {
-               ok = imb_savetarga(ibuf,file,flags);
-               if (ok) {
-                       close (file);
-                       return (ok);
-               }
-       }
+       /* Put formats that take a filehandle here */
        
-       if (IS_iris(ibuf)) {
-               ok = imb_saveiris(ibuf,file,flags);
-               if (ok) {
-                       close (file);
-                       return (ok);
-               }
-       }
-       
-       if (ok) ok = imb_start_iff(ibuf,file);
-
+       ok = imb_start_iff(ibuf,file);
        if (IS_amiga(ibuf)){
                IMB_flipy(ibuf);
                if (flags & IB_rect){