desktop/source/lib/init.cxx               |   23 +++++++++++++++++++++--
 include/LibreOfficeKit/LibreOfficeKit.h   |    7 +++++--
 include/LibreOfficeKit/LibreOfficeKit.hxx |   24 ++++++++++++++++++++++--
 3 files changed, 48 insertions(+), 6 deletions(-)

New commits:
commit b8e528ee27dce7b3bc742fd6c63af41fbd3608ed
Author:     Tor Lillqvist <t...@collabora.com>
AuthorDate: Tue Feb 28 18:23:06 2023 +0200
Commit:     Tor Lillqvist <t...@collabora.com>
CommitDate: Wed Mar 1 09:35:37 2023 +0000

    Improve the LibreOfficeKit Document::paintThumbnail() API
    
    No implementation yet.
    
    Change-Id: Ie1dc955bc8b589bd336af0545a2270cbe84a8b9c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148028
    Tested-by: Jenkins
    Reviewed-by: Tor Lillqvist <t...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148032
    Tested-by: Tor Lillqvist <t...@collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 2bf2bb676016..c584408b5e8d 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1114,7 +1114,12 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
                           const int nCanvasWidth, const int nCanvasHeight,
                           const int nTilePosX, const int nTilePosY,
                           const int nTileWidth, const int nTileHeight);
-static void doc_paintThumbnail(LibreOfficeKitDocument* pThis, unsigned char* 
pBuffer, int x, int y);
+static void doc_paintThumbnail(LibreOfficeKitDocument* pThis,
+                               unsigned char* pBuffer,
+                               int bufferWidth,
+                               int bufferHeight,
+                               int width,
+                               const char* pURL);
 #ifdef IOS
 static void doc_paintTileToCGContext(LibreOfficeKitDocument* pThis,
                                      void* rCGContext,
@@ -4007,8 +4012,14 @@ static void 
doc_paintTileToCGContext(LibreOfficeKitDocument* pThis,
 
 #endif
 
-static void doc_paintThumbnail(LibreOfficeKitDocument* pThis, unsigned char* 
pBuffer, int x, int y)
+static void doc_paintThumbnail(LibreOfficeKitDocument* pThis,
+                               unsigned char* pBuffer,
+                               int bufferWidth,
+                               int bufferHeight,
+                               int width,
+                               const char* pURL)
 {
+#if 0
     constexpr float zoom = 0.5f;
     constexpr int pixelWidth = 120;
     constexpr int pixelHeight = 120;
@@ -4018,6 +4029,14 @@ static void doc_paintThumbnail(LibreOfficeKitDocument* 
pThis, unsigned char* pBu
     constexpr int offsetYTwips = 15 * 15;
 
     doc_paintTile(pThis, pBuffer, pixelWidth, pixelHeight, x-offsetXTwips, 
y-offsetYTwips, pixelWidthTwips, pixelHeightTwips);
+#else
+    (void) pThis;
+    (void) pBuffer;
+    (void) bufferWidth;
+    (void) bufferHeight;
+    (void) width;
+    (void) pURL;
+#endif
 }
 
 static void doc_paintPartTile(LibreOfficeKitDocument* pThis,
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index 4de2380998b4..09d3e91e8640 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -501,10 +501,13 @@ struct _LibreOfficeKitDocumentClass
     /// @see lok::Document::setViewTimezone().
     void (*setViewTimezone) (LibreOfficeKitDocument* pThis, int nId, const 
char* timezone);
 
+    /// @see lok::Document::paintThumbnail().
     void (*paintThumbnail) (LibreOfficeKitDocument* pThis,
                             unsigned char* pBuffer,
-                            int x,
-                            int y);
+                            int bufferWidth,
+                            int bufferHeight,
+                            int width,
+                            const char* pURL);
 
 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
 };
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index cf17922fab06..e418bd88a316 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -886,9 +886,29 @@ public:
         mpDoc->pClass->setViewTimezone(mpDoc, nId, timezone);
     }
 
-    void paintThumbnail(unsigned char* pBuffer, int x, int y)
+    /**
+     * Create a thumbnail of a location in the document.
+     *
+     * @param pBuffer Where the thumbnail is painted. Same format as a tile 
painted
+     * by paintTile().
+     * @param bufferWidth number of pixels in a row of pBuffer.
+     * @param bufferHeight number of pixels in a column of pBuffer.
+     * @param width logical width of the rendered rectangle, in TWIPs.
+     * @param pURL Just the fragment part of a URL, indicating the location in 
the document
+     * to render as a thumbnail. As returned by extractRequest(), or null, 
meaning the start
+     * of the document.
+     *
+     * Note that there is no parameter for the logical height of the
+     * rendered rectangle. The aspect ratio of the rendered rectangle
+     * is determined by the bufferWidth and bufferHeight parameters.
+     */
+    void paintThumbnail(unsigned char* pBuffer,
+                        int bufferWidth,
+                        int bufferHeight,
+                        int width,
+                        const char* pURL)
     {
-        return mpDoc->pClass->paintThumbnail(mpDoc, pBuffer, x, y);
+        return mpDoc->pClass->paintThumbnail(mpDoc, pBuffer, bufferWidth, 
bufferHeight, width, pURL);
     }
 
 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY

Reply via email to