[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit

Miklos Vajna vmiklos at collabora.co.uk
Mon Nov 23 00:53:13 PST 2015


 desktop/source/lib/init.cxx                  |    7 +++++++
 include/LibreOfficeKit/LibreOfficeKit.h      |    3 +++
 include/LibreOfficeKit/LibreOfficeKit.hxx    |   10 ++++++++++
 include/LibreOfficeKit/LibreOfficeKitEnums.h |    7 +++++++
 4 files changed, 27 insertions(+)

New commits:
commit fc06f801ee79fd49d54c27121ae9b2904d99f09c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Nov 23 09:32:37 2015 +0100

    LOK: add Document::getTileMode()
    
    So that clients can know if they get old-style RGBA or new-style ARGB
    output in paintTile().
    
    Change-Id: Icfde4b3259444b3524e64478ccd976664a3fe0ed

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 637e956..cd2f82a 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -312,6 +312,7 @@ void        doc_paintTile(LibreOfficeKitDocument* pThis,
                           const int nCanvasWidth, const int nCanvasHeight,
                           const int nTilePosX, const int nTilePosY,
                           const int nTileWidth, const int nTileHeight);
+static int doc_getTileMode(LibreOfficeKitDocument* pThis);
 static void doc_getDocumentSize(LibreOfficeKitDocument* pThis,
                                 long* pWidth,
                                 long* pHeight);
@@ -385,6 +386,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone
         m_pDocumentClass->getPartName = doc_getPartName;
         m_pDocumentClass->setPartMode = doc_setPartMode;
         m_pDocumentClass->paintTile = doc_paintTile;
+        m_pDocumentClass->getTileMode = doc_getTileMode;
         m_pDocumentClass->getDocumentSize = doc_getDocumentSize;
         m_pDocumentClass->initializeForRendering = doc_initializeForRendering;
         m_pDocumentClass->registerCallback = doc_registerCallback;
@@ -958,6 +960,11 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
 #endif
 }
 
+static int doc_getTileMode(LibreOfficeKitDocument* /*pThis*/)
+{
+    return LOK_TILEMODE_RGBA;
+}
+
 static void doc_getDocumentSize(LibreOfficeKitDocument* pThis,
                                 long* pWidth,
                                 long* pHeight)
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 93f7dca..5189cca 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -118,6 +118,9 @@ struct _LibreOfficeKitDocumentClass
                        const int nTileWidth,
                        const int nTileHeight);
 
+    /// @see lok::Document::getTileMode().
+    int (*getTileMode) (LibreOfficeKitDocument* pThis);
+
     /// @see lok::Document::getDocumentSize().
     void (*getDocumentSize) (LibreOfficeKitDocument* pThis,
                              long* pWidth,
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index a3c0cd8..5e86101 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -143,6 +143,16 @@ public:
                                 nTilePosX, nTilePosY, nTileWidth, nTileHeight);
     }
 
+    /**
+     * Gets the tile mode: the pixel format used for the pBuffer of paintTile().
+     *
+     * @return an element of the LibreOfficeKitTileMode enum.
+     */
+    inline int getTileMode()
+    {
+        return mpDoc->pClass->getTileMode(mpDoc);
+    }
+
     /// Get the document sizes in TWIPs.
     inline void getDocumentSize(long* pWidth, long* pHeight)
     {
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 7b23fcb..b713f0e 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -35,6 +35,13 @@ LibreOfficeKitPartMode;
 
 typedef enum
 {
+    LOK_TILEMODE_RGBA,
+    LOK_TILEMODE_ARGB
+}
+LibreOfficeKitTileMode;
+
+typedef enum
+{
     /**
      * Any tiles which are over the rectangle described in the payload are no
      * longer valid.


More information about the Libreoffice-commits mailing list