Merge pull request #966 from drewbarbs/db_fix_png_write
Fix Texture Font Generator PNG write
This commit is contained in:
@@ -90,7 +90,7 @@ static bool RageSurface_Save_PNG( RageFile &f, char szErrorbuf[1024], RageSurfac
|
|||||||
png_info *pInfo = png_create_info_struct(pPng);
|
png_info *pInfo = png_create_info_struct(pPng);
|
||||||
if( pInfo == NULL )
|
if( pInfo == NULL )
|
||||||
{
|
{
|
||||||
png_destroy_read_struct( &pPng, NULL, NULL );
|
png_destroy_write_struct( &pPng, NULL );
|
||||||
if( bDeleteImg )
|
if( bDeleteImg )
|
||||||
delete pImg;
|
delete pImg;
|
||||||
sprintf( szErrorbuf, "creating png_create_info_struct failed");
|
sprintf( szErrorbuf, "creating png_create_info_struct failed");
|
||||||
@@ -99,7 +99,7 @@ static bool RageSurface_Save_PNG( RageFile &f, char szErrorbuf[1024], RageSurfac
|
|||||||
|
|
||||||
if( setjmp(png_jmpbuf(pPng)) )
|
if( setjmp(png_jmpbuf(pPng)) )
|
||||||
{
|
{
|
||||||
png_destroy_read_struct( &pPng, &pInfo, NULL );
|
png_destroy_write_struct( &pPng, &pInfo );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -162,14 +162,14 @@ bool SavePNG( FILE *f, char szErrorbuf[1024], const Surface *pSurf )
|
|||||||
png_info *pInfo = png_create_info_struct(pPng);
|
png_info *pInfo = png_create_info_struct(pPng);
|
||||||
if( pInfo == NULL )
|
if( pInfo == NULL )
|
||||||
{
|
{
|
||||||
png_destroy_read_struct( &pPng, NULL, NULL );
|
png_destroy_write_struct( &pPng, NULL );
|
||||||
sprintf( szErrorbuf, "creating png_create_info_struct failed");
|
sprintf( szErrorbuf, "creating png_create_info_struct failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( setjmp(png_jmpbuf(pPng)) )
|
if( setjmp(png_jmpbuf(pPng)) )
|
||||||
{
|
{
|
||||||
png_destroy_read_struct( &pPng, &pInfo, NULL );
|
png_destroy_write_struct( &pPng, &pInfo );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,7 +180,6 @@ bool SavePNG( FILE *f, char szErrorbuf[1024], const Surface *pSurf )
|
|||||||
PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE );
|
PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE );
|
||||||
|
|
||||||
png_write_info( pPng, pInfo );
|
png_write_info( pPng, pInfo );
|
||||||
png_set_filler( pPng, 0, PNG_FILLER_AFTER );
|
|
||||||
|
|
||||||
png_byte *pixels = (png_byte *) pSurf->pRGBA;
|
png_byte *pixels = (png_byte *) pSurf->pRGBA;
|
||||||
for( int y = 0; y < pSurf->iHeight; y++ )
|
for( int y = 0; y < pSurf->iHeight; y++ )
|
||||||
|
|||||||
Reference in New Issue
Block a user