[gedit/wip/printing-improvements] print-preview: fix preview_draw()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/wip/printing-improvements] print-preview: fix preview_draw()
- Date: Sat, 27 Jun 2015 15:50:36 +0000 (UTC)
commit 4fca83c385a9f7725a5087ef09d002792ef5b1ff
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat Jun 27 17:46:43 2015 +0200
print-preview: fix preview_draw()
There were two bugs in that function:
- the non-selected pages were not skipped correctly
- the X and Y coordinates for draw_page() were wrong
With a while loop the code is simpler.
gedit/gedit-print-preview.c | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/gedit/gedit-print-preview.c b/gedit/gedit-print-preview.c
index 6aa2aef..c0aa873 100644
--- a/gedit/gedit-print-preview.c
+++ b/gedit/gedit-print-preview.c
@@ -924,26 +924,24 @@ preview_draw (GtkWidget *widget,
gtk_cairo_transform_to_window (cr, widget, bin_window);
+ col = 0;
page_num = get_first_page_displayed (preview);
- for (col = 0; col < preview->n_columns; col++)
+ while (col < preview->n_columns && page_num < preview->n_pages)
{
if (!gtk_print_operation_preview_is_selected (preview->gtk_preview, page_num))
{
+ page_num++;
continue;
}
- if (page_num == preview->n_pages)
- {
- break;
- }
-
draw_page (cr,
+ col * preview->tile_width,
0,
- col * preview->tile_height,
page_num,
preview);
+ col++;
page_num++;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]