diff options
author | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-08-27 20:52:09 +0200 |
---|---|---|
committer | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-09-29 06:30:49 +0100 |
commit | 503f504dc53d9d488e60920877405cc8264bfabd (patch) | |
tree | 15fa25869f6607753e0f5d199ccae0bb8365d311 | |
parent | f3e1e93df5fe7290b9486cb2d06feb40fae4bbe6 (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 58f7fe3980c8..4281693e29fe 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -964,21 +964,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(); |