#endif
#include <windows.h>
-#include <wx/palette.h>
-#include <wx/bitmap.h>
-#include <wx/msw/pngread.h>
-#include <wx/msw/dibutils.h>
+#include "wx/palette.h"
+#include "wx/bitmap.h"
+#include "wx/utils.h"
+#include "wx/msw/pngread.h"
+#include "wx/msw/dibutils.h"
extern "C" {
#include "../png/png.h"
}
RawImage = 0;
Palette = 0;
- lpbi = DibCreate(Depth, Width, Height);
+ lpbi = wxDibCreate(Depth, Width, Height);
if (lpbi) {
- RawImage = (ImagePointerType)DibPtr(lpbi);
+ RawImage = (ImagePointerType)wxDibPtr(lpbi);
EfeWidth = (long)(((long)Width*Depth + 31) / 32) * 4;
imageOK = TRUE;
}
return FALSE;
ColorType |= (COLORTYPE_PALETTE | COLORTYPE_COLOR);
Palette = colourmap;
- return (DibSetUsage(lpbi, (HPALETTE) Palette->GetHPALETTE(), WXIMA_COLORS ) != 0);
+ return (wxDibSetUsage(lpbi, (HPALETTE) Palette->GetHPALETTE(), WXIMA_COLORS ) != 0);
}
bool
if (!b) b = g;
Palette->Create(n, r, g, b);
ColorType |= (COLORTYPE_PALETTE | COLORTYPE_COLOR);
- return (DibSetUsage(lpbi, (HPALETTE) Palette->GetHPALETTE(), WXIMA_COLORS ) != 0);
+ return (wxDibSetUsage(lpbi, (HPALETTE) Palette->GetHPALETTE(), WXIMA_COLORS ) != 0);
}
bool
Palette->Create(n, r, g, b);
ColorType |= (COLORTYPE_PALETTE | COLORTYPE_COLOR);
- return (DibSetUsage(lpbi, (HPALETTE) Palette->GetHPALETTE(), WXIMA_COLORS ) != 0);
+ return (wxDibSetUsage(lpbi, (HPALETTE) Palette->GetHPALETTE(), WXIMA_COLORS ) != 0);
}
void wxPNGReader::NullData()
bitmap->SetDepth(GetDepth());
if ( GetDepth() > 1 && Palette )
bitmap->SetPalette(*Palette);
+#if WXWIN_COMPATIBILITY_2
bitmap->SetOk(TRUE);
-
+#endif // WXWIN_COMPATIBILITY_2
// Make a mask if appropriate
if ( bgindex > -1 )
bool wxPNGReader::ReadFile(wxChar * ImageFileName)
{
- int number_passes;
-
if (ImageFileName)
wxStrcpy(filename, ImageFileName);
- FILE *fp;
- png_struct *png_ptr;
- png_info *info_ptr;
-
/* open the file */
- fp = fopen(wxConvFile.cWX2MB(filename), "rb");
+ FILE *fp = fopen(wxConvFile.cWX2MB(filename), "rb");
if (!fp)
return FALSE;
/* allocate the necessary structures */
- png_ptr = new (png_struct);
+ png_struct *png_ptr = new (png_struct);
if (!png_ptr)
{
fclose(fp);
return FALSE;
}
- info_ptr = new (png_info);
+ png_info *info_ptr = new (png_info);
if (!info_ptr)
{
fclose(fp);
delete(png_ptr);
return FALSE;
}
+
/* set error handling */
if (setjmp(png_ptr->jmpbuf))
{
byte *row_pointers = new byte[row_stride];
/* turn on interlace handling */
+ int number_passes;
if (info_ptr->interlace_type)
number_passes = png_set_interlace_handling(png_ptr);
else
return TRUE;
}
-#include <wx/msw/pnghand.h>
+#include "wx/msw/pnghand.h"
IMPLEMENT_DYNAMIC_CLASS(wxPNGFileHandler, wxBitmapHandler)