[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - desktop/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Nov 23 15:59:20 UTC 2018


 desktop/source/lib/init.cxx |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit e514e19274919c522c1b53e035c99713e37232aa
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Fri Nov 23 17:36:33 2018 +0200
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Fri Nov 23 17:56:32 2018 +0200

    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

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);


More information about the Libreoffice-commits mailing list