/////////////////////////////////////////////////////////////////////////////
-// Name: imagbmp.cpp
+// Name: src/common/imagbmp.cpp
// Purpose: wxImage BMP,ICO and CUR handlers
// Author: Robert Roebling, Chris Elliott
// RCS-ID: $Id$
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "imagbmp.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
-#pragma hdrstop
+ #pragma hdrstop
#endif
-#include "wx/defs.h"
-
#if wxUSE_IMAGE
+#ifndef WX_PRECOMP
+ #include "wx/log.h"
+ #include "wx/app.h"
+#endif
+
#include "wx/imagbmp.h"
#include "wx/bitmap.h"
-#include "wx/debug.h"
-#include "wx/log.h"
-#include "wx/app.h"
#include "wx/filefn.h"
#include "wx/wfstream.h"
#include "wx/intl.h"
else if ( (format == wxBMP_8BPP_GREY) || (format == wxBMP_8BPP_RED) ||
(format == wxBMP_1BPP_BW) )
{
- int i;
rgbquad = new wxUint8 [palette_size*4];
- for (i = 0; i < palette_size; i++)
+ for ( int i = 0; i < palette_size; i++ )
{
- // if 1BPP_BW then just 0 and 255 then exit
- if (( i > 0) && (format == wxBMP_1BPP_BW)) i = 255;
- rgbquad[i*4] = rgbquad[i*4+1] = rgbquad[i*4+2] = (wxUint8)i;
+ // if 1BPP_BW then the value should be either 0 or 255
+ wxUint8 c = (wxUint8)((i > 0) && (format == wxBMP_1BPP_BW) ? 255 : i);
+
+ rgbquad[i*4] =
+ rgbquad[i*4+1] =
+ rgbquad[i*4+2] = c;
rgbquad[i*4+3] = 0;
}
}
return false;
}
- int images = 1; // only generate one image
+ const int images = 1; // only generate one image
// VS: This is a hack of sort - since ICO and CUR files are almost
// identical, we have all the meat in wxICOHandler and check for
// for each iamage write a description ICONDIRENTRY:
ICONDIRENTRY icondirentry;
- for (int i = 0; i < images; i++)
+ for (int img = 0; img < images; img++)
{
wxImage mask;