diff options
author | Pranav Kant <pranavk@gnome.org> | 2015-06-05 20:38:55 +0530 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-06-09 10:44:23 +0200 |
commit | 1483643ba5930474b9eab73b723a775dd3c8c850 (patch) | |
tree | 4a4201f4f168db4cef691b0eca3fd5eb79a07bc9 /libreofficekit | |
parent | 35e03615066a6525e0259ff1823a0da0c2d4820a (diff) |
lokdocview: move GtkDrawingArea size request out of renderDocument()
... and place it at places only where the widget can change its size.
Change-Id: I4a4b28b35eba06a6faab434677d4d70d2a33339a
Diffstat (limited to 'libreofficekit')
-rw-r--r-- | libreofficekit/source/gtk/lokdocview.cxx | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index 507e81ff6765..49ea27d91308 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -790,7 +790,6 @@ void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial) guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels); guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); - gtk_widget_set_size_request(m_pDrawingArea, nDocumentWidthPixels, nDocumentHeightPixels); cairo_t *pcairo = gdk_cairo_create(m_pDrawingArea->window); // Render the tiles. @@ -826,7 +825,7 @@ void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial) if (bPaint) { - g_info("tile_buffer_get_tile (%d, %d)", nRow, nColumn); + //g_info("tile_buffer_get_tile (%d, %d)", nRow, nColumn); Tile& currentTile = m_pTileBuffer->getTile(nRow, nColumn); GdkPixbuf* pPixBuf = currentTile.getBuffer(); @@ -1028,6 +1027,10 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback) case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED: { payloadToSize(pCallback->m_aPayload.c_str(), m_nDocumentWidthTwips, m_nDocumentHeightTwips); + gtk_widget_set_size_request(m_pDrawingArea, + twipToPixel(m_nDocumentWidthTwips, m_fZoom), + twipToPixel(m_nDocumentHeightTwips, m_fZoom)); + m_pTileBuffer->resetAllTiles(); } break; case LOK_CALLBACK_SET_PART: @@ -1252,6 +1255,9 @@ SAL_DLLPUBLIC_EXPORT gboolean lok_docview_open_document( LOKDocView* pDocView, c nTileSizePixels, nRows, nColumns); + gtk_widget_set_size_request(pDocView->m_pImpl->m_pDrawingArea, + nDocumentWidthPixels, + nDocumentHeightPixels); pDocView->m_pImpl->renderDocument(0); } @@ -1273,6 +1279,9 @@ SAL_DLLPUBLIC_EXPORT void lok_docview_set_zoom ( LOKDocView* pDocView, float fZo guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); pDocView->m_pImpl->m_pTileBuffer->setZoom(fZoom, nRows, nColumns); + gtk_widget_set_size_request(pDocView->m_pImpl->m_pDrawingArea, + nDocumentWidthPixels, + nDocumentHeightPixels); if ( pDocView->m_pImpl->m_pDocument ) pDocView->m_pImpl->renderDocument(0); |