Eeschema: fix the bounding box size drawn around the bitmap when selected.

Images have a scale factor and this factor was taken in account twice
For image having a scale factor not equal to 1.0, the bounding box was too big (or too small)
This commit is contained in:
jean-pierre charras 2019-08-01 08:48:01 +02:00
parent 3f28a1d1cb
commit 9dcf3b862c
1 changed files with 10 additions and 2 deletions

View File

@ -1533,8 +1533,16 @@ void SCH_PAINTER::draw( SCH_BITMAP *aBitmap, int aLayer )
m_gal->SetLineWidth ( getShadowWidth() );
m_gal->SetIsFill( false );
VECTOR2D origin( -aBitmap->GetSize().x / 2.0, -aBitmap->GetSize().y / 2.0 );
VECTOR2D end = origin + aBitmap->GetSize();
// Draws a bounding box.
VECTOR2D bm_size( aBitmap->GetSize() );
// bm_size is the actual image size in UI.
// but m_gal scale was previously set to img_scale
// so recalculate size relative to this image size.
bm_size.x /= img_scale;
bm_size.y /= img_scale;
VECTOR2D origin( -bm_size.x / 2.0, -bm_size.y / 2.0 );
VECTOR2D end = origin + bm_size;
m_gal->DrawRectangle( origin, end );
}
}