1 |
nirbheek 11/04/01 10:47:22 |
2 |
|
3 |
Added: gnome-scan-0.7.2-babl-0.1.0-port.patch |
4 |
Log: |
5 |
Port to babl/gegl-0.1.0 |
6 |
|
7 |
(Portage version: 2.1.9.45/cvs/Linux x86_64) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 media-gfx/gnome-scan/files/gnome-scan-0.7.2-babl-0.1.0-port.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-gfx/gnome-scan/files/gnome-scan-0.7.2-babl-0.1.0-port.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-gfx/gnome-scan/files/gnome-scan-0.7.2-babl-0.1.0-port.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: gnome-scan-0.7.2-babl-0.1.0-port.patch |
16 |
=================================================================== |
17 |
From 72bdbb12db5ca5284767d3011b1144bf142758e0 Mon Sep 17 00:00:00 2001 |
18 |
From: Manuel Osdoba <manuel.osdoba@××××××××××.de> |
19 |
Date: Sun, 21 Mar 2010 11:00:22 +0000 |
20 |
Subject: Support Babl 0.1.0 as well |
21 |
|
22 |
--- |
23 |
diff --git a/configure.ac b/configure.ac |
24 |
index 9880a0d..3b6cb4f 100644 |
25 |
--- a/configure.ac |
26 |
+++ b/configure.ac |
27 |
@@ -63,6 +63,16 @@ PKG_CHECK_MODULES(GNOME_SCAN, [gmodule-2.0 gthread-2.0 gobject-2.0 > 2.14 gtk+-2 |
28 |
AC_SUBST(GNOME_SCAN_CFLAGS) |
29 |
AC_SUBST(GNOME_SCAN_LIBS) |
30 |
|
31 |
+AC_MSG_CHECKING([gegl version >= 0.1.0]) |
32 |
+if pkg-config --modversion "gegl >= 0.1.0" > /dev/null 2>&1; then |
33 |
+ AC_DEFINE(ENABLE_GEGL_010, 1, [Defined to 1 if we use GEGL version 0.1.0 or above.]) |
34 |
+ AC_MSG_RESULT([yes]) |
35 |
+else |
36 |
+ AC_DEFINE(ENABLE_GEGL_010, 0, [Defined to 0 if we do not use GEGL version 0.1.0 or above.]) |
37 |
+ AC_MSG_RESULT([no]) |
38 |
+fi |
39 |
+ |
40 |
+ |
41 |
MODULE_DIR=[${libdir}/${PACKAGE_NAME}-${API_VERSION}] |
42 |
AC_SUBST(MODULE_DIR) |
43 |
|
44 |
diff --git a/modules/gsane/gsane-processor.c b/modules/gsane/gsane-processor.c |
45 |
index cb3526c..c129d18 100644 |
46 |
--- a/modules/gsane/gsane-processor.c |
47 |
+++ b/modules/gsane/gsane-processor.c |
48 |
@@ -22,6 +22,7 @@ |
49 |
#include "gsane-processor.h" |
50 |
#include <string.h> |
51 |
#include <math.h> |
52 |
+#include <config.h> |
53 |
|
54 |
typedef void (*GSaneProcessorFunc) (GSaneProcessor *self, guchar *buf, guint buf_len); |
55 |
|
56 |
@@ -118,7 +119,11 @@ gsane_processor_process_nbit(GSaneProcessor *self, guchar *buf, guint buf_len) |
57 |
operation */ |
58 |
guint src_pos; |
59 |
guint offset; |
60 |
+#if !ENABLE_GEGL_010 |
61 |
guchar *src, *dest, *buf8 = g_new0(guchar, self->priv->pixels_in_buf * self->priv->format->format.bytes_per_pixel); |
62 |
+#else |
63 |
+ guchar *src, *dest, *buf8 = g_new0(guchar, self->priv->pixels_in_buf * babl_format_get_bytes_per_pixel(self->priv->format)); |
64 |
+#endif |
65 |
guint samples_in_buf = self->priv->pixels_in_buf * self->priv->sample_count; |
66 |
for (i = 0 ; i < samples_in_buf ; i++) { |
67 |
/* compute the address of the first byte container sample value */ |
68 |
@@ -180,7 +185,11 @@ gsane_processor_process_three_pass_8bit(GSaneProcessor *self, guchar *buf, guint |
69 |
/* pos of pixel i in buf */ |
70 |
src_pos = i * self->priv->bytes_per_pixel; |
71 |
/* pos of pixel i in buf3 */ |
72 |
+#if !ENABLE_GEGL_010 |
73 |
dest_pos = i * self->priv->format->format.bytes_per_pixel + self->priv->sample_offset; |
74 |
+#else |
75 |
+ dest_pos = i * babl_format_get_bytes_per_pixel(self->priv->format) + self->priv->sample_offset; |
76 |
+#endif |
77 |
/* save */ |
78 |
memcpy(buf3+dest_pos, buf+src_pos, self->priv->bytes_per_pixel); |
79 |
} |
80 |
@@ -368,7 +377,11 @@ gsane_processor_prepare_image(GSaneProcessor *self, SANE_Parameters* params, gui |
81 |
self->priv->format = gsane_processor_get_babl_format(self); |
82 |
g_return_val_if_fail(self->priv->format, NULL); |
83 |
|
84 |
+#if !ENABLE_GEGL_010 |
85 |
self->priv->sample_stride = self->priv->format->format.bytes_per_pixel / MAX(self->priv->sample_count, self->priv->frame_count); |
86 |
+#else |
87 |
+ self->priv->sample_stride = babl_format_get_bytes_per_pixel(self->priv->format) / MAX(self->priv->sample_count, self->priv->frame_count); |
88 |
+#endif |
89 |
self->priv->max_target_sample_value= (0xFFFFFFFF) >> (32 - self->priv->sample_stride * 8); |
90 |
|
91 |
self->priv->buffer = gegl_buffer_new(&extent, self->priv->format); |
92 |
-- |
93 |
cgit v0.9 |