2 warnings from Solaris build log fixed
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5637 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -236,15 +236,15 @@ void wxImage::Replace( unsigned char r1, unsigned char g1, unsigned char b1,
|
|||||||
|
|
||||||
for (int j = 0; j < h; j++)
|
for (int j = 0; j < h; j++)
|
||||||
for (int i = 0; i < w; i++)
|
for (int i = 0; i < w; i++)
|
||||||
{
|
{
|
||||||
if ((data[0] == r1) && (data[1] == g1) && (data[2] == b1))
|
if ((data[0] == r1) && (data[1] == g1) && (data[2] == b1))
|
||||||
{
|
{
|
||||||
data[0] = r2;
|
data[0] = r2;
|
||||||
data[1] = g2;
|
data[1] = g2;
|
||||||
data[2] = b2;
|
data[2] = b2;
|
||||||
}
|
}
|
||||||
data += 3;
|
data += 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxImage::SetRGB( int x, int y, unsigned char r, unsigned char g, unsigned char b )
|
void wxImage::SetRGB( int x, int y, unsigned char r, unsigned char g, unsigned char b )
|
||||||
@@ -402,7 +402,7 @@ bool wxImage::LoadFile( const wxString& filename, long type )
|
|||||||
if (wxFileExists(filename))
|
if (wxFileExists(filename))
|
||||||
{
|
{
|
||||||
wxFileInputStream stream(filename);
|
wxFileInputStream stream(filename);
|
||||||
wxBufferedInputStream bstream( stream );
|
wxBufferedInputStream bstream( stream );
|
||||||
return LoadFile(bstream, type);
|
return LoadFile(bstream, type);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -422,7 +422,7 @@ bool wxImage::LoadFile( const wxString& filename, const wxString& mimetype )
|
|||||||
if (wxFileExists(filename))
|
if (wxFileExists(filename))
|
||||||
{
|
{
|
||||||
wxFileInputStream stream(filename);
|
wxFileInputStream stream(filename);
|
||||||
wxBufferedInputStream bstream( stream );
|
wxBufferedInputStream bstream( stream );
|
||||||
return LoadFile(bstream, mimetype);
|
return LoadFile(bstream, mimetype);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -443,7 +443,7 @@ bool wxImage::SaveFile( const wxString& filename, int type )
|
|||||||
|
|
||||||
if ( stream.LastError() == wxStream_NOERROR )
|
if ( stream.LastError() == wxStream_NOERROR )
|
||||||
{
|
{
|
||||||
wxBufferedOutputStream bstream( stream );
|
wxBufferedOutputStream bstream( stream );
|
||||||
return SaveFile(bstream, type);
|
return SaveFile(bstream, type);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -458,7 +458,7 @@ bool wxImage::SaveFile( const wxString& filename, const wxString& mimetype )
|
|||||||
|
|
||||||
if ( stream.LastError() == wxStream_NOERROR )
|
if ( stream.LastError() == wxStream_NOERROR )
|
||||||
{
|
{
|
||||||
wxBufferedOutputStream bstream( stream );
|
wxBufferedOutputStream bstream( stream );
|
||||||
return SaveFile(bstream, mimetype);
|
return SaveFile(bstream, mimetype);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -486,7 +486,7 @@ bool wxImage::CanRead( wxInputStream &stream )
|
|||||||
{
|
{
|
||||||
wxImageHandler *handler=(wxImageHandler*)node->GetData();
|
wxImageHandler *handler=(wxImageHandler*)node->GetData();
|
||||||
if (handler->CanRead( stream ))
|
if (handler->CanRead( stream ))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -884,10 +884,10 @@ wxBitmap wxImage::ConvertToBitmap() const
|
|||||||
for(i=0; i<width; i++ )
|
for(i=0; i<width; i++ )
|
||||||
{
|
{
|
||||||
// was causing a code gen bug in cw : if( ( cr !=r) || (cg!=g) || (cb!=b) )
|
// was causing a code gen bug in cw : if( ( cr !=r) || (cg!=g) || (cb!=b) )
|
||||||
unsigned char cr = (*(ptdata++)) ;
|
unsigned char cr = (*(ptdata++)) ;
|
||||||
unsigned char cg = (*(ptdata++)) ;
|
unsigned char cg = (*(ptdata++)) ;
|
||||||
unsigned char cb = (*(ptdata++)) ;
|
unsigned char cb = (*(ptdata++)) ;
|
||||||
|
|
||||||
if( ( cr !=r) || (cg!=g) || (cb!=b) )
|
if( ( cr !=r) || (cg!=g) || (cb!=b) )
|
||||||
{
|
{
|
||||||
*(ptbits++) = one;
|
*(ptbits++) = one;
|
||||||
@@ -1089,7 +1089,7 @@ wxBitmap wxImage::ConvertToBitmap() const
|
|||||||
|
|
||||||
if (HasMask())
|
if (HasMask())
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
unsigned char *mask_data = (unsigned char*)malloc( ((width >> 3)+8) * height );
|
unsigned char *mask_data = (unsigned char*)malloc( ((width >> 3)+8) * height );
|
||||||
|
|
||||||
mask_image = gdk_image_new_bitmap( gdk_visual_get_system(), mask_data, width, height );
|
mask_image = gdk_image_new_bitmap( gdk_visual_get_system(), mask_data, width, height );
|
||||||
@@ -1107,11 +1107,11 @@ wxBitmap wxImage::ConvertToBitmap() const
|
|||||||
int g_mask = GetMaskGreen();
|
int g_mask = GetMaskGreen();
|
||||||
int b_mask = GetMaskBlue();
|
int b_mask = GetMaskBlue();
|
||||||
|
|
||||||
CGrafPtr origPort ;
|
CGrafPtr origPort ;
|
||||||
GDHandle origDevice ;
|
GDHandle origDevice ;
|
||||||
|
|
||||||
GetGWorld( &origPort , &origDevice ) ;
|
GetGWorld( &origPort , &origDevice ) ;
|
||||||
SetGWorld( bitmap.GetHBITMAP() , NULL ) ;
|
SetGWorld( bitmap.GetHBITMAP() , NULL ) ;
|
||||||
|
|
||||||
register unsigned char* data = GetData();
|
register unsigned char* data = GetData();
|
||||||
|
|
||||||
@@ -1120,18 +1120,18 @@ wxBitmap wxImage::ConvertToBitmap() const
|
|||||||
{
|
{
|
||||||
for (int x = 0; x < width; x++)
|
for (int x = 0; x < width; x++)
|
||||||
{
|
{
|
||||||
unsigned char r = data[index++];
|
unsigned char r = data[index++];
|
||||||
unsigned char g = data[index++];
|
unsigned char g = data[index++];
|
||||||
unsigned char b = data[index++];
|
unsigned char b = data[index++];
|
||||||
RGBColor color ;
|
RGBColor color ;
|
||||||
color.red = ( r << 8 ) + r ;
|
color.red = ( r << 8 ) + r ;
|
||||||
color.green = ( g << 8 ) + g ;
|
color.green = ( g << 8 ) + g ;
|
||||||
color.blue = ( b << 8 ) + b ;
|
color.blue = ( b << 8 ) + b ;
|
||||||
SetCPixel( x , y , &color ) ;
|
SetCPixel( x , y , &color ) ;
|
||||||
}
|
}
|
||||||
} // for height
|
} // for height
|
||||||
|
|
||||||
SetGWorld( origPort , origDevice ) ;
|
SetGWorld( origPort , origDevice ) ;
|
||||||
|
|
||||||
if ( HasMask() )
|
if ( HasMask() )
|
||||||
{
|
{
|
||||||
@@ -1228,7 +1228,7 @@ wxImage::wxImage( const wxBitmap &bitmap )
|
|||||||
ptbits += 3;
|
ptbits += 3;
|
||||||
}
|
}
|
||||||
ptbits += padding;
|
ptbits += padding;
|
||||||
}
|
}
|
||||||
|
|
||||||
// similarly, set data according to the possible mask bitmap
|
// similarly, set data according to the possible mask bitmap
|
||||||
if( bitmap.GetMask() && bitmap.GetMask()->GetMaskBitmap() )
|
if( bitmap.GetMask() && bitmap.GetMask()->GetMaskBitmap() )
|
||||||
@@ -1672,27 +1672,27 @@ wxImage::wxImage( const wxBitmap &bitmap )
|
|||||||
for (int i = 0; i < bitmap.GetWidth(); i++)
|
for (int i = 0; i < bitmap.GetWidth(); i++)
|
||||||
{
|
{
|
||||||
wxUint32 pixel = gdk_image_get_pixel( gdk_image, i, j );
|
wxUint32 pixel = gdk_image_get_pixel( gdk_image, i, j );
|
||||||
if (bpp == 1)
|
if (bpp == 1)
|
||||||
{
|
{
|
||||||
if (pixel == 0)
|
if (pixel == 0)
|
||||||
{
|
{
|
||||||
data[pos] = 0;
|
data[pos] = 0;
|
||||||
data[pos+1] = 0;
|
data[pos+1] = 0;
|
||||||
data[pos+2] = 0;
|
data[pos+2] = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
data[pos] = 255;
|
data[pos] = 255;
|
||||||
data[pos+1] = 255;
|
data[pos+1] = 255;
|
||||||
data[pos+2] = 255;
|
data[pos+2] = 255;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (use_shift)
|
else if (use_shift)
|
||||||
{
|
{
|
||||||
data[pos] = (pixel >> red_shift_right) << red_shift_left;
|
data[pos] = (pixel >> red_shift_right) << red_shift_left;
|
||||||
data[pos+1] = (pixel >> green_shift_right) << green_shift_left;
|
data[pos+1] = (pixel >> green_shift_right) << green_shift_left;
|
||||||
data[pos+2] = (pixel >> blue_shift_right) << blue_shift_left;
|
data[pos+2] = (pixel >> blue_shift_right) << blue_shift_left;
|
||||||
}
|
}
|
||||||
else if (cmap->colors)
|
else if (cmap->colors)
|
||||||
{
|
{
|
||||||
data[pos] = cmap->colors[pixel].red >> 8;
|
data[pos] = cmap->colors[pixel].red >> 8;
|
||||||
@@ -1798,50 +1798,50 @@ private:
|
|||||||
|
|
||||||
wxSearchColor::wxSearchColor( void )
|
wxSearchColor::wxSearchColor( void )
|
||||||
{
|
{
|
||||||
this->size = 0;
|
size = 0;
|
||||||
this->colors = (XColor*) NULL;
|
colors = (XColor*) NULL;
|
||||||
this->color = (unsigned int *) NULL;
|
color = (unsigned int *) NULL;
|
||||||
this->entry = (int*) NULL;
|
entry = (int*) NULL;
|
||||||
|
|
||||||
this->bottom = 0;
|
bottom = 0;
|
||||||
this->top = 0;
|
top = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSearchColor::wxSearchColor( int size, XColor *colors )
|
wxSearchColor::wxSearchColor( int size_, XColor *colors_ )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
this->size = size;
|
size = size_;
|
||||||
this->colors = colors;
|
colors = colors_;
|
||||||
this->color = new unsigned int[size];
|
color = new unsigned int[size];
|
||||||
this->entry = new int [size];
|
entry = new int [size];
|
||||||
|
|
||||||
for (i = 0; i < this->size; i++ ) {
|
for (i = 0; i < size; i++ ) {
|
||||||
this->entry[i] = -1;
|
entry[i] = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->bottom = this->top = ( size >> 1 );
|
bottom = top = ( size >> 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSearchColor::~wxSearchColor( void )
|
wxSearchColor::~wxSearchColor( void )
|
||||||
{
|
{
|
||||||
if ( this->color ) delete this->color;
|
if ( color ) delete color;
|
||||||
if ( this->entry ) delete this->entry;
|
if ( entry ) delete entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxSearchColor::SearchColor( int r, int g, int b )
|
int wxSearchColor::SearchColor( int r, int g, int b )
|
||||||
{
|
{
|
||||||
unsigned int value = ( ( ( r * 256 ) + g ) * 256 ) + b;
|
unsigned int value = ( ( ( r * 256 ) + g ) * 256 ) + b;
|
||||||
int begin = this->bottom;
|
int begin = bottom;
|
||||||
int end = this->top;
|
int end = top;
|
||||||
int middle;
|
int middle;
|
||||||
|
|
||||||
while ( begin <= end ) {
|
while ( begin <= end ) {
|
||||||
|
|
||||||
middle = ( begin + end ) >> 1;
|
middle = ( begin + end ) >> 1;
|
||||||
|
|
||||||
if ( value == this->color[middle] ) {
|
if ( value == color[middle] ) {
|
||||||
return( this->entry[middle] );
|
return( entry[middle] );
|
||||||
} else if ( value < this->color[middle] ) {
|
} else if ( value < color[middle] ) {
|
||||||
end = middle - 1;
|
end = middle - 1;
|
||||||
} else {
|
} else {
|
||||||
begin = middle + 1;
|
begin = middle + 1;
|
||||||
@@ -1865,47 +1865,47 @@ int wxSearchColor::AddColor( unsigned int value, int pos )
|
|||||||
if (sum < max) { pixel = i; max = sum; }
|
if (sum < max) { pixel = i; max = sum; }
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( this->entry[pos] < 0 ) {
|
if ( entry[pos] < 0 ) {
|
||||||
this->color[pos] = value;
|
color[pos] = value;
|
||||||
this->entry[pos] = pixel;
|
entry[pos] = pixel;
|
||||||
} else if ( value < this->color[pos] ) {
|
} else if ( value < color[pos] ) {
|
||||||
|
|
||||||
if ( this->bottom > 0 ) {
|
if ( bottom > 0 ) {
|
||||||
for ( i = this->bottom; i < pos; i++ ) {
|
for ( i = bottom; i < pos; i++ ) {
|
||||||
this->color[i-1] = this->color[i];
|
color[i-1] = color[i];
|
||||||
this->entry[i-1] = this->entry[i];
|
entry[i-1] = entry[i];
|
||||||
}
|
}
|
||||||
this->bottom--;
|
bottom--;
|
||||||
this->color[pos-1] = value;
|
color[pos-1] = value;
|
||||||
this->entry[pos-1] = pixel;
|
entry[pos-1] = pixel;
|
||||||
} else if ( this->top < this->size-1 ) {
|
} else if ( top < size-1 ) {
|
||||||
for ( i = this->top; i >= pos; i-- ) {
|
for ( i = top; i >= pos; i-- ) {
|
||||||
this->color[i+1] = this->color[i];
|
color[i+1] = color[i];
|
||||||
this->entry[i+1] = this->entry[i];
|
entry[i+1] = entry[i];
|
||||||
}
|
}
|
||||||
this->top++;
|
top++;
|
||||||
this->color[pos] = value;
|
color[pos] = value;
|
||||||
this->entry[pos] = pixel;
|
entry[pos] = pixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if ( this->top < this->size-1 ) {
|
if ( top < size-1 ) {
|
||||||
for ( i = this->top; i > pos; i-- ) {
|
for ( i = top; i > pos; i-- ) {
|
||||||
this->color[i+1] = this->color[i];
|
color[i+1] = color[i];
|
||||||
this->entry[i+1] = this->entry[i];
|
entry[i+1] = entry[i];
|
||||||
}
|
}
|
||||||
this->top++;
|
top++;
|
||||||
this->color[pos+1] = value;
|
color[pos+1] = value;
|
||||||
this->entry[pos+1] = pixel;
|
entry[pos+1] = pixel;
|
||||||
} else if ( this->bottom > 0 ) {
|
} else if ( bottom > 0 ) {
|
||||||
for ( i = this->bottom; i < pos; i++ ) {
|
for ( i = bottom; i < pos; i++ ) {
|
||||||
this->color[i-1] = this->color[i];
|
color[i-1] = color[i];
|
||||||
this->entry[i-1] = this->entry[i];
|
entry[i-1] = entry[i];
|
||||||
}
|
}
|
||||||
this->bottom--;
|
bottom--;
|
||||||
this->color[pos] = value;
|
color[pos] = value;
|
||||||
this->entry[pos] = pixel;
|
entry[pos] = pixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2057,8 +2057,8 @@ wxBitmap wxImage::ConvertToBitmap() const
|
|||||||
*/
|
*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// And this is all to get the 'right' color...
|
// And this is all to get the 'right' color...
|
||||||
int pixel = scolor.SearchColor( r, g, b );
|
int pixel = scolor.SearchColor( r, g, b );
|
||||||
XPutPixel( data_image, x, y, pixel );
|
XPutPixel( data_image, x, y, pixel );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user