Silence warning about uninitialised variable.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@28562 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Ron Lee
2004-07-31 14:16:15 +00:00
parent 6183c6481b
commit 1148e779b8
2 changed files with 48 additions and 48 deletions

View File

@@ -329,9 +329,9 @@ bool wxBitmap::CreateFromXpm( const char **bits )
if (!M_BMPDATA->m_pixmap) if (!M_BMPDATA->m_pixmap)
{ {
UnRef(); UnRef();
wxFAIL_MSG( wxT("couldn't create pixmap") ); wxFAIL_MSG( wxT("couldn't create pixmap") );
return FALSE; return FALSE;
} }
@@ -869,7 +869,7 @@ wxBitmap::wxBitmap( const char bits[], int width, int height, int WXUNUSED(depth
if (!M_BMPDATA->m_bitmap) if (!M_BMPDATA->m_bitmap)
{ {
UnRef(); UnRef();
wxFAIL_MSG( wxT("couldn't create bitmap") ); wxFAIL_MSG( wxT("couldn't create bitmap") );
} }
} }
@@ -998,7 +998,7 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
if (newy==M_BMPDATA->m_width && newy==M_BMPDATA->m_height) if (newy==M_BMPDATA->m_width && newy==M_BMPDATA->m_height)
return *this; return *this;
GdkImage *img = (GdkImage*) NULL; GdkImage *img = (GdkImage*) NULL;
if (GetPixmap()) if (GetPixmap())
img = gdk_image_get( GetPixmap(), 0, 0, GetWidth(), GetHeight() ); img = gdk_image_get( GetPixmap(), 0, 0, GetWidth(), GetHeight() );
@@ -1016,7 +1016,7 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
int height = wxMax(newy, 1); int height = wxMax(newy, 1);
width = wxMin(width, clipwidth); width = wxMin(width, clipwidth);
height = wxMin(height, clipheight); height = wxMin(height, clipheight);
GdkGC *gc = NULL; GdkGC *gc = NULL;
GdkPixmap *dstpix = NULL; GdkPixmap *dstpix = NULL;
if (GetPixmap()) if (GetPixmap())
@@ -1033,7 +1033,7 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
char *dst = NULL; char *dst = NULL;
long dstbyteperline = 0; long dstbyteperline = 0;
if (GetBitmap()) if (GetBitmap())
{ {
bpp = 1; bpp = 1;
@@ -1042,7 +1042,7 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
dstbyteperline++; dstbyteperline++;
dst = (char*) malloc(dstbyteperline*height); dst = (char*) malloc(dstbyteperline*height);
} }
// be careful to use the right scaling factor // be careful to use the right scaling factor
float scx = (float)M_BMPDATA->m_width/(float)newx; float scx = (float)M_BMPDATA->m_width/(float)newx;
float scy = (float)M_BMPDATA->m_height/(float)newy; float scy = (float)M_BMPDATA->m_height/(float)newy;
@@ -1059,9 +1059,9 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
// Main rescaling routine starts here // Main rescaling routine starts here
for (int h = 0; h < height; h++) for (int h = 0; h < height; h++)
{ {
char outbyte = 0; char outbyte = 0;
int old_x = -1; int old_x = -1;
guint32 old_pixval; guint32 old_pixval = 0;
for (int w = 0; w < width; w++) for (int w = 0; w < width; w++)
{ {
@@ -1075,7 +1075,7 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
old_pixval = pixval; old_pixval = pixval;
old_x = x; old_x = x;
} }
if (bpp == 1) if (bpp == 1)
{ {
if (!pixval) if (!pixval)
@@ -1084,7 +1084,7 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
char shift = bit << w % 8; char shift = bit << w % 8;
outbyte |= shift; outbyte |= shift;
} }
if ((w+1)%8==0) if ((w+1)%8==0)
{ {
dst[h*dstbyteperline+w/8] = outbyte; dst[h*dstbyteperline+w/8] = outbyte;
@@ -1099,12 +1099,12 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
gdk_draw_point( dstpix, gc, w, h); gdk_draw_point( dstpix, gc, w, h);
} }
} }
// do not forget the last byte // do not forget the last byte
if ((bpp == 1) && (width % 8 != 0)) if ((bpp == 1) && (width % 8 != 0))
dst[h*dstbyteperline+width/8] = outbyte; dst[h*dstbyteperline+width/8] = outbyte;
} }
gdk_image_destroy( img ); gdk_image_destroy( img );
if (gc) gdk_gc_unref( gc ); if (gc) gdk_gc_unref( gc );
@@ -1113,7 +1113,7 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
bmp = wxBitmap( (const char *)dst, width, height, 1 ); bmp = wxBitmap( (const char *)dst, width, height, 1 );
free( dst ); free( dst );
} }
if (GetMask()) if (GetMask())
{ {
dstbyteperline = width/8; dstbyteperline = width/8;
@@ -1124,10 +1124,10 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
for (int h = 0; h < height; h++) for (int h = 0; h < height; h++)
{ {
char outbyte = 0; char outbyte = 0;
int old_x = -1; int old_x = -1;
guint32 old_pixval; guint32 old_pixval = 0;
for (int w = 0; w < width; w++) for (int w = 0; w < width; w++)
{ {
guint32 pixval; guint32 pixval;
@@ -1140,21 +1140,21 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
old_pixval = pixval; old_pixval = pixval;
old_x = x; old_x = x;
} }
if (pixval) if (pixval)
{ {
char bit=1; char bit=1;
char shift = bit << w % 8; char shift = bit << w % 8;
outbyte |= shift; outbyte |= shift;
} }
if ((w+1)%8 == 0) if ((w+1)%8 == 0)
{ {
dst[h*dstbyteperline+w/8] = outbyte; dst[h*dstbyteperline+w/8] = outbyte;
outbyte = 0; outbyte = 0;
} }
} }
// do not forget the last byte // do not forget the last byte
if (width % 8 != 0) if (width % 8 != 0)
dst[h*dstbyteperline+width/8] = outbyte; dst[h*dstbyteperline+width/8] = outbyte;
@@ -1169,8 +1169,8 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
free( tablex ); free( tablex );
free( tabley ); free( tabley );
return bmp; return bmp;
} }

View File

@@ -329,9 +329,9 @@ bool wxBitmap::CreateFromXpm( const char **bits )
if (!M_BMPDATA->m_pixmap) if (!M_BMPDATA->m_pixmap)
{ {
UnRef(); UnRef();
wxFAIL_MSG( wxT("couldn't create pixmap") ); wxFAIL_MSG( wxT("couldn't create pixmap") );
return FALSE; return FALSE;
} }
@@ -869,7 +869,7 @@ wxBitmap::wxBitmap( const char bits[], int width, int height, int WXUNUSED(depth
if (!M_BMPDATA->m_bitmap) if (!M_BMPDATA->m_bitmap)
{ {
UnRef(); UnRef();
wxFAIL_MSG( wxT("couldn't create bitmap") ); wxFAIL_MSG( wxT("couldn't create bitmap") );
} }
} }
@@ -998,7 +998,7 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
if (newy==M_BMPDATA->m_width && newy==M_BMPDATA->m_height) if (newy==M_BMPDATA->m_width && newy==M_BMPDATA->m_height)
return *this; return *this;
GdkImage *img = (GdkImage*) NULL; GdkImage *img = (GdkImage*) NULL;
if (GetPixmap()) if (GetPixmap())
img = gdk_image_get( GetPixmap(), 0, 0, GetWidth(), GetHeight() ); img = gdk_image_get( GetPixmap(), 0, 0, GetWidth(), GetHeight() );
@@ -1016,7 +1016,7 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
int height = wxMax(newy, 1); int height = wxMax(newy, 1);
width = wxMin(width, clipwidth); width = wxMin(width, clipwidth);
height = wxMin(height, clipheight); height = wxMin(height, clipheight);
GdkGC *gc = NULL; GdkGC *gc = NULL;
GdkPixmap *dstpix = NULL; GdkPixmap *dstpix = NULL;
if (GetPixmap()) if (GetPixmap())
@@ -1033,7 +1033,7 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
char *dst = NULL; char *dst = NULL;
long dstbyteperline = 0; long dstbyteperline = 0;
if (GetBitmap()) if (GetBitmap())
{ {
bpp = 1; bpp = 1;
@@ -1042,7 +1042,7 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
dstbyteperline++; dstbyteperline++;
dst = (char*) malloc(dstbyteperline*height); dst = (char*) malloc(dstbyteperline*height);
} }
// be careful to use the right scaling factor // be careful to use the right scaling factor
float scx = (float)M_BMPDATA->m_width/(float)newx; float scx = (float)M_BMPDATA->m_width/(float)newx;
float scy = (float)M_BMPDATA->m_height/(float)newy; float scy = (float)M_BMPDATA->m_height/(float)newy;
@@ -1059,9 +1059,9 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
// Main rescaling routine starts here // Main rescaling routine starts here
for (int h = 0; h < height; h++) for (int h = 0; h < height; h++)
{ {
char outbyte = 0; char outbyte = 0;
int old_x = -1; int old_x = -1;
guint32 old_pixval; guint32 old_pixval = 0;
for (int w = 0; w < width; w++) for (int w = 0; w < width; w++)
{ {
@@ -1075,7 +1075,7 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
old_pixval = pixval; old_pixval = pixval;
old_x = x; old_x = x;
} }
if (bpp == 1) if (bpp == 1)
{ {
if (!pixval) if (!pixval)
@@ -1084,7 +1084,7 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
char shift = bit << w % 8; char shift = bit << w % 8;
outbyte |= shift; outbyte |= shift;
} }
if ((w+1)%8==0) if ((w+1)%8==0)
{ {
dst[h*dstbyteperline+w/8] = outbyte; dst[h*dstbyteperline+w/8] = outbyte;
@@ -1099,12 +1099,12 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
gdk_draw_point( dstpix, gc, w, h); gdk_draw_point( dstpix, gc, w, h);
} }
} }
// do not forget the last byte // do not forget the last byte
if ((bpp == 1) && (width % 8 != 0)) if ((bpp == 1) && (width % 8 != 0))
dst[h*dstbyteperline+width/8] = outbyte; dst[h*dstbyteperline+width/8] = outbyte;
} }
gdk_image_destroy( img ); gdk_image_destroy( img );
if (gc) gdk_gc_unref( gc ); if (gc) gdk_gc_unref( gc );
@@ -1113,7 +1113,7 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
bmp = wxBitmap( (const char *)dst, width, height, 1 ); bmp = wxBitmap( (const char *)dst, width, height, 1 );
free( dst ); free( dst );
} }
if (GetMask()) if (GetMask())
{ {
dstbyteperline = width/8; dstbyteperline = width/8;
@@ -1124,10 +1124,10 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
for (int h = 0; h < height; h++) for (int h = 0; h < height; h++)
{ {
char outbyte = 0; char outbyte = 0;
int old_x = -1; int old_x = -1;
guint32 old_pixval; guint32 old_pixval = 0;
for (int w = 0; w < width; w++) for (int w = 0; w < width; w++)
{ {
guint32 pixval; guint32 pixval;
@@ -1140,21 +1140,21 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
old_pixval = pixval; old_pixval = pixval;
old_x = x; old_x = x;
} }
if (pixval) if (pixval)
{ {
char bit=1; char bit=1;
char shift = bit << w % 8; char shift = bit << w % 8;
outbyte |= shift; outbyte |= shift;
} }
if ((w+1)%8 == 0) if ((w+1)%8 == 0)
{ {
dst[h*dstbyteperline+w/8] = outbyte; dst[h*dstbyteperline+w/8] = outbyte;
outbyte = 0; outbyte = 0;
} }
} }
// do not forget the last byte // do not forget the last byte
if (width % 8 != 0) if (width % 8 != 0)
dst[h*dstbyteperline+width/8] = outbyte; dst[h*dstbyteperline+width/8] = outbyte;
@@ -1169,8 +1169,8 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
free( tablex ); free( tablex );
free( tabley ); free( tabley );
return bmp; return bmp;
} }