diff options
author | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-08-27 20:52:09 +0200 |
---|---|---|
committer | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-08-30 21:37:16 +0200 |
commit | 043a523ed9b1575885178a9b76e6ba913087b773 (patch) | |
tree | bdbc93e7b76e9e07bcbcebcda941defe93e96580 | |
parent | 74f35e1f7aca1ffa003e78827f4a9acd665f38b8 (diff) |
Match TiledRendering scaling to the new ViewData PaintMapMode.
This is a bit hacky, still need to figure out what's going
wrong that we need this weird conversion.
Change-Id: Id1c62401f9f85c6d436bdd73b51ccf126100cbc4
-rw-r--r-- | sc/source/ui/view/gridwin4.cxx | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index c6e7168d28c3..a7151f6e0e9c 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -981,21 +981,30 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, // that VirtualDevices use a DPI of 96. We might as well do this // calculation now, rather than after another dimension conversion, // to minimise errors. - Fraction scaleX = Fraction( nOutputWidth, 96 ) * Fraction(1440L) / + // TODO: width wise we need the print scaling compensation stuff? + Fraction scaleX = Fraction( 100*nOutputWidth, 96*96 ) * Fraction(1440L) / Fraction( nTileWidth); - Fraction scaleY = Fraction( nOutputHeight, 96 ) * Fraction(1440L) / + if ( pViewData->GetDocShell() ) + { + scaleX *= pViewData->GetDocShell()->GetOutputFactor(); + } + Fraction scaleY = Fraction( 100*nOutputHeight, 96*96 ) * Fraction(1440L) / Fraction( nTileHeight); rDevice.SetOutputSizePixel( Size( nOutputWidth, nOutputHeight ) ); - MapMode aMapMode( rDevice.GetMapMode() ); - aMapMode.SetMapUnit( MAP_TWIP ); - aMapMode.SetOrigin( Point( -nTilePosX, -nTilePosY ) ); - aMapMode.SetScaleX( scaleX ); - aMapMode.SetScaleY( scaleY ); + pViewData->SetZoom( scaleX, scaleY, false ); + // We now need to force a recalculation of PaintMapMode, which + // happens when ScViewData::CalcPPT is called by RefreshZoom. + pViewData->RefreshZoom(); - maPaintMapMode = aMapMode; -// rDevice.SetMapMode( aMapMode ); + // We only need to propagate the origin through to Draw() + // through the device. + MapMode aMapMode( rDevice.GetMapMode() ); + aMapMode.SetOrigin( rDevice.LogicToPixel( + Point(-nTilePosX, -nTilePosY ), + pViewData->GetPaintMapMode() ) ); + rDevice.SetMapMode( aMapMode ); ScTabViewShell* pTabViewSh = pViewData->GetViewShell(); SdrView* pDrawView = pTabViewSh->GetScDrawView(); |