summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2018-11-23 17:36:33 +0200
committerTor Lillqvist <tml@collabora.com>2018-11-23 17:56:32 +0200
commite514e19274919c522c1b53e035c99713e37232aa (patch)
tree58329accfb14c8263978c3f0db2ec8c35fa7b519
parentRe-factor internal filter logic, and impl. preload properly. (diff)
downloadcore-e514e19274919c522c1b53e035c99713e37232aa.tar.gz
core-e514e19274919c522c1b53e035c99713e37232aa.zip
Use the correct DPI scaling factor in LibreOfficeKit for iOS, too
Fixes the rendering of spreadsheets in the iOS app. (The cell area was rendered at half the scale of the row and column headers.) (In this branch I don't bother updating the comments to mention CoreGraphics in addition to cairo.) Change-Id: Ife99c6a2d58e592cfea3b4ed1ab09c19fba77e72
-rw-r--r--desktop/source/lib/init.cxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 2db450c19acf..13c9e4a0d591 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2142,9 +2142,10 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
// what Calc's internal scaling would do - because that one is trying to
// fit the lines between cells to integer multiples of pixels.
comphelper::ScopeGuard dpiScaleGuard([]() { comphelper::LibreOfficeKit::setDPIScale(1.0); });
+ double fDPIScaleX = 1;
if (doc_getDocumentType(pThis) == LOK_DOCTYPE_SPREADSHEET)
{
- double fDPIScaleX = (nCanvasWidth * 3840.0) / (256.0 * nTileWidth);
+ fDPIScaleX = (nCanvasWidth * 3840.0) / (256.0 * nTileWidth);
assert(fabs(fDPIScaleX - ((nCanvasHeight * 3840.0) / (256.0 * nTileHeight))) < 0.0001);
comphelper::LibreOfficeKit::setDPIScale(fDPIScaleX);
}
@@ -2155,7 +2156,7 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
CGContextRef cgc = CGBitmapContextCreate(pBuffer, nCanvasWidth, nCanvasHeight, 8, nCanvasWidth*4, CGColorSpaceCreateDeviceRGB(), kCGImageAlphaNoneSkipFirst | kCGImageByteOrder32Little);
CGContextTranslateCTM(cgc, 0, nCanvasHeight);
- CGContextScaleCTM(cgc, 1, -1);
+ CGContextScaleCTM(cgc, fDPIScaleX, -fDPIScaleX);
doc_paintTileToCGContext(pThis, (void*) cgc, nCanvasWidth, nCanvasHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight);
@@ -3633,7 +3634,7 @@ static void doc_paintWindowDPI(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKW
CGContextRef cgc = CGBitmapContextCreate(pBuffer, nWidth, nHeight, 8, nWidth*4, CGColorSpaceCreateDeviceRGB(), kCGImageAlphaNoneSkipFirst | kCGImageByteOrder32Little);
CGContextTranslateCTM(cgc, 0, nHeight);
- CGContextScaleCTM(cgc, 1, -1);
+ CGContextScaleCTM(cgc, fDPIScale, -fDPIScale);
SystemGraphicsData aData;
aData.rCGContext = cgc;
@@ -3644,7 +3645,7 @@ static void doc_paintWindowDPI(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKW
pDevice->SetOutputSizePixel(Size(nWidth, nHeight));
MapMode aMapMode(pDevice->GetMapMode());
- aMapMode.SetOrigin(Point(-nX, -nY));
+ aMapMode.SetOrigin(Point(-(nX / fDPIScale), -(nY / fDPIScale)));
pDevice->SetMapMode(aMapMode);
comphelper::LibreOfficeKit::setDialogPainting(true);