]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - jpeg.c
removed CL_InitTEnts function, moved its contents (cl_sfx precaches) to CL_ParseServe...
[xonotic/darkplaces.git] / jpeg.c
diff --git a/jpeg.c b/jpeg.c
index 2637a03085829eca52d48e7dacc1ff0434c5cd45..6a28208ababbecfccefa973f1f1bbb4208f1cff7 100644 (file)
--- a/jpeg.c
+++ b/jpeg.c
@@ -23,6 +23,7 @@
 
 
 #include "quakedef.h"
+#include "image.h"
 #include "jpeg.h"
 
 
@@ -394,20 +395,25 @@ Try to load the JPEG DLL
 */
 qboolean JPEG_OpenLibrary (void)
 {
-       const char* dllname;
+       const char* dllnames [] =
+       {
+#ifdef WIN32
+               "libjpeg.dll",
+#elif defined(MACOSX)
+               "libjpeg.62.dylib",
+#else
+               "libjpeg.so.62",
+               "libjpeg.so",
+#endif
+               NULL
+       };
 
        // Already loaded?
        if (jpeg_dll)
                return true;
 
-#ifdef WIN32
-       dllname = "libjpeg.dll";
-#else
-       dllname = "libjpeg.so.62";
-#endif
-
        // Load the DLL
-       if (! Sys_LoadLibrary (dllname, &jpeg_dll, jpegfuncs))
+       if (! Sys_LoadLibrary (dllnames, &jpeg_dll, jpegfuncs))
        {
                Con_Printf ("JPEG support disabled\n");
                return false;
@@ -462,7 +468,7 @@ static void JPEG_SkipInputData (j_decompress_ptr cinfo, long num_bytes)
     cinfo->src->bytes_in_buffer -= num_bytes;
 }
 
-static void JPEG_MemSrc (j_decompress_ptr cinfo, qbyte *buffer)
+static void JPEG_MemSrc (j_decompress_ptr cinfo, const qbyte *buffer)
 {
        cinfo->src = cinfo->mem->alloc_small ((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof (struct jpeg_source_mgr));
 
@@ -490,7 +496,7 @@ JPEG_LoadImage
 Load a JPEG image into a RGBA buffer
 ====================
 */
-qbyte* JPEG_LoadImage (qbyte *f, int matchwidth, int matchheight)
+qbyte* JPEG_LoadImage (const qbyte *f, int matchwidth, int matchheight)
 {
        struct jpeg_decompress_struct cinfo;
        struct jpeg_error_mgr jerr;
@@ -665,7 +671,7 @@ qboolean JPEG_SaveImage_preflipped (const char *filename, int width, int height,
        }
 
        // Open the file
-       file = FS_Open (filename, "wb", true);
+       file = FS_Open (filename, "wb", true, false);
        if (!file)
                return false;