summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2016-05-06 08:16:00 -0400
committerAshod Nakashian <ashnakash@gmail.com>2016-05-06 12:39:45 +0000
commit7f6a0f656ddb2312c3d78091fce663a36ef6e1db (patch)
tree4a92267c0efaf0bb9d8344bcc20b68291115c632 /include
parentbd5f5ee9b21fd52e13e759643fe885836f0b82f8 (diff)
Allow painting for arbitrary part
Painting should not cause any state changes, but to paint a tile on a different part than the current has to change the document, which sends notifications to all clients. A new API, paintPartTile, allows for painting tiles on any part without sending change of part notifications. Furthermore, because we block notifications during this operation, no tile invalidation is issued due to changing of the part. One issue remains in the cases when the LO Core resets the cursor position internally and we resume editing after painting, the cursor might be at the top of the page. This needs fixing separately. Change-Id: If19bd1c90ecad4d5ed5e8d09513741b7994fa6e5 Reviewed-on: https://gerrit.libreoffice.org/24698 Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.h13
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.hxx21
2 files changed, 34 insertions, 0 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index be833dbaf1d9..9f604a39ed5f 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -226,6 +226,19 @@ struct _LibreOfficeKitDocumentClass
/// @see lok::Document::getPartHash().
char* (*getPartHash) (LibreOfficeKitDocument* pThis,
int nPart);
+
+ /// Paints a tile from a specific part.
+ /// @see lok::Document::paintTile().
+ void (*paintPartTile) (LibreOfficeKitDocument* pThis,
+ unsigned char* pBuffer,
+ const int nPart,
+ const int nCanvasWidth,
+ const int nCanvasHeight,
+ const int nTilePosX,
+ const int nTilePosY,
+ const int nTileWidth,
+ const int nTileHeight);
+
#endif // LOK_USE_UNSTABLE_API
};
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 5bd3e60b9286..38292daafe17 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -411,6 +411,27 @@ public:
return mpDoc->pClass->renderFont(mpDoc, pFontName, pFontWidth, pFontHeight);
}
+ /**
+ * Renders a subset of the document's part to a pre-allocated buffer.
+ *
+ * @param nPart the part number of the document of which the tile is painted.
+ * @see paintTile.
+ */
+ inline void paintPartTile(unsigned char* pBuffer,
+ const int nPart,
+ const int nCanvasWidth,
+ const int nCanvasHeight,
+ const int nTilePosX,
+ const int nTilePosY,
+ const int nTileWidth,
+ const int nTileHeight)
+ {
+ return mpDoc->pClass->paintPartTile(mpDoc, pBuffer, nPart,
+ nCanvasWidth, nCanvasHeight,
+ nTilePosX, nTilePosY,
+ nTileWidth, nTileHeight);
+ }
+
#endif // LOK_USE_UNSTABLE_API
};