summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej.hunt@collabora.com>2014-06-24 21:16:15 +0100
committerAndrzej Hunt <andrzej.hunt@collabora.com>2014-06-25 14:49:58 +0100
commitaf1bf5b5bd620a0bed915ec32c61bea8dff88a09 (patch)
treef2646f2298632a9cb6270ffce01a7c8c15df10b1
parentSet correct scaling for normal painting. (diff)
downloadcore-af1bf5b5bd620a0bed915ec32c61bea8dff88a09.tar.gz
core-af1bf5b5bd620a0bed915ec32c61bea8dff88a09.zip
Turns out document coordinates are already in TWIPs.
This now means that fonts are also correctly scaled, whereas the 100th mm mapping caused fonts to be scaled differently to the grid (i.e. looked ugly). Change-Id: Ib8b913490823a7ba406e52291e52d50053ae32b8
-rw-r--r--sc/source/ui/view/gridwin4.cxx15
1 files changed, 2 insertions, 13 deletions
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 8f475115cfc5..cad96f3a9a9f 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -413,7 +413,7 @@ Size ScGridWindow::GetDataAreaSize()
// the data area.
// This doesn't include the final (bottom & right) borders...
- return Size( nX * 1440L / 2540L, nY * 1440L / 2540L );
+ return Size( nX, nY );
}
// Draw ----------------------------------------------------------------
@@ -923,25 +923,14 @@ 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);
- // Now scale back to 100th mm dimensions.
- nTilePosX = nTilePosX * 2540L / 1440L;
- nTilePosY = nTilePosY * 2540L / 1440L;
-
- nTileWidth = nTileWidth * 2540L / 1440L;
- nTileHeight = nTileHeight * 2540L / 1440L;
-
rDevice.SetOutputSizePixel( Size( nOutputWidth, nOutputHeight ) );
MapMode aMapMode( rDevice.GetMapMode() );
- aMapMode.SetMapUnit( MAP_100TH_MM );
+ aMapMode.SetMapUnit( MAP_TWIP );
aMapMode.SetOrigin( Point( -nTilePosX, -nTilePosY ) ); // size
aMapMode.SetScaleX( scaleX );