Addes libopenjpeg (jpeg2000) support to the Makefiles
[blender.git] / source / blender / imbuf / intern / readimage.c
index 881fddc1bb2a9f26a755bc6d41ec074f65198ac5..6df92f69fffee8e0947b33ab456b8ef8bc6ea450 100644 (file)
  * $Id$
  */
 
-#ifdef WIN32
+#ifdef _WIN32
 #include <io.h>
+#include <stddef.h>
+#include <sys/types.h>
+#include "mmap_win.h"
+#define open _open
+#define read _read
+#define close _close
 #endif
 
 #include "BLI_blenlib.h"
 #include "IMB_dpxcineon.h"
 #include "BKE_global.h"
 
+#ifdef WITH_OPENJPEG
+#include "IMB_jp2.h"
+#endif
+
 #ifdef WITH_OPENEXR
 #include "openexr/openexr_api.h"
 #endif
@@ -155,11 +165,16 @@ ImBuf *IMB_ibImageFromMemory(int *mem, int size, int flags) {
                if (ibuf) return (ibuf);
 #endif
 
+#ifdef WITH_OPENJPEG
+               ibuf = imb_jp2_decode((uchar *)mem, size, flags);
+               if (ibuf) return (ibuf);
+#endif
+
 #ifdef WITH_DDS
                ibuf = imb_load_dds((uchar *)mem, size, flags);
                if (ibuf) return (ibuf);
 #endif
-               
+       
 #ifdef WITH_QUICKTIME
 #if defined(_WIN32) || defined (__APPLE__)
                if(G.have_quicktime) {
@@ -229,7 +244,7 @@ struct ImBuf *IMB_loadifffile(int file, int flags) {
 
        size = BLI_filesize(file);
 
-#if defined(AMIGA) || defined(__BeOS) || defined(WIN32)
+#if defined(AMIGA) || defined(__BeOS)
        mem= (int *)malloc(size);
        if (mem==0) {
                printf("Out of mem\n");