Eeschema: another trial to fix bitmap printing in wx version > 3.1.5

We had on a regular basis problems when printing bitmaps.
Probably due to issues both in wx and in our code.
From master branch
This commit is contained in:
jean-pierre charras 2022-08-04 14:56:16 +02:00
parent 36a0c2a9cc
commit 5f00847a86
1 changed files with 13 additions and 7 deletions

View File

@ -251,6 +251,16 @@ void BITMAP_BASE::DrawBitmap( wxDC* aDC, const wxPoint& aPos )
aDC->GetLogicalOrigin( &logicalOriginX, &logicalOriginY );
bool useTransform = aDC->CanUseTransformMatrix();
// We already have issues to draw a bitmap on the wxDC, depending on wxWidgets version.
// Now we have an issue on wxWidgets 3.1.6 and later to fix the clipboard
// and the bitmap position when using TransformMatrix
// So for version >= 3.1.6 do not use it
// Be carefull before changing the code.
#if wxCHECK_VERSION( 3, 1, 6 )
useTransform = false;
#endif
wxAffineMatrix2D init_matrix = aDC->GetTransformMatrix();
wxPoint clipAreaPos;
@ -261,15 +271,11 @@ void BITMAP_BASE::DrawBitmap( wxDC* aDC, const wxPoint& aPos )
matrix.Translate( pos.x, pos.y );
matrix.Scale( GetScalingFactor(), GetScalingFactor() );
aDC->SetTransformMatrix( matrix );
// Looks like wxWidgets 3.1.6 and 3.1.7 has a bug to fix the clipboard position
// So for 3.1.6 and 3.1.7, clipAreaPos.x = clipAreaPos.y = 0
#if !wxCHECK_VERSION( 3, 1, 6 ) || wxCHECK_VERSION( 3, 2, 0 )
// Needed on wx <= 3.1.5, and this is strange...
// Nevertheless, this code has problem (the bitmap is not seen)
// with wx version > 3.1.5
clipAreaPos.x = pos.x;
clipAreaPos.y = pos.y;
#else
clipAreaPos.x = clipAreaPos.y = 0;
#endif
pos.x = pos.y = 0;
}