Avoid sharing gdicmn for just bitmaps

This commit is contained in:
Marek Roszko
2021-06-03 01:46:04 -04:00
parent 8ea180c6b7
commit b5b76eedf7
5 changed files with 23 additions and 5 deletions
+11 -2
View File
@@ -25,6 +25,7 @@
#include <wx/image.h>
#include <wx/bitmap.h>
#include <wx/gdicmn.h>
#include <wx/mstream.h>
#include <wx/menu.h>
#include <wx/menuitem.h>
@@ -201,7 +202,7 @@ wxBitmap* KiBitmapNew( BITMAPS aBitmap )
bool SaveCanvasImageToFile( EDA_DRAW_FRAME* aFrame, const wxString& aFileName,
wxBitmapType aBitmapType )
BITMAP_TYPE aBitmapType )
{
wxCHECK( aFrame != nullptr, false );
@@ -220,7 +221,15 @@ bool SaveCanvasImageToFile( EDA_DRAW_FRAME* aFrame, const wxString& aFileName,
wxImage image = bitmap.ConvertToImage();
if( !image.SaveFile( aFileName, aBitmapType ) )
wxBitmapType type = wxBITMAP_TYPE_PNG;
switch( aBitmapType )
{
case BITMAP_TYPE::PNG: type = wxBITMAP_TYPE_PNG; break;
case BITMAP_TYPE::BMP: type = wxBITMAP_TYPE_BMP; break;
case BITMAP_TYPE::JPG: type = wxBITMAP_TYPE_JPEG; break;
}
if( !image.SaveFile( aFileName, type ) )
retv = false;
image.Destroy();