#include "wx/filefn.h"
#include "wx/wfstream.h"
-
-#if wxUSE_XPM
- #include "wx/xpmdecod.h"
-#endif
+#include "wx/xpmdecod.h"
// For memcpy
#include <string.h>
}
#endif // wxUSE_STREAMS
-wxImage::wxImage( const char** xpmData )
+wxImage::wxImage(const char* const* xpmData)
{
Create(xpmData);
}
-wxImage::wxImage( char** xpmData )
-{
- Create((const char**) xpmData);
-}
-
-bool wxImage::Create( const char** xpmData )
+bool wxImage::Create(const char* const* xpmData)
{
#if wxUSE_XPM
UnRef();
}
// If the original image has a mask, apply the mask to the new image
- if (M_IMGDATA->m_hasMask)
+ if (M_IMGDATA->m_hasMask)
{
image.SetMaskColour( M_IMGDATA->m_maskRed,
M_IMGDATA->m_maskGreen,
averaged_pixels = 0;
sum_r = sum_g = sum_b = sum_a = 0.0;
- for ( int j = src_y - scale_factor_y_2 + 1;
+ for ( int j = int(src_y - scale_factor_y/2.0 + 1);
j <= int(src_y + scale_factor_y_2);
j++ )
{
if ( j < 0 || j > M_IMGDATA->m_height )
continue;
- for ( int i = src_x - scale_factor_x_2 + 1;
+ for ( int i = int(src_x - scale_factor_x/2.0 + 1);
i <= src_x + scale_factor_x_2;
i++ )
{
sum_a += src_alpha[pixel_idx];
// Save off the averaged data
- dst = dst_data + x*3 + y*M_IMGDATA->m_width;
+ dst = dst_data + x*3 + y*M_IMGDATA->m_width*3;
dst[0] = (unsigned char)(sum_r / blurArea);
dst[1] = (unsigned char)(sum_g / blurArea);
dst[2] = (unsigned char)(sum_b / blurArea);
{
for (int i = 0; i < width; i+=3)
{
- if ((source_data[i] != r) &&
- (source_data[i+1] != g) &&
+ if ((source_data[i] != r) ||
+ (source_data[i+1] != g) ||
(source_data[i+2] != b))
{
memcpy( target_data+i, source_data+i, 3 );
return M_IMGDATA->m_data[pos+2];
}
-bool wxImage::Ok() const
+bool wxImage::IsOk() const
{
// image of 0 width or height can't be considered ok - at least because it
// causes crashes in ConvertToBitmap() if we don't catch it in time