replace wxBitmap::SetPixbuf() with wxBitmap ctor taking pixbuf
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71006 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
b05875c977
commit
54195d23c2
@ -68,6 +68,7 @@ public:
|
||||
wxBitmap( const wxImage& image, int depth = wxBITMAP_SCREEN_DEPTH )
|
||||
{ (void)CreateFromImage(image, depth); }
|
||||
#endif // wxUSE_IMAGE
|
||||
wxBitmap(GdkPixbuf* pixbuf);
|
||||
virtual ~wxBitmap();
|
||||
|
||||
bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
|
||||
@ -108,7 +109,6 @@ public:
|
||||
void SetHeight( int height );
|
||||
void SetWidth( int width );
|
||||
void SetDepth( int depth );
|
||||
void SetPixbuf(GdkPixbuf* pixbuf);
|
||||
|
||||
GdkPixmap *GetPixmap() const;
|
||||
bool HasPixmap() const;
|
||||
|
@ -4,7 +4,7 @@
|
||||
// Author: Jens Lody and Teodor Petrov
|
||||
// Modified by:
|
||||
// Created: 2012-03-23
|
||||
// RCS-ID: $Id:$
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2012 Jens Lody <jens@codeblocks.org>
|
||||
// and Teodor Petrov
|
||||
// Licence: wxWindows licence
|
||||
@ -119,8 +119,7 @@ wxRect DrawCloseButton(wxDC& dc,
|
||||
int xthickness = style_button->xthickness;
|
||||
int ythickness = style_button->ythickness;
|
||||
|
||||
wxBitmap bmp;
|
||||
bmp.SetPixbuf(gtk_widget_render_icon(widget, GTK_STOCK_CLOSE, GTK_ICON_SIZE_SMALL_TOOLBAR, "tab"));
|
||||
wxBitmap bmp(gtk_widget_render_icon(widget, GTK_STOCK_CLOSE, GTK_ICON_SIZE_SMALL_TOOLBAR, "tab"));
|
||||
|
||||
if(bmp.GetWidth() != s_CloseIconSize || bmp.GetHeight() != s_CloseIconSize)
|
||||
{
|
||||
|
@ -259,7 +259,7 @@ wxIconBundle DoCreateIconBundle(const char *stockid,
|
||||
continue;
|
||||
|
||||
wxIcon icon;
|
||||
icon.SetPixbuf(pixbuf);
|
||||
icon.CopyFromBitmap(wxBitmap(pixbuf));
|
||||
bundle.AddIcon(icon);
|
||||
}
|
||||
|
||||
@ -296,11 +296,7 @@ wxBitmap wxGTK2ArtProvider::CreateBitmap(const wxArtID& id,
|
||||
}
|
||||
}
|
||||
|
||||
wxBitmap bmp;
|
||||
if (pixbuf != NULL)
|
||||
bmp.SetPixbuf(pixbuf);
|
||||
|
||||
return bmp;
|
||||
return wxBitmap(pixbuf);
|
||||
}
|
||||
|
||||
wxIconBundle
|
||||
|
@ -309,6 +309,18 @@ wxBitmap::wxBitmap(const char* const* bits)
|
||||
}
|
||||
}
|
||||
|
||||
wxBitmap::wxBitmap(GdkPixbuf* pixbuf)
|
||||
{
|
||||
if (pixbuf)
|
||||
{
|
||||
wxBitmapRefData* bmpData = new wxBitmapRefData(
|
||||
gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf),
|
||||
gdk_pixbuf_get_n_channels(pixbuf) * 8);
|
||||
m_refData = bmpData;
|
||||
bmpData->m_pixbuf = pixbuf;
|
||||
}
|
||||
}
|
||||
|
||||
wxBitmap::~wxBitmap()
|
||||
{
|
||||
}
|
||||
@ -679,10 +691,7 @@ bool wxBitmap::LoadFile( const wxString &name, wxBitmapType type )
|
||||
{
|
||||
wxUnusedVar(type); // The type is detected automatically by GDK.
|
||||
|
||||
UnRef();
|
||||
GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file(name.fn_str(), NULL);
|
||||
if (pixbuf)
|
||||
SetPixbuf(pixbuf);
|
||||
*this = wxBitmap(gdk_pixbuf_new_from_file(name.fn_str(), NULL));
|
||||
}
|
||||
|
||||
return IsOk();
|
||||
@ -802,22 +811,6 @@ bool wxBitmap::HasPixbuf() const
|
||||
return M_BMPDATA->m_pixbuf != NULL;
|
||||
}
|
||||
|
||||
void wxBitmap::SetPixbuf(GdkPixbuf* pixbuf)
|
||||
{
|
||||
UnRef();
|
||||
|
||||
if (!pixbuf)
|
||||
return;
|
||||
|
||||
int depth = -1;
|
||||
if (gdk_pixbuf_get_has_alpha(pixbuf))
|
||||
depth = 32;
|
||||
m_refData = new wxBitmapRefData(
|
||||
gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf), depth);
|
||||
|
||||
M_BMPDATA->m_pixbuf = pixbuf;
|
||||
}
|
||||
|
||||
void wxBitmap::PurgeOtherRepresentations(wxBitmap::Representation keep)
|
||||
{
|
||||
if (keep == Pixmap && HasPixbuf())
|
||||
|
@ -224,7 +224,7 @@ wxBitmap wxBitmapComboBox::GetItemBitmap(unsigned int n) const
|
||||
if ( pixbuf )
|
||||
{
|
||||
g_object_ref( pixbuf );
|
||||
bitmap.SetPixbuf( pixbuf );
|
||||
bitmap = wxBitmap(pixbuf);
|
||||
}
|
||||
g_value_unset( &value );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user