From dafeb9676535a545352f2411af0acaec36d3d873 Mon Sep 17 00:00:00 2001 From: jean-pierre charras <jp.charras@wanadoo.fr> Date: Sat, 20 Oct 2018 18:24:22 +0200 Subject: [PATCH] Page layout bitmap size wrong in modern/GAL canvases. The image scale set by pl_editor was not taken in account when drawing the page layout. Fixes: lp:1798685 https://bugs.launchpad.net/kicad/+bug/1798685 --- common/worksheet_viewitem.cpp | 8 ++++++++ eeschema/sch_painter.cpp | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/common/worksheet_viewitem.cpp b/common/worksheet_viewitem.cpp index 0219929c48..c1e3d9426f 100644 --- a/common/worksheet_viewitem.cpp +++ b/common/worksheet_viewitem.cpp @@ -207,6 +207,14 @@ void WORKSHEET_VIEWITEM::draw( const WS_DRAW_ITEM_BITMAP* aItem, GAL* aGal ) con VECTOR2D position = aItem->GetPosition(); aGal->Translate( position ); WORKSHEET_DATAITEM_BITMAP* parent = static_cast<WORKSHEET_DATAITEM_BITMAP*>( aItem->GetParent() ); + + // When the image scale factor is not 1.0, we need to modify the actual scale + // as the image scale factor is similar to a local zoom + double img_scale = parent->m_ImageBitmap->GetScale(); + + if( img_scale != 1.0 ) + aGal->Scale( VECTOR2D( img_scale, img_scale ) ); + aGal->DrawBitmap( *parent->m_ImageBitmap ); aGal->Restore(); } diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index fdc0f318c3..830b3ea1fa 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -1350,8 +1350,10 @@ void SCH_PAINTER::draw( SCH_BITMAP *aBitmap, int aLayer ) // When the image scale factor is not 1.0, we need to modify the actual // as the image scale factor is similar to a local zoom - if( aBitmap->GetImageScale() != 1.0 ) - m_gal->Scale( VECTOR2D( aBitmap->GetImageScale(), aBitmap->GetImageScale() ) ); + double img_scale = aBitmap->GetImageScale(); + + if( img_scale != 1.0 ) + m_gal->Scale( VECTOR2D( img_scale, img_scale ) ); m_gal->DrawBitmap( *aBitmap->GetImage() );