desktop/source/lib/init.cxx               |  102 +++++++-----------------------
 include/LibreOfficeKit/LibreOfficeKit.h   |   12 ---
 include/LibreOfficeKit/LibreOfficeKit.hxx |   28 --------
 3 files changed, 25 insertions(+), 117 deletions(-)

New commits:
commit 0340cbbc34d2c97baa5b7ebc4a57650861907067
Author:     Tor Lillqvist <t...@collabora.com>
AuthorDate: Wed Apr 26 15:39:38 2023 +0300
Commit:     Tor Lillqvist <t...@collabora.com>
CommitDate: Thu Apr 27 06:53:22 2023 +0200

    Bin the unused paintTileToCGContext special thing for iOS
    
    It was used by "LibreOfficeLight" which died years ago.
    
    Change-Id: I71a1315448baa4f1ec7a22b20cb3dd39c88cda78
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151066
    Tested-by: Jenkins
    Reviewed-by: Tor Lillqvist <t...@collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index af31b1829163..d6ce62b38be4 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1119,13 +1119,6 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
                           const int nCanvasWidth, const int nCanvasHeight,
                           const int nTilePosX, const int nTilePosY,
                           const int nTileWidth, const int nTileHeight);
-#ifdef IOS
-static void doc_paintTileToCGContext(LibreOfficeKitDocument* pThis,
-                                     void* rCGContext,
-                                     const int nCanvasWidth, const int 
nCanvasHeight,
-                                     const int nTilePosX, const int nTilePosY,
-                                     const int nTileWidth, const int 
nTileHeight);
-#endif
 static void doc_paintPartTile(LibreOfficeKitDocument* pThis,
                               unsigned char* pBuffer,
                               const int nPart,
@@ -1392,9 +1385,6 @@ LibLODocument_Impl::LibLODocument_Impl(uno::Reference 
<css::lang::XComponent> xC
         m_pDocumentClass->setPartMode = doc_setPartMode;
         m_pDocumentClass->getEditMode = doc_getEditMode;
         m_pDocumentClass->paintTile = doc_paintTile;
-#ifdef IOS
-        m_pDocumentClass->paintTileToCGContext = doc_paintTileToCGContext;
-#endif
         m_pDocumentClass->paintPartTile = doc_paintPartTile;
         m_pDocumentClass->getTileMode = doc_getTileMode;
         m_pDocumentClass->getDocumentSize = doc_getDocumentSize;
@@ -2586,41 +2576,6 @@ LibLibreOffice_Impl::~LibLibreOffice_Impl()
 namespace
 {
 
-#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::WITHOUT_ALPHA);
-    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);
-
-    CGContextTranslateCTM(pCGContext, 0, nCanvasHeight);
-    CGContextScaleCTM(pCGContext, fDPIScale, -fDPIScale);
-
-    doc_paintTileToCGContext(pThis, (void*) pCGContext, nCanvasWidth, 
nCanvasHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight);
-
-    CGContextRelease(pCGContext);
-}
-#endif
-
 void setLanguageAndLocale(OUString const & aLangISO)
 {
     SvtSysLocaleOptions aLocalOptions;
@@ -3933,8 +3888,31 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
     comphelper::ScopeGuard dpiScaleGuard([]() { 
comphelper::LibreOfficeKit::setDPIScale(1.0); });
 
 #if defined(IOS)
-    double fDPIScaleX = 1.0;
-    paintTileIOS(pThis, pBuffer, nCanvasWidth, nCanvasHeight, fDPIScaleX, 
nTilePosX, nTilePosY, nTileWidth, nTileHeight);
+    double fDPIScale = 1.0;
+
+    CGContextRef pCGContext = CGBitmapContextCreate(pBuffer, nCanvasWidth, 
nCanvasHeight, 8,
+                                                    nCanvasWidth * 4, 
CGColorSpaceCreateDeviceRGB(),
+                                                    
kCGImageAlphaPremultipliedFirst | kCGImageByteOrder32Little);
+
+    CGContextTranslateCTM(pCGContext, 0, nCanvasHeight);
+    CGContextScaleCTM(pCGContext, fDPIScale, -fDPIScale);
+
+    SAL_INFO( "lok.tiledrendering", "doc_paintTile: painting [" << nTileWidth 
<< "x" << nTileHeight <<
+              "]@(" << nTilePosX << ", " << nTilePosY << ") to [" <<
+              nCanvasWidth << "x" << nCanvasHeight << "]px" );
+
+    Size aCanvasSize(nCanvasWidth, nCanvasHeight);
+
+    SystemGraphicsData aData;
+    aData.rCGContext = reinterpret_cast<CGContextRef>(pCGContext);
+
+    ScopedVclPtrInstance<VirtualDevice> pDevice(aData, Size(1, 1), 
DeviceFormat::WITHOUT_ALPHA);
+    pDevice->SetBackground(Wallpaper(COL_TRANSPARENT));
+    pDevice->SetOutputSizePixel(aCanvasSize);
+    pDoc->paintTile(*pDevice, aCanvasSize.Width(), aCanvasSize.Height(),
+                    nTilePosX, nTilePosY, nTileWidth, nTileHeight);
+
+    CGContextRelease(pCGContext);
 #else
     ScopedVclPtrInstance< VirtualDevice > pDevice(DeviceFormat::WITHOUT_ALPHA);
 
@@ -3997,36 +3975,6 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
 #endif
 }
 
-#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.
-static void doc_paintTileToCGContext(LibreOfficeKitDocument* pThis,
-                                     void* rCGContext,
-                                     const int nCanvasWidth, const int 
nCanvasHeight,
-                                     const int nTilePosX, const int nTilePosY,
-                                     const int nTileWidth, const int 
nTileHeight)
-{
-    SolarMutexGuard aGuard;
-    SetLastExceptionMsg();
-
-    SAL_INFO( "lok.tiledrendering", "paintTileToCGContext: painting [" << 
nTileWidth << "x" << nTileHeight <<
-              "]@(" << nTilePosX << ", " << nTilePosY << ") to [" <<
-              nCanvasWidth << "x" << nCanvasHeight << "]px" );
-
-    ITiledRenderable* pDoc = getTiledRenderable(pThis);
-    if (!pDoc)
-    {
-        SetLastExceptionMsg("Document doesn't support tiled rendering");
-        return;
-    }
-
-    Size aCanvasSize(nCanvasWidth, nCanvasHeight);
-    paintTileToCGContext(pDoc, rCGContext, aCanvasSize, nTilePosX, nTilePosY, 
nTileWidth, nTileHeight);
-}
-
-#endif
-
 static void doc_paintPartTile(LibreOfficeKitDocument* pThis,
                               unsigned char* pBuffer,
                               const int nPart,
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index e98ea6f47f42..767469666fef 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -356,18 +356,6 @@ struct _LibreOfficeKitDocumentClass
                             const int width, const int height,
                             const double dpiscale);
 
-#ifdef IOS
-    /// @see lok::Document::paintTileToCGContext().
-    void (*paintTileToCGContext) (LibreOfficeKitDocument* pThis,
-                                  void* rCGContext,
-                                  const int nCanvasWidth,
-                                  const int nCanvasHeight,
-                                  const int nTilePosX,
-                                  const int nTilePosY,
-                                  const int nTileWidth,
-                                  const int nTileHeight);
-#endif // IOS
-
 // CERTIFICATE AND SIGNING
 
     /// @see lok::Document::insertCertificate().
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 501b10bb61f9..2946d0baaf7d 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -664,34 +664,6 @@ public:
         mpDoc->pClass->postWindowExtTextInputEvent(mpDoc, nWindowId, nType, 
pText);
     }
 
-#ifdef IOS
-    /**
-     * Renders a subset of the document to a Core Graphics context.
-     *
-     * Note that the buffer size and the tile size implicitly supports
-     * rendering at different zoom levels, as the number of rendered pixels and
-     * the rendered rectangle of the document are independent.
-     *
-     * @param rCGContext the CGContextRef, cast to a void*.
-     * @param nCanvasHeight number of pixels in a column of pBuffer.
-     * @param nTilePosX logical X position of the top left corner of the 
rendered rectangle, in TWIPs.
-     * @param nTilePosY logical Y position of the top left corner of the 
rendered rectangle, in TWIPs.
-     * @param nTileWidth logical width of the rendered rectangle, in TWIPs.
-     * @param nTileHeight logical height of the rendered rectangle, in TWIPs.
-     */
-    void paintTileToCGContext(void* rCGContext,
-                              const int nCanvasWidth,
-                              const int nCanvasHeight,
-                              const int nTilePosX,
-                              const int nTilePosY,
-                              const int nTileWidth,
-                              const int nTileHeight)
-    {
-        return mpDoc->pClass->paintTileToCGContext(mpDoc, rCGContext, 
nCanvasWidth, nCanvasHeight,
-                                                   nTilePosX, nTilePosY, 
nTileWidth, nTileHeight);
-    }
-#endif // IOS
-
     /**
      *  Insert certificate (in binary form) to the certificate store.
      */

Reply via email to