# include <fstream>
#endif
-#ifndef __WXMAC_X__
+#ifndef __DARWIN__
# include <windows.h>
#endif
#include "wx/msgdlg.h"
#include "wx/bitmap.h"
#include "wx/mac/pnghand.h"
#include "wx/mac/pngread.h"
+#include "wx/mac/private.h"
extern "C" {
#include "png.h"
Width = width; Height = height; Depth = depth;
ColorType = (colortype>=0) ? colortype: ((Depth>8) ? COLORTYPE_COLOR: 0);
delete m_palette;
- delete[] RawImage ;
- RawImage = 0;
- m_palette = 0;
+ m_palette = NULL;
+ delete[] RawImage;
+ RawImage = NULL;
- if (lpbi)
- {
- wxMacDestroyGWorld( lpbi ) ;
+ if (lpbi) {
+ wxMacDestroyGWorld( (GWorldPtr) lpbi ) ;
}
lpbi = wxMacCreateGWorld( Width , Height , Depth);
if (lpbi)
wxPNGReader::~wxPNGReader ( )
{
- delete[] RawImage ;
- if (lpbi) {
- wxMacDestroyGWorld( lpbi ) ;
- }
- delete m_palette;
+ if (RawImage != NULL) {
+ delete[] RawImage ;
+ RawImage = NULL;
+ }
+ if (lpbi) {
+ wxMacDestroyGWorld( (GWorldPtr) lpbi ) ;
+ lpbi = NULL;
+ }
+ if (m_palette != NULL) {
+ delete m_palette;
+ m_palette = NULL;
+ }
}
void wxPNGReader::NullData()
{
if (lpbi) {
- wxMacDestroyGWorld( lpbi ) ;
+ wxMacDestroyGWorld( (GWorldPtr) lpbi ) ;
+ lpbi = NULL;
+ }
+ if (m_palette != NULL) {
+ delete m_palette;
+ m_palette = NULL;
}
- delete m_palette;
- lpbi = NULL;
- m_palette = NULL;
}
wxBitmap* wxPNGReader::GetBitmap(void)
if (!info_ptr)
{
fclose(fp);
- delete(png_ptr);
+ delete png_ptr;
return FALSE;
}
/* set error handling */
{
png_read_destroy(png_ptr, info_ptr, (png_info *)0);
fclose(fp);
- delete(png_ptr);
- delete(info_ptr);
+ delete png_ptr;
+ delete info_ptr;
/* If we get here, we had a problem reading the file */
return FALSE;
GetGWorld( &origPort , &origDevice ) ;
// ignore shapedc
- SetGWorld( lpbi , NULL ) ;
+ SetGWorld( (GWorldPtr) lpbi , NULL ) ;
do
{
// (unsigned char *)iter.GetRow();
png_read_destroy(png_ptr, info_ptr, (png_info *)0);
/* free the structures */
- delete(png_ptr);
- delete(info_ptr);
+ delete png_ptr;
+ delete info_ptr;
/* close the file */
fclose(fp);
if (!info_ptr)
{
fclose(fp);
- delete(png_ptr);
+ delete png_ptr;
return FALSE;
}
{
png_write_destroy(png_ptr);
fclose(fp);
- delete(png_ptr);
- delete(info_ptr);
+ delete png_ptr;
+ delete info_ptr;
/* If we get here, we had a problem reading the file */
return FALSE;
delete[] (info_ptr->palette);
/* free the structures */
- delete(png_ptr);
- delete(info_ptr);
+ delete png_ptr;
+ delete info_ptr;
/* close the file */
fclose(fp);
if ( !GetPalette() )
return FALSE;
- ofstream str(filename);
+ wxSTD ofstream str(filename);
if ( str.bad() )
return FALSE;
return FALSE;
}
-bool wxPNGFileHandler::SaveFile(wxBitmap *bitmap, const wxString& name, int type, const wxPalette *pal)
+bool wxPNGFileHandler::SaveFile(const wxBitmap *bitmap, const wxString& name, int type, const wxPalette *pal)
{
return FALSE;
}