[Libreoffice-commits] core.git: 2 commits - desktop/source distro-configs/LibreOfficeiOS.conf distro-configs/LibreOfficeiOS_Sim.conf

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 3 08:32:58 UTC 2019


 desktop/source/lib/init.cxx            |   72 ++++++++++++++++++++-------------
 distro-configs/LibreOfficeiOS.conf     |   11 -----
 distro-configs/LibreOfficeiOS_Sim.conf |   32 ++++++++++++++
 3 files changed, 77 insertions(+), 38 deletions(-)

New commits:
commit b4653db6504a7e12203d5defeea536a0decf76d8
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Jun 3 14:42:44 2019 +0900
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Mon Jun 3 10:32:15 2019 +0200

    Add distro config for iOS simulator to make building easier
    
    Change-Id: Iff70622732792224b3c0a080f95d69f86c167ae6
    Reviewed-on: https://gerrit.libreoffice.org/73370
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/distro-configs/LibreOfficeiOS.conf b/distro-configs/LibreOfficeiOS.conf
index 411ba8d69798..7786120e2279 100644
--- a/distro-configs/LibreOfficeiOS.conf
+++ b/distro-configs/LibreOfficeiOS.conf
@@ -27,15 +27,6 @@
 
 --without-tls
 
-# iOS simulator (debug)
-#--enable-ios-simulator
-#--enable-debug
-
-# iOS Device (debug)
-#--enable-ios-simulator
-#--enable-debug
-#--host=arm64-apple-darwin
-
-# iOS Device (release)
+# iOS device
 --host=arm64-apple-darwin
 
diff --git a/distro-configs/LibreOfficeiOS_Sim.conf b/distro-configs/LibreOfficeiOS_Sim.conf
new file mode 100644
index 000000000000..146be2bd3bcc
--- /dev/null
+++ b/distro-configs/LibreOfficeiOS_Sim.conf
@@ -0,0 +1,32 @@
+--disable-breakpad
+--disable-firebird-sdbc
+--disable-online-update
+
+--without-export-validation
+--without-helppack-integration
+--without-java
+--without-junit
+
+--with-theme=colibre tango
+
+--with-build-platform-configure-options=--with-system-jpeg=no
+--with-macosx-version-min-required=10.11
+
+--disable-avahi
+--disable-avmedia
+--disable-compiler-plugins
+--disable-cups
+--disable-database-connectivity
+--disable-dconf
+--disable-extensions
+--disable-kde5
+--disable-odk
+--disable-openssl
+--disable-pdfium
+--disable-python
+
+--without-tls
+
+# iOS simulator (debug)
+--enable-ios-simulator
+--enable-debug
commit 80c5c68fede7af89e7a3732408e97364498fbbcd
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Jun 3 12:50:47 2019 +0900
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Mon Jun 3 10:32:02 2019 +0200

    LOK: Factor out iOS painting code
    
    Change-Id: Ica706842003fe60ba864e013614eb535580446bb
    Reviewed-on: https://gerrit.libreoffice.org/73363
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index aea40f41a2cb..2a19ef820c1a 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1598,6 +1598,45 @@ ITiledRenderable* getTiledRenderable(LibreOfficeKitDocument* pThis)
     return dynamic_cast<ITiledRenderable*>(pDocument->mxComponent.get());
 }
 
+#ifdef IOS
+void paintTileToCGContext(ITiledRenderable* pDocument,
+                          void* rCGContext, const Size nCanvasSize,
+                          const int nTilePosX, const int nTilePosY,
+                          const int nTileWidth, const int nTileHeight)
+{
+    SystemGraphicsData aData;
+    aData.rCGContext = reinterpret_cast<CGContextRef>(rCGContext);
+
+    ScopedVclPtrInstance<VirtualDevice> pDevice(&aData, Size(1, 1), DeviceFormat::DEFAULT);
+    pDevice->SetBackground(Wallpaper(COL_TRANSPARENT));
+    pDevice->SetOutputSizePixel(nCanvasSize);
+    pDocument->paintTile(*pDevice, nCanvasSize.Width(), nCanvasSize.Height(),
+                    nTilePosX, nTilePosY, nTileWidth, nTileHeight);
+}
+
+void paintTileIOS(LibreOfficeKitDocument* pThis,
+             unsigned char* pBuffer,
+             const int nCanvasWidth, const int nCanvasHeight, const double fDPIScale,
+             const int nTilePosX, const int nTilePosY,
+             const int nTileWidth, const int nTileHeight)
+{
+    CGContextRef pCGContext = CGBitmapContextCreate(pBuffer, nCanvasWidth, nCanvasHeight, 8,
+                                                    nCanvasWidth * 4, CGColorSpaceCreateDeviceRGB(),
+                                                    kCGImageAlphaPremultipliedFirst | kCGImageByteOrder32Little);
+
+    // Use the vcl.cg tag even if this code is not in vcl, to match all other SAL_INFO logging about Core Graphics, in vcl.
+    SAL_INFO("vcl.cg", "CGBitmapContextCreate(" << nCanvasWidth << "x" << nCanvasHeight << "x32) = " << pCGContext);
+
+    CGContextTranslateCTM(pCGContext, 0, nCanvasHeight);
+    CGContextScaleCTM(pCGContext, fDPIScale, -fDPIScale);
+
+    doc_paintTileToCGContext(pThis, (void*) pCGContext, nCanvasWidth, nCanvasHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight);
+
+    SAL_INFO("vcl.cg", "CGContextRelease(" << pCGContext << ")");
+    CGContextRelease(pCGContext);
+}
+#endif
+
 } // anonymous namespace
 
 // Wonder global state ...
@@ -2446,7 +2485,7 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
     // 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;
+    double fDPIScaleX = 1.0;
     if (doc_getDocumentType(pThis) == LOK_DOCTYPE_SPREADSHEET)
     {
         fDPIScaleX = (nCanvasWidth * 3840.0) / (256.0 * nTileWidth);
@@ -2455,19 +2494,7 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
     }
 
 #if defined(IOS)
-    CGContextRef cgc = CGBitmapContextCreate(pBuffer, nCanvasWidth, nCanvasHeight, 8, nCanvasWidth*4, CGColorSpaceCreateDeviceRGB(), kCGImageAlphaPremultipliedFirst | kCGImageByteOrder32Little);
-
-    // Use the vcl.cg tag even if this code is not in vcl, to match all other SAL_INFO logging about Core Graphics, in vcl.
-    SAL_INFO( "vcl.cg", "CGBitmapContextCreate(" << nCanvasWidth << "x" << nCanvasHeight << "x32) = " << cgc );
-
-    CGContextTranslateCTM(cgc, 0, nCanvasHeight);
-    CGContextScaleCTM(cgc, fDPIScaleX, -fDPIScaleX);
-
-    doc_paintTileToCGContext(pThis, (void*) cgc, nCanvasWidth, nCanvasHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight);
-
-    SAL_INFO( "vcl.cg", "CGContextRelease(" << cgc << ")" );
-    CGContextRelease(cgc);
-
+    paintTileIOS(pThis, pBuffer, nCanvasWidth, nCanvasHeight, fDPIScaleX, nTilePosX, nTilePosY, nTileWidth, nTileHeight);
 #else
     ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), DeviceFormat::DEFAULT) ;
 
@@ -2510,8 +2537,7 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
 #ifdef IOS
 
 // This function is separate only to be used by LibreOfficeLight. If that app can be retired, this
-// function's code can be inlined into the iOS part of doc_paintTile().
-
+// function's code can be inlined.
 static void doc_paintTileToCGContext(LibreOfficeKitDocument* pThis,
                                      void* rCGContext,
                                      const int nCanvasWidth, const int nCanvasHeight,
@@ -2532,18 +2558,8 @@ static void doc_paintTileToCGContext(LibreOfficeKitDocument* pThis,
         return;
     }
 
-    SystemGraphicsData aData;
-    aData.rCGContext = reinterpret_cast<CGContextRef>(rCGContext);
-    // the Size argument is irrelevant, I hope
-    ScopedVclPtrInstance<VirtualDevice> pDevice(&aData, Size(1, 1), DeviceFormat::DEFAULT);
-
-    pDevice->SetBackground(Wallpaper(COL_TRANSPARENT));
-
-    pDevice->SetOutputSizePixel(Size(nCanvasWidth, nCanvasHeight));
-
-    pDoc->paintTile(*pDevice, nCanvasWidth, nCanvasHeight,
-                    nTilePosX, nTilePosY, nTileWidth, nTileHeight);
-
+    Size aCanvasSize(nCanvasWidth, nCanvasHeight);
+    paintTileToCGContext(pDoc, rCGContext, aCanvasSize, nTilePosX, nTilePosY, nTileWidth, nTileHeight);
 }
 
 #endif


More information about the Libreoffice-commits mailing list