fp.h used by libpng issue

Member
Posts: 306
Joined: 2009.03
Post: #1
Has anyone who has used libpng experienced the issue that you cannot compile due to fp.h being missing? I searched my hard disk and fp.h only exists in the simulator sdk and not the device sdk. Even if I set my default sdk to simluator it still cannot find fp.h
Also when I run with libpng(by removing the fp.h include and forcing it to use math.h), it works fine on the simulator but it errors out on the device at doing the:
setjmp(png_jmpbuf(png_ptr)
call when setting up a png

If anyone has any thoughts please do share.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
Works great for me. Compiles fine OOTB, runs fine.
Quote this message in a reply
Member
Posts: 440
Joined: 2002.09
Post: #3
Not sure what the problem might be but if you're just loading your PNG files (as opposed to any PNG file) you might want to try a lightweight loader like: http://www.nothings.org/stb_image.c
Quote this message in a reply
Member
Posts: 306
Joined: 2009.03
Post: #4
I need to load any png that I have control over, so if its a format thing I could ensure they are all 24 bit rbga if thats what you mean?
Quote this message in a reply
Member
Posts: 440
Joined: 2002.09
Post: #5
Ya - it can't handle every little quirk of the format but you can easily avoid incompatibilities with your own files.
Quote this message in a reply
Member
Posts: 306
Joined: 2009.03
Post: #6
Thanks ill give that a try
Quote this message in a reply
Member
Posts: 306
Joined: 2009.03
Post: #7
I finally got around to trying this. Worked easily and great on simulator. When I went to device I get very long load times, an almost entirely black screen with 2 white boxes... And then after a bit a crash on some logic that copies an image that stbi gave me into a power of 2 sized array which works fine on the simulator
Code:
unsigned char* pixels = calloc( width2 * height2 * 4, sizeof(unsigned char) );
int rowsize1=width*4;//4 bits per pixel
int actualRowSize1=width*bpp;
int rowsize2=width2*4;
//copy the data to an outer array of the width2,height2 size
for(int i=0;i<height;i++)
{
    for(int j=0;j<rowsize1;j++)
    {
        if(bpp==3)
        {
//Here we need hard set the alpha to 255 and take that into account in our index into the source array.
            pixels[i*rowsize2+j]=((j+1)%4==0)?255:data[i*actualRowSize1+j-(j/4)];
        }
        else
        {
            pixels[i*rowsize2+j]=data[i*rowsize1+j];
            }
    }
}
Quote this message in a reply
Member
Posts: 306
Joined: 2009.03
Post: #8
Ah nevermind, just had to uncheck compress pngs in the build settings.
Quote this message in a reply
Post Reply