Don't cast with G_OBJECT when passing a GObject to g_object_ref, g_object_unref and g_signal_connect.

They take a gpointer, not GObject*, and unnecessary casting not all that speedy with GObject types.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39156 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Mart Raudsepp
2006-05-15 14:17:38 +00:00
parent 7e983dabef
commit 3fe39b0ce3
10 changed files with 75 additions and 75 deletions

View File

@@ -83,7 +83,7 @@ wxMask::wxMask( const wxBitmap& bitmap )
wxMask::~wxMask()
{
if (m_bitmap)
g_object_unref (G_OBJECT (m_bitmap));
g_object_unref (m_bitmap);
}
bool wxMask::Create( const wxBitmap& bitmap,
@@ -91,7 +91,7 @@ bool wxMask::Create( const wxBitmap& bitmap,
{
if (m_bitmap)
{
g_object_unref (G_OBJECT (m_bitmap));
g_object_unref (m_bitmap);
m_bitmap = (GdkBitmap*) NULL;
}
@@ -174,7 +174,7 @@ bool wxMask::Create( const wxBitmap& bitmap,
gdk_draw_line( m_bitmap, gc, start_x, j, i, j );
}
g_object_unref (G_OBJECT (gc));
g_object_unref (gc);
return true;
}
@@ -197,7 +197,7 @@ bool wxMask::Create( const wxBitmap& bitmap )
{
if (m_bitmap)
{
g_object_unref (G_OBJECT (m_bitmap));
g_object_unref (m_bitmap);
m_bitmap = (GdkBitmap*) NULL;
}
@@ -213,7 +213,7 @@ bool wxMask::Create( const wxBitmap& bitmap )
gdk_wx_draw_bitmap( m_bitmap, gc, bitmap.GetBitmap(), 0, 0, 0, 0, bitmap.GetWidth(), bitmap.GetHeight() );
g_object_unref (G_OBJECT (gc));
g_object_unref (gc);
return true;
}
@@ -258,11 +258,11 @@ wxBitmapRefData::wxBitmapRefData()
wxBitmapRefData::~wxBitmapRefData()
{
if (m_pixmap)
g_object_unref (G_OBJECT (m_pixmap));
g_object_unref (m_pixmap);
if (m_bitmap)
g_object_unref (G_OBJECT (m_bitmap));
g_object_unref (m_bitmap);
if (m_pixbuf)
g_object_unref (G_OBJECT (m_pixbuf));
g_object_unref (m_pixbuf);
delete m_mask;
#if wxUSE_PALETTE
delete m_palette;
@@ -485,8 +485,8 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
dst[h*dstbyteperline+width/8] = outbyte;
}
g_object_unref (G_OBJECT (img));
if (gc) g_object_unref (G_OBJECT (gc));
g_object_unref (img);
if (gc) g_object_unref (gc);
if ( dst )
{
@@ -544,7 +544,7 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
bmp.SetMask(mask);
free( dst );
g_object_unref (G_OBJECT (img));
g_object_unref (img);
}
free( tablex );
@@ -661,8 +661,8 @@ bool wxBitmap::CreateFromImageAsBitmap(const wxImage& img)
gdk_draw_image( GetBitmap(), data_gc, data_image, 0, 0, 0, 0, width, height );
g_object_unref (G_OBJECT (data_image));
g_object_unref (G_OBJECT (data_gc));
g_object_unref (data_image);
g_object_unref (data_gc);
// Blit mask
@@ -672,8 +672,8 @@ bool wxBitmap::CreateFromImageAsBitmap(const wxImage& img)
gdk_draw_image( GetMask()->GetBitmap(), mask_gc, mask_image, 0, 0, 0, 0, width, height );
g_object_unref (G_OBJECT (mask_image));
g_object_unref (G_OBJECT (mask_gc));
g_object_unref (mask_image);
g_object_unref (mask_gc);
}
return true;
@@ -732,7 +732,7 @@ bool wxBitmap::CreateFromImageAsPixmap(const wxImage& img)
image.GetData(),
width*3 );
g_object_unref (G_OBJECT (gc));
g_object_unref (gc);
return true;
}
@@ -901,8 +901,8 @@ bool wxBitmap::CreateFromImageAsPixmap(const wxImage& img)
gdk_draw_image( GetPixmap(), data_gc, data_image, 0, 0, 0, 0, width, height );
g_object_unref (G_OBJECT (data_image));
g_object_unref (G_OBJECT (data_gc));
g_object_unref (data_image);
g_object_unref (data_gc);
// Blit mask
@@ -912,8 +912,8 @@ bool wxBitmap::CreateFromImageAsPixmap(const wxImage& img)
gdk_draw_image( GetMask()->GetBitmap(), mask_gc, mask_image, 0, 0, 0, 0, width, height );
g_object_unref (G_OBJECT (mask_image));
g_object_unref (G_OBJECT (mask_gc));
g_object_unref (mask_image);
g_object_unref (mask_gc);
}
return true;
@@ -1137,8 +1137,8 @@ wxImage wxBitmap::ConvertToImage() const
}
}
g_object_unref (G_OBJECT (gdk_image));
if (gdk_image_mask) g_object_unref (G_OBJECT (gdk_image_mask));
g_object_unref (gdk_image);
if (gdk_image_mask) g_object_unref (gdk_image_mask);
}
return image;
@@ -1263,7 +1263,7 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const
{
GdkGC *gc = gdk_gc_new( ret.GetPixmap() );
gdk_draw_drawable( ret.GetPixmap(), gc, GetPixmap(), rect.x, rect.y, 0, 0, rect.width, rect.height );
g_object_unref (G_OBJECT (gc));
g_object_unref (gc);
}
else
{
@@ -1274,7 +1274,7 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const
col.pixel = 0;
gdk_gc_set_background( gc, &col );
gdk_wx_draw_bitmap( ret.GetBitmap(), gc, GetBitmap(), rect.x, rect.y, 0, 0, rect.width, rect.height );
g_object_unref (G_OBJECT (gc));
g_object_unref (gc);
}
}
@@ -1290,7 +1290,7 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const
col.pixel = 0;
gdk_gc_set_background( gc, &col );
gdk_wx_draw_bitmap( mask->m_bitmap, gc, M_BMPDATA->m_mask->m_bitmap, rect.x, rect.y, 0, 0, rect.width, rect.height );
g_object_unref (G_OBJECT (gc));
g_object_unref (gc);
ret.SetMask( mask );
}
@@ -1486,7 +1486,7 @@ GdkPixbuf *wxBitmap::GetPixbuf() const
}
}
g_object_unref (G_OBJECT (pmask));
g_object_unref (pmask);
}
}
}
@@ -1514,12 +1514,12 @@ void wxBitmap::PurgeOtherRepresentations(wxBitmap::Representation keep)
{
if (keep == Pixmap && HasPixbuf())
{
g_object_unref (G_OBJECT (M_BMPDATA->m_pixbuf));
g_object_unref (M_BMPDATA->m_pixbuf);
M_BMPDATA->m_pixbuf = NULL;
}
if (keep == Pixbuf && HasPixmap())
{
g_object_unref (G_OBJECT (M_BMPDATA->m_pixmap));
g_object_unref (M_BMPDATA->m_pixmap);
M_BMPDATA->m_pixmap = NULL;
}
}