Kaydet (Commit) 1483643b authored tarafından Pranav Kant's avatar Pranav Kant Kaydeden (comit) Miklos Vajna

lokdocview: move GtkDrawingArea size request out of renderDocument()

... and place it at places only where the widget can change its size.

Change-Id: I4a4b28b35eba06a6faab434677d4d70d2a33339a
üst 35e03615
...@@ -790,7 +790,6 @@ void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial) ...@@ -790,7 +790,6 @@ void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial)
guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels); guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels);
guint nColumns = ceil((double)nDocumentWidthPixels / 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); cairo_t *pcairo = gdk_cairo_create(m_pDrawingArea->window);
// Render the tiles. // Render the tiles.
...@@ -826,7 +825,7 @@ void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial) ...@@ -826,7 +825,7 @@ void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial)
if (bPaint) 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); Tile& currentTile = m_pTileBuffer->getTile(nRow, nColumn);
GdkPixbuf* pPixBuf = currentTile.getBuffer(); GdkPixbuf* pPixBuf = currentTile.getBuffer();
...@@ -1028,6 +1027,10 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback) ...@@ -1028,6 +1027,10 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback)
case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED: case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED:
{ {
payloadToSize(pCallback->m_aPayload.c_str(), m_nDocumentWidthTwips, m_nDocumentHeightTwips); 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; break;
case LOK_CALLBACK_SET_PART: case LOK_CALLBACK_SET_PART:
...@@ -1252,6 +1255,9 @@ SAL_DLLPUBLIC_EXPORT gboolean lok_docview_open_document( LOKDocView* pDocView, c ...@@ -1252,6 +1255,9 @@ SAL_DLLPUBLIC_EXPORT gboolean lok_docview_open_document( LOKDocView* pDocView, c
nTileSizePixels, nTileSizePixels,
nRows, nRows,
nColumns); nColumns);
gtk_widget_set_size_request(pDocView->m_pImpl->m_pDrawingArea,
nDocumentWidthPixels,
nDocumentHeightPixels);
pDocView->m_pImpl->renderDocument(0); pDocView->m_pImpl->renderDocument(0);
} }
...@@ -1273,6 +1279,9 @@ SAL_DLLPUBLIC_EXPORT void lok_docview_set_zoom ( LOKDocView* pDocView, float fZo ...@@ -1273,6 +1279,9 @@ SAL_DLLPUBLIC_EXPORT void lok_docview_set_zoom ( LOKDocView* pDocView, float fZo
guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels); guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels);
pDocView->m_pImpl->m_pTileBuffer->setZoom(fZoom, nRows, nColumns); 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 ) if ( pDocView->m_pImpl->m_pDocument )
pDocView->m_pImpl->renderDocument(0); pDocView->m_pImpl->renderDocument(0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment