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

@@ -367,6 +367,23 @@ public:
*/
wxBitmap(const wxImage& img, int depth = wxBITMAP_SCREEN_DEPTH);
/**
Creates a bitmap compatible with the given DC from the given image.
This constructor initializes the bitmap with the data of the given
image, which must be valid, but inherits the scaling factor from the
given device context instead of simply using the default factor of 1.
@param img
Platform-independent wxImage object.
@param dc
DC from which the scaling factor is inherited
@since 3.1.7 (previously this constructor overload was only available
in wxMSW port)
*/
wxBitmap(const wxImage& img, const wxDC& dc);
/**
Creates bitmap corresponding to the given cursor.