From fafc0daa6bd26ad254943315f253b1b218e71080 Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Tue, 26 Oct 2010 17:12:56 +0200 Subject: Imported Upstream version 2.32.0.1 --- src/book.c | 13 +++++++++---- src/page-view.c | 12 ++++++------ src/page.c | 10 +++++----- src/scanner.c | 4 +++- 4 files changed, 23 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/book.c b/src/book.c index b3ec0b6..aced0ad 100644 --- a/src/book.c +++ b/src/book.c @@ -454,7 +454,7 @@ book_save_pdf (Book *book, GFile *file, GError **error) Page *page; GdkPixbuf *image; guchar *pixels, *data, *compressed_data; - gchar *command; + gchar *command, width_buffer[G_ASCII_DTOSTR_BUF_SIZE], height_buffer[G_ASCII_DTOSTR_BUF_SIZE]; const gchar *color_space, *filter = NULL; float page_width, page_height; @@ -620,7 +620,9 @@ book_save_pdf (Book *book, GFile *file, GError **error) pdf_printf (writer, "/Type /Page\n"); pdf_printf (writer, "/Parent %d 0 R\n", pages_number); pdf_printf (writer, "/Resources << /XObject << /Im%d %d 0 R >> >>\n", i, number+1); - pdf_printf (writer, "/MediaBox [ 0 0 %.2f %.2f ]\n", page_width, page_height); + pdf_printf (writer, "/MediaBox [ 0 0 %s %s ]\n", + g_ascii_formatd (width_buffer, sizeof (width_buffer), "%.2f", page_width), + g_ascii_formatd (height_buffer, sizeof (height_buffer), "%.2f", page_height)); pdf_printf (writer, "/Contents %d 0 R\n", number+2); pdf_printf (writer, ">>\n"); pdf_printf (writer, "endobj\n"); @@ -649,9 +651,12 @@ book_save_pdf (Book *book, GFile *file, GError **error) /* Page contents */ command = g_strdup_printf ("q\n" - "%f 0 0 %f 0 0 cm\n" + "%s 0 0 %s 0 0 cm\n" "/Im%d Do\n" - "Q", page_width, page_height, i); + "Q", + g_ascii_formatd (width_buffer, sizeof (width_buffer), "%f", page_width), + g_ascii_formatd (height_buffer, sizeof (height_buffer), "%f", page_height), + i); pdf_printf (writer, "\n"); number = pdf_start_object (writer); pdf_printf (writer, "%d 0 obj\n", number); diff --git a/src/page-view.c b/src/page-view.c index 40823f6..eae49e6 100644 --- a/src/page-view.c +++ b/src/page-view.c @@ -166,18 +166,18 @@ get_pixel (Page *page, gint x, gint y, guchar *pixel) case TOP_TO_BOTTOM: break; case BOTTOM_TO_TOP: - x = page_get_scan_width (page) - x; - y = page_get_scan_height (page) - y; + x = page_get_scan_width (page) - x - 1; + y = page_get_scan_height (page) - y - 1; break; case LEFT_TO_RIGHT: t = x; - x = page_get_scan_width (page) - y; + x = page_get_scan_width (page) - y - 1; y = t; break; case RIGHT_TO_LEFT: t = x; x = y; - y = page_get_scan_height (page) - t; + y = page_get_scan_height (page) - t - 1; break; } @@ -370,7 +370,7 @@ set_pixel (Page *page, blue += p[2] * (T - t); } - if (b != B) { + if (b != B) { get_pixel (page, x, B, p); red += p[0] * (b - B); green += p[1] * (b - B); @@ -387,7 +387,7 @@ set_pixel (Page *page, blue += p[2] * (L - l); } - if (r != R) { + if (r != R) { get_pixel (page, R, y, p); red += p[0] * (r - R); green += p[1] * (r - R); diff --git a/src/page.c b/src/page.c index e70f103..ec21088 100644 --- a/src/page.c +++ b/src/page.c @@ -651,18 +651,18 @@ get_pixel (Page *page, gint x, gint y, guchar *pixel) case TOP_TO_BOTTOM: break; case BOTTOM_TO_TOP: - x = page_get_scan_width (page) - x; - y = page_get_scan_height (page) - y; + x = page_get_scan_width (page) - x - 1; + y = page_get_scan_height (page) - y - 1; break; case LEFT_TO_RIGHT: t = x; - x = page_get_scan_width (page) - y; + x = page_get_scan_width (page) - y - 1; y = t; break; case RIGHT_TO_LEFT: t = x; x = y; - y = page_get_scan_height (page) - t; + y = page_get_scan_height (page) - t - 1; break; } @@ -721,7 +721,7 @@ page_get_image (Page *page, gboolean apply_crop) l = page->priv->crop_x; r = l + page->priv->crop_width; t = page->priv->crop_y; - b = l + page->priv->crop_height; + b = t + page->priv->crop_height; if (l < 0) l = 0; diff --git a/src/scanner.c b/src/scanner.c index f4eb08f..ff8a994 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -1081,6 +1081,7 @@ do_get_option (Scanner *scanner) "Gray", "Grayscale", SANE_I18N ("Grayscale"), + "True Gray", /* Seen in the proprietary brother3 driver */ NULL }; const char *lineart_scan_modes[] = @@ -1096,8 +1097,9 @@ do_get_option (Scanner *scanner) "Thresholded", SANE_VALUE_SCAN_MODE_GRAY, "Gray", - "Grayscale", + "Grayscale", SANE_I18N ("Grayscale"), + "True Gray", /* Seen in the proprietary brother3 driver */ NULL }; -- cgit v1.2.3