adonthell-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Adonthell-devel] Compile error


From: Josh Glover
Subject: Re: [Adonthell-devel] Compile error
Date: Thu, 7 Jun 2012 11:07:02 +0200

2012/6/7 Josh Glover <address@hidden>:

> Oops! That was Eclipse changing stuff behind my back. Sorry, I'll redo
> the fix without the changes.

Done!

git diff 6f2eb55011db7405a261ad148d72c64815bacef4
fdec266c0b432bbec14c2405371bdf671e3bf1d7 -- src/gfx/png_wrapper.cc
diff --git a/src/gfx/png_wrapper.cc b/src/gfx/png_wrapper.cc
index 9602b43..2389783 100644
--- a/src/gfx/png_wrapper.cc
+++ b/src/gfx/png_wrapper.cc
@@ -104,8 +104,8 @@ namespace gfx

         png_read_info(png_ptr, info_ptr);

-        length = info_ptr->width;
-        height = info_ptr->height;
+        length = png_get_image_width(png_ptr, info_ptr);
+        height = png_get_image_height(png_ptr, info_ptr);

         number_of_passes = png_set_interlace_handling(png_ptr);
         png_read_update_info(png_ptr, info_ptr);
@@ -118,12 +118,12 @@ namespace gfx
             return NULL;
         }

-        *alpha = (info_ptr->color_type == PNG_COLOR_TYPE_RGBA);
+        *alpha = (png_get_color_type(png_ptr, info_ptr) ==
PNG_COLOR_TYPE_RGBA);
         const int bytes_per_pixel = (*alpha) ? 4 : 3;
         char *image = (char *)calloc (length * height, bytes_per_pixel);
         int idx = 0;

-        switch (info_ptr->color_type)
+        switch (png_get_color_type(png_ptr, info_ptr))
         {
         case PNG_COLOR_TYPE_RGBA:
         {
@@ -137,7 +137,7 @@ namespace gfx
         {
             row_pointers = (png_bytep*) malloc(sizeof(png_bytep) * height);
             for (int y=0; y<height; y++)
-                row_pointers[y] = (png_byte*) malloc(info_ptr->rowbytes);
+                row_pointers[y] = (png_byte*)
malloc(png_get_rowbytes(png_ptr, info_ptr));

             png_read_image(png_ptr, row_pointers);

@@ -156,7 +156,7 @@ namespace gfx
             break;
         }
         default:
-            LOG(ERROR) << logging::indent() << "[read_png_file]
color_type of input file must be PNG_COLOR_TYPE_RGBA (is " <<
info_ptr->color_type << ")";
+            LOG(ERROR) << logging::indent() << "[read_png_file]
color_type of input file must be PNG_COLOR_TYPE_RGBA (is " <<
png_get_color_type(png_ptr, info_ptr) << ")";
             png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
             return NULL;
         }
@@ -231,7 +231,7 @@ namespace gfx
         row_pointers = (png_bytep*) malloc(sizeof(png_bytep) * height);
         for (int y=0; y<height; y++)
         {
-            row_pointers[y] = (png_byte*) malloc(info_ptr->rowbytes);
+            row_pointers[y] = (png_byte*)
malloc(png_get_rowbytes(png_ptr, info_ptr));
             png_byte* row = row_pointers[y];
             for (int x=0; x<length; x++)
             {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]