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:
@@ -14,6 +14,7 @@
|
||||
#include <QtWidgets/QLabel>
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/dc.h"
|
||||
#include "wx/icon.h"
|
||||
#include "wx/image.h"
|
||||
#endif // WX_PRECOMP
|
||||
@@ -209,7 +210,7 @@ wxBitmap::wxBitmap(const wxString &filename, wxBitmapType type )
|
||||
LoadFile(filename, type);
|
||||
}
|
||||
|
||||
wxBitmap::wxBitmap(const wxImage& image, int depth, double WXUNUSED(scale) )
|
||||
void wxBitmap::InitFromImage(const wxImage& image, int depth, double WXUNUSED(scale) )
|
||||
{
|
||||
Qt::ImageConversionFlags flags = 0;
|
||||
if (depth == 1)
|
||||
@@ -217,6 +218,16 @@ wxBitmap::wxBitmap(const wxImage& image, int depth, double WXUNUSED(scale) )
|
||||
m_refData = new wxBitmapRefData(QPixmap::fromImage(ConvertImage(image), flags));
|
||||
}
|
||||
|
||||
wxBitmap::wxBitmap(const wxImage& image, int depth, double scale)
|
||||
{
|
||||
InitFromImage(image, depth, scale);
|
||||
}
|
||||
|
||||
wxBitmap::wxBitmap(const wxImage& image, const wxDC& dc)
|
||||
{
|
||||
InitFromImage(image, -1, dc.GetContentScaleFactor());
|
||||
}
|
||||
|
||||
wxBitmap::wxBitmap(const wxCursor& cursor)
|
||||
{
|
||||
// note that pixmap could be invalid if is not a pixmap cursor
|
||||
|
||||
Reference in New Issue
Block a user