Commits

ont committed 4973944

(f) fixing deprecated libpng things + boost/SCons tuning

  • Participants
  • Parent commits 7948cbf

Comments (0)

Files changed (3)

             self.optional_defines += [('HAVE_SPACE_NAVIGATOR', 1)]
             self.optional_libs    += ['spnav']
 
-        if not conf.CheckLibWithHeader("boost_thread", "boost/thread.hpp", "c++", autoadd=0):
-            print "Error: boost_thread is missing"
-            Exit(1)
+        #if not conf.CheckLibWithHeader("boost_thread", "boost/thread.hpp", "c++", autoadd=0):
+        #    print "Error: boost_thread is missing"
+        #    Exit(1)
             
         if not conf.CheckLibWithHeader("boost_signals", "boost/signals.hpp", "c++", autoadd=0):
             print "Error: boost_signals is missing"
     def build_libgalapix(self):
         self.libgalapix_env = self.env.Clone()
         self.libgalapix_env.Append(CPPDEFINES = self.optional_defines,
-                                   LIBS = ['GL', 'GLEW', 'sqlite3', 'jpeg', 'exif', 'boost_thread', 'boost_signals'] + self.optional_libs)
+                                   LIBS = ['GL', 'GLEW', 'sqlite3', 'jpeg', 'exif', 'boost_thread', 'boost_signals', 'boost_system'] + self.optional_libs)
         self.libgalapix_env.ParseConfig('pkg-config libpng --libs --cflags | sed "s/-I/-isystem/g"')
         self.libgalapix_env.ParseConfig('sdl-config --cflags --libs | sed "s/-I/-isystem/g"')
         self.libgalapix_env.ParseConfig('Magick++-config --libs --cppflags | sed "s/-I/-isystem/g"')
         sdl_env = self.env.Clone()
         sdl_env.Append(CPPDEFINES = ['GALAPIX_SDL'] + self.optional_defines,
                        LIBS = [self.libgalapix, self.libgalapix_util,
-                               'GL', 'GLEW', 'sqlite3', 'jpeg', 'exif', 'boost_thread', 'boost_signals'] + self.optional_libs,
+                               'GL', 'GLEW', 'sqlite3', 'jpeg', 'exif', 'boost_thread', 'boost_signals', 'boost_system'] + self.optional_libs,
                        OBJPREFIX="sdl.")
         sdl_env.ParseConfig('pkg-config libpng --libs --cflags | sed "s/-I/-isystem/g"')
         sdl_env.ParseConfig('sdl-config --cflags --libs | sed "s/-I/-isystem/g"')
         gtk_env = self.env.Clone()
         gtk_env.Append(CPPDEFINES = ['GALAPIX_GTK'] + self.optional_defines,
                        LIBS = [self.libgalapix, self.libgalapix_util,
-                               'GL', 'GLEW', 'sqlite3', 'jpeg', 'exif', 'boost_thread', 'boost_signals'] + self.optional_libs,
+                               'GL', 'GLEW', 'sqlite3', 'jpeg', 'exif', 'boost_thread', 'boost_signals', 'boost_system'] + self.optional_libs,
                        OBJPREFIX="gtk.")
         gtk_env.ParseConfig('pkg-config libpng --libs --cflags | sed "s/-I/-isystem/g"')
         gtk_env.ParseConfig('sdl-config --cflags --libs | sed "s/-I/-isystem/g"')

File src/plugins/imagemagick.cpp

 
 #include "util/url.hpp"
 #include "math/size.hpp"
+
+using namespace MagickCore;
 
 bool
 Imagemagick::get_size(const std::string& filename, Size& size)
 {
-  try 
+  try
   {
     Magick::Image image(filename);
-  
+
     size.width  = image.columns();
     size.height = image.rows();
 
     return true;
-  } 
-  catch(std::exception& err) 
+  }
+  catch(std::exception& err)
   {
     std::cout << "Imagemagick: " << filename << ": " << err.what() << std::endl;
     return false;
   }
 }
 
-static 
+static
 SoftwareSurfacePtr
 MagickImage2SoftwareSurface(const Magick::Image& image)
 {
   int height = image.rows();
 
   int shift;
-  if (MaxRGB == 65535)
+  if (QuantumRange == 65535)
     shift = 8;
-  else if (MaxRGB == 255)
+  else if (QuantumRange == 255)
     shift = 0;
   else
     assert(!"Imagemagick: Unknown MaxRGB");
 
   if (image.matte())
   {
-    surface = SoftwareSurface::create(SoftwareSurface::RGBA_FORMAT, 
+    surface = SoftwareSurface::create(SoftwareSurface::RGBA_FORMAT,
                                       Size(width, height));
 
     for(int y = 0; y < height; ++y)
   }
   else
   {
-    surface = SoftwareSurface::create(SoftwareSurface::RGB_FORMAT, 
+    surface = SoftwareSurface::create(SoftwareSurface::RGB_FORMAT,
                                       Size(width, height));
     for(int y = 0; y < height; ++y)
     {
         dst_pixels[3*x + 2] = static_cast<uint8_t>(src_pixels[x].blue  >> shift);
       }
     }
-  }  
+  }
 
   return surface;
 }
 Imagemagick::load_from_mem(void* data, int len)
 {
   // FIXME: Magick::Blob creates an unneeded copy of the data
-  return MagickImage2SoftwareSurface(Magick::Image(Magick::Blob(data, len))); 
+  return MagickImage2SoftwareSurface(Magick::Image(Magick::Blob(data, len)));
 }
 
 SoftwareSurfacePtr

File src/plugins/png.cpp

 
 void readPNGMemory(png_structp png_ptr, png_bytep data, png_size_t length)
 {
-  PNGReadMemory* mem = static_cast<PNGReadMemory*>(png_ptr->io_ptr);
+  PNGReadMemory* mem = static_cast<PNGReadMemory*>(png_get_io_ptr( png_ptr ));
 
   if (mem->pos + length > mem->len)
   {
 
 bool
 PNG::get_size(void* data, int len, Size& size)
-{ 
-  // FIXME: Could install error/warning handling functions here 
+{
+  // FIXME: Could install error/warning handling functions here
   png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
   png_infop info_ptr  = png_create_info_struct(png_ptr);
 
-  if (setjmp(png_ptr->jmpbuf))
+  if (setjmp(png_jmpbuf( png_ptr ) ))
   {
     // FIXME: get a proper error message from libpng
     png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
 
     png_set_read_fn(png_ptr, &png_memory, &readPNGMemory);
 
-    png_read_info(png_ptr, info_ptr); 
+    png_read_info(png_ptr, info_ptr);
 
     size.width  = png_get_image_width(png_ptr, info_ptr);
     size.height = png_get_image_height(png_ptr, info_ptr);
   }
   else
   {
-    // FIXME: Could install error/warning handling functions here 
+    // FIXME: Could install error/warning handling functions here
     png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
     png_infop info_ptr  = png_create_info_struct(png_ptr);
 
-    if (setjmp(png_ptr->jmpbuf))
+    if (setjmp(png_jmpbuf( png_ptr )))
     {
       png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
       log_warning << "PNG::get_size: setjmp: Couldn't load " << filename << std::endl;
     {
       png_init_io(png_ptr, in);
 
-      png_read_info(png_ptr, info_ptr); 
+      png_read_info(png_ptr, info_ptr);
 
       size.width  = png_get_image_width(png_ptr, info_ptr);
       size.height = png_get_image_height(png_ptr, info_ptr);
       png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
 
       fclose(in);
-        
+
       return true;
     }
   }
     png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
     png_infop info_ptr  = png_create_info_struct(png_ptr);
 
-    if (setjmp(png_ptr->jmpbuf))
+    if (setjmp(png_jmpbuf(png_ptr)))
     {
       png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
       throw std::runtime_error("PNG::load_from_mem(): setjmp: Couldn't load " + filename);
 
     png_init_io(png_ptr, in);
 
-    png_read_info(png_ptr, info_ptr); 
-      
+    png_read_info(png_ptr, info_ptr);
+
     // Convert all formats to either RGB or RGBA so we don't have to
     // handle them all seperatly
     png_set_strip_16(png_ptr);
         boost::scoped_array<png_bytep> row_pointers(new png_bytep[height]);
         for (int y = 0; y < height; ++y)
           row_pointers[y] = surface->get_row_data(y);
-            
+
         png_read_image(png_ptr, row_pointers.get());
       }
-      break;           
+      break;
 
       case PNG_COLOR_TYPE_RGB:
       {
         boost::scoped_array<png_bytep> row_pointers(new png_bytep[height]);
         for (int y = 0; y < height; ++y)
           row_pointers[y] = surface->get_row_data(y);
-            
+
         png_read_image(png_ptr, row_pointers.get());
       }
       break;
     png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
 
     fclose(in);
-        
+
     return surface;
   }
 }
   png_memory.len  = len;
   png_memory.pos  = 0;
 
-  if (setjmp(png_ptr->jmpbuf))
+  if (setjmp(png_jmpbuf(png_ptr)))
   {
     png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
     throw std::runtime_error("PNG::load_from_mem(): setjmp: Couldn't load from mem");
 
   png_set_read_fn(png_ptr, &png_memory, &readPNGMemory);
 
-  png_read_info(png_ptr, info_ptr); 
-      
+  png_read_info(png_ptr, info_ptr);
+
   // Convert all formats to either RGB or RGBA so we don't have to
   // handle them all seperatly
   png_set_strip_16(png_ptr);
       boost::scoped_array<png_bytep> row_pointers(new png_bytep[height]);
       for (int y = 0; y < height; ++y)
         row_pointers[y] = surface->get_row_data(y);
-            
+
       png_read_image(png_ptr, row_pointers.get());
     }
-    break;           
+    break;
 
     case PNG_COLOR_TYPE_RGB:
     {
       surface = SoftwareSurface::create(SoftwareSurface::RGB_FORMAT, Size(width, height));
-          
+
       boost::scoped_array<png_bytep> row_pointers(new png_bytep[height]);
       for (int y = 0; y < height; ++y)
         row_pointers[y] = surface->get_row_data(y);
-            
+
       png_read_image(png_ptr, row_pointers.get());
     }
     break;
     png_infop   info_ptr = png_create_info_struct(png_ptr);
     assert(png_ptr && info_ptr);
 
-    if (setjmp(png_ptr->jmpbuf))
+    if (setjmp(png_jmpbuf(png_ptr)))
     {
       fclose(out);
       png_destroy_write_struct(&png_ptr, &info_ptr);
     // set up the output control if you are using standard C streams
     png_init_io(png_ptr, out);
 
-    png_set_IHDR(png_ptr, info_ptr, 
+    png_set_IHDR(png_ptr, info_ptr,
                  surface->get_width(), surface->get_height(), 8,
-                 (surface->get_format() == SoftwareSurface::RGB_FORMAT) ? PNG_COLOR_TYPE_RGB : PNG_COLOR_TYPE_RGBA, 
-                 PNG_INTERLACE_NONE, 
+                 (surface->get_format() == SoftwareSurface::RGB_FORMAT) ? PNG_COLOR_TYPE_RGB : PNG_COLOR_TYPE_RGBA,
+                 PNG_INTERLACE_NONE,
                  PNG_COMPRESSION_TYPE_DEFAULT,
                  PNG_FILTER_TYPE_DEFAULT);
 
 
 void writePNGMemory(png_structp png_ptr, png_bytep data, png_size_t length)
 {
-  PNGWriteMemory* mem = static_cast<PNGWriteMemory*>(png_ptr->io_ptr);
+  PNGWriteMemory* mem = static_cast<PNGWriteMemory*>(png_get_io_ptr( png_ptr ));
   std::copy(data, data+length, std::back_inserter(mem->data));
 }
 
   png_infop   info_ptr = png_create_info_struct(png_ptr);
   assert(png_ptr && info_ptr);
 
-  if (setjmp(png_ptr->jmpbuf))
+  if (setjmp(png_jmpbuf(png_ptr)))
   {
     png_destroy_write_struct(&png_ptr, &info_ptr);
     throw std::runtime_error("PNG::save(): setjmp: Couldn't save to Blob");
   PNGWriteMemory mem;
   png_set_write_fn(png_ptr, &mem, &writePNGMemory, NULL);
 
-  png_set_IHDR(png_ptr, info_ptr, 
+  png_set_IHDR(png_ptr, info_ptr,
                surface->get_width(), surface->get_height(), 8,
-               (surface->get_format() == SoftwareSurface::RGB_FORMAT) ? PNG_COLOR_TYPE_RGB : PNG_COLOR_TYPE_RGBA, 
-               PNG_INTERLACE_NONE, 
+               (surface->get_format() == SoftwareSurface::RGB_FORMAT) ? PNG_COLOR_TYPE_RGB : PNG_COLOR_TYPE_RGBA,
+               PNG_INTERLACE_NONE,
                PNG_COMPRESSION_TYPE_DEFAULT,
                PNG_FILTER_TYPE_DEFAULT);