summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej@ahunt.org>2014-09-09 06:12:44 +0200
committerAndrzej Hunt <andrzej.hunt@collabora.com>2014-09-29 06:29:38 +0100
commit05ff705e3a9a3b2f4d257efc4773951a07b74abc (patch)
treee951dfc3db4b77cbcaf61dfb1f5a3da398eeb7fb
parent678434a7426b27e068691cf5ae2f82374ddb0a59 (diff)
Fix PaintTile scaling preparation.
Change-Id: I0a725fd5c030f3c089c2bbd25947088c321eb2d4
-rw-r--r--sc/source/ui/view/gridwin4.cxx20
1 files changed, 12 insertions, 8 deletions
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index a890abc8ab34..022f6e3af504 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -940,21 +940,25 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
int nTilePosX, int nTilePosY,
long nTileWidth, long nTileHeight )
{
+ // Scaling. Must convert from pixels to TWIPs. We know
+ // 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) /
+ Fraction( nTileWidth);
+ Fraction scaleY = Fraction( nOutputHeight, 96 ) * Fraction(1440L) /
+ Fraction( nTileHeight);
+
rDevice.SetOutputSizePixel( Size( nOutputWidth, nOutputHeight ) );
- // setup the output device to draw the tile
MapMode aMapMode( rDevice.GetMapMode() );
aMapMode.SetMapUnit( MAP_TWIP );
aMapMode.SetOrigin( Point( -nTilePosX, -nTilePosY ) );
- // Scaling. Must convert from pixels to twips. We know
- // that VirtualDevises use a DPI of 96.
- Fraction scaleX = Fraction( nOutputWidth, 96 ) * Fraction(1440L) /
- Fraction( nTileWidth);
- Fraction scaleY = Fraction( nOutputHeight, 96 ) * Fraction(1440L) /
- Fraction( nTileHeight);
aMapMode.SetScaleX( scaleX );
aMapMode.SetScaleY( scaleY );
- rDevice.SetMapMode( aMapMode );
+
+ maPaintMapMode = aMapMode;
+// rDevice.SetMapMode( aMapMode );
ScTabViewShell* pTabViewSh = pViewData->GetViewShell();
SdrView* pDrawView = pTabViewSh->GetScDrawView();