Add wxBitmap(wxImage, wxDC) ctor to all ports

This ctor was previously present only in wxMSW, make it available in all
ports to allow the same code to compile everywhere.

In most of them wxDC argument is simply ignored, but in wxGTK and wxOSX
it is used to assign the appropriate scale factor for the new bitmap.

Enable previously wxMSW-only unit test checking for this.
This commit is contained in:
Vadim Zeitlin
2022-04-12 17:44:59 +01:00
parent b185186ebf
commit 24970061fa
12 changed files with 74 additions and 17 deletions

View File

@@ -75,6 +75,7 @@ public:
wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE );
#if wxUSE_IMAGE
wxBitmap(const wxImage& image, int depth = wxBITMAP_SCREEN_DEPTH, double scale = 1.0);
wxBitmap(const wxImage& image, const wxDC& dc);
#endif // wxUSE_IMAGE
wxBitmap(GdkPixbuf* pixbuf, int depth = 0);
explicit wxBitmap(const wxCursor& cursor);
@@ -147,11 +148,12 @@ public:
bool HasAlpha() const;
protected:
#ifndef __WXGTK3__
#if wxUSE_IMAGE
void InitFromImage(const wxImage& image, int depth, double scale);
#ifndef __WXGTK3__
bool CreateFromImage(const wxImage& image, int depth);
#endif // wxUSE_IMAGE
#endif
#endif // wxUSE_IMAGE
virtual wxGDIRefData* CreateGDIRefData() const wxOVERRIDE;
virtual wxGDIRefData* CloneGDIRefData(const wxGDIRefData* data) const wxOVERRIDE;