diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-05-22 13:34:47 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-05-22 13:56:54 +0100 |
commit | 124c937f3bd6a7538dc6664ab9556fcfb3f27088 (patch) | |
tree | c1db0e01839915878ab5a409af741324422bcec6 /libreofficekit | |
parent | 2807bcc186c976e55b6844d3459e2b0fbb92cdb8 (diff) |
lokdocview: it's enough to query the document size once
Change-Id: Id99c9f1a814bc5f935eeb4e301ef3014ccb0bd07
Diffstat (limited to 'libreofficekit')
-rw-r--r-- | libreofficekit/source/gtk/lokdocview.cxx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index d4f21e1ea2d2..b2b7f2c93017 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -50,6 +50,8 @@ struct LOKDocView_Impl LibreOfficeKit* m_pOffice; LibreOfficeKitDocument* m_pDocument; + long m_nDocumentWidthTwips; + long m_nDocumentHeightTwips; /// View or edit mode. bool m_bEdit; /// Position and size of the visible cursor. @@ -239,6 +241,8 @@ LOKDocView_Impl::LOKDocView_Impl(LOKDocView* pDocView) m_fZoom(1), m_pOffice(0), m_pDocument(0), + m_nDocumentWidthTwips(0), + m_nDocumentHeightTwips(0), m_bEdit(false), m_aVisibleCursor({0, 0, 0, 0}), m_bCursorOverlayVisible(false), @@ -745,11 +749,8 @@ void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial) { const int nTileSizePixels = 256; - // Get document size and find out how many rows / columns we need. - long nDocumentWidthTwips, nDocumentHeightTwips; - m_pDocument->pClass->getDocumentSize(m_pDocument, &nDocumentWidthTwips, &nDocumentHeightTwips); - long nDocumentWidthPixels = twipToPixel(nDocumentWidthTwips); - long nDocumentHeightPixels = twipToPixel(nDocumentHeightTwips); + long nDocumentWidthPixels = twipToPixel(m_nDocumentWidthTwips); + long nDocumentHeightPixels = twipToPixel(m_nDocumentHeightTwips); // Total number of rows / columns in this document. guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels); guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); @@ -1179,6 +1180,7 @@ SAL_DLLPUBLIC_EXPORT gboolean lok_docview_open_document( LOKDocView* pDocView, c { pDocView->m_pImpl->m_pDocument->pClass->initializeForRendering(pDocView->m_pImpl->m_pDocument); pDocView->m_pImpl->m_pDocument->pClass->registerCallback(pDocView->m_pImpl->m_pDocument, &LOKDocView_Impl::callbackWorker, pDocView); + pDocView->m_pImpl->m_pDocument->pClass->getDocumentSize(pDocView->m_pImpl->m_pDocument, &pDocView->m_pImpl->m_nDocumentWidthTwips, &pDocView->m_pImpl->m_nDocumentHeightTwips); g_timeout_add(600, &LOKDocView_Impl::handleTimeout, pDocView); pDocView->m_pImpl->renderDocument(0); } |