summaryrefslogtreecommitdiff
path: root/src/page.c
diff options
context:
space:
mode:
authorAlessio Treglia <alessio@debian.org>2010-07-12 19:34:33 +0200
committerAlessio Treglia <alessio@debian.org>2010-07-12 19:34:33 +0200
commit88ed5294e45c9a82b309c08aa5533388d90b1a1f (patch)
tree0f7ecf0420c14bed82d615e98005327e8e613fe8 /src/page.c
parent046e95e38e048f663efbf421894f3f84a212525b (diff)
parentc15dc3b14e35850849f3559ac0305b4cac4a7046 (diff)
Merge commit 'upstream/2.31.5.bzr424'
Diffstat (limited to 'src/page.c')
-rw-r--r--src/page.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/page.c b/src/page.c
index 5888a46..655b43b 100644
--- a/src/page.c
+++ b/src/page.c
@@ -31,6 +31,9 @@ struct PagePrivate
/* Number of rows in this page or -1 if currently unknown */
gint rows;
+ /* Bit depth */
+ gint depth;
+
/* Color profile */
gchar *color_profile;
@@ -43,6 +46,9 @@ struct PagePrivate
/* TRUE if have some page data */
gboolean has_data;
+ /* TRUE if have color data */
+ gboolean is_color;
+
/* Expected next scan row */
gint scan_line;
@@ -179,6 +185,21 @@ gboolean page_has_data (Page *page)
}
+gboolean page_is_color (Page *page)
+{
+ g_return_val_if_fail (page != NULL, FALSE);
+ return page->priv->is_color;
+}
+
+
+gint
+page_get_depth (Page *page)
+{
+ g_return_val_if_fail (page != NULL, 0);
+ return page->priv->depth;
+}
+
+
gint page_get_scan_line (Page *page)
{
g_return_val_if_fail (page != NULL, -1);
@@ -191,7 +212,7 @@ set_pixel (ScanLine *line, gint n, gint x, guchar *pixel)
{
gint sample;
guchar *data;
-
+
data = line->data + line->data_length * n;
switch (line->format) {
@@ -231,6 +252,11 @@ parse_line (Page *page, ScanLine *line, gint n, gboolean *size_changed)
line_number = line->number + n;
+ if (line->format != LINE_GRAY)
+ page->priv->is_color = TRUE;
+ if (line->depth > page->priv->depth)
+ page->priv->depth = line->depth;
+
/* Extend image if necessary */
while (line_number >= page_get_scan_height (page)) {
GdkPixbuf *image;