Pcbnew: Fix rotating bitmaps
Fixes rotating bitmaps with "rotate counterclockwise", "rotate clockwise" and "move exactly" commands. Only rotation by 0, 90, 180 and 270 degrees is supported for bitmaps. Other values are rounded to the nearest 90 degree multiple. There is a different bug that this commit doesn't address, which is that BITMAP_BASE::Rotate() got its CW/CCW logic reversed ("m_image->Rotate( false )" should rotate CW, but does not). Fixes https://gitlab.com/kicad/code/kicad/issues/14197
This commit is contained in:
parent
a14c017def
commit
45b94a4b3e
|
@ -179,8 +179,15 @@ void PCB_BITMAP::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
|
|||
|
||||
void PCB_BITMAP::Rotate( const VECTOR2I& aCenter, const EDA_ANGLE& aAngle )
|
||||
{
|
||||
EDA_ANGLE norm( aAngle.AsDegrees(), DEGREES_T );
|
||||
|
||||
RotatePoint( m_pos, aCenter, aAngle );
|
||||
m_image->Rotate( false );
|
||||
|
||||
norm.Normalize();
|
||||
|
||||
// each call to m_image->Rotate() rotates 90 degrees CCW
|
||||
for( double ang = 45.0; ang < norm.AsDegrees(); ang += 90.0 )
|
||||
m_image->Rotate( false );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue