summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej.hunt@collabora.com>2014-05-18 08:37:13 +0100
committerAndrzej Hunt <andrzej.hunt@collabora.com>2014-06-25 13:04:29 +0100
commitdbf426edeab1a9f06073fa40a14561075206e58f (patch)
tree295c9022cb108a4d68ee264ee92e9d57ba8b5221 /desktop
parentfd5f324b0988f62f89216ce01ef23131bffb4e0c (diff)
Draw the whole image for our gtk tiled viewer.
We just draw one huge tile, it doesn't seem to work too well for larger documents though where the latter portions can appear empty. Change-Id: Ic527aec377bf2f82a528a04392186d3d8b752762
Diffstat (limited to 'desktop')
-rw-r--r--desktop/qa/gtktiledviewer/gtktiledviewer.cxx18
1 files changed, 15 insertions, 3 deletions
diff --git a/desktop/qa/gtktiledviewer/gtktiledviewer.cxx b/desktop/qa/gtktiledviewer/gtktiledviewer.cxx
index fcaac63aa6f1..f689ab1be9b2 100644
--- a/desktop/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/desktop/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -39,11 +39,23 @@ bool drawCallback(GtkWidget* /* The eventbox */, void* /* cairo_t* cr */, gpoint
Document* pDocument = static_cast< Document* >( pData );
- // Hardcoded tile just to see whether or not we get any sort of output.
- unsigned char* pBuffer = pDocument->paintTile( 1000, 1000, 0, 0, 10000, 10000 );
+ long nWidth, nHeight;
+ pDocument->getDocumentSize( &nWidth, &nHeight );
+
+ // Draw the whole document at once (for now)
+ int nRenderWidth = nWidth / 10;
+ int nRenderHeight = nHeight / 10;
+ int nRowStride;
+ unsigned char* pBuffer = pDocument->paintTile( nRenderWidth, nRenderHeight,
+ &nRowStride,
+ 0, 0, // origin
+ nWidth, nHeight );
+
GdkPixbuf* pBixBuf = gdk_pixbuf_new_from_data( pBuffer, GDK_COLORSPACE_RGB,
- false, 8, 1000, 1000, 3*1000,
+ false, 8,
+ nRenderWidth, nRenderHeight,
+ nRowStride,
0, 0 );
pBixBuf = gdk_pixbuf_flip( pBixBuf, false );
gtk_image_set_from_pixbuf( GTK_IMAGE(ourCanvas), pBixBuf );