sane-project-website/old-archive/1998-03/0076.html

113 wiersze
4.2 KiB
HTML

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

<!-- received="Tue Mar 10 12:26:12 1998 PST" -->
<!-- sent="Tue, 10 Mar 1998 21:25:59 +0100 (CET)" -->
<!-- name="=?ISO-8859-1?Q?Mikko_Ty=F6l=E4j=E4rvi?=" -->
<!-- email="mikko@dynas.se" -->
<!-- subject="gimp plugin weirdness (workaround included)" -->
<!-- id="" -->
<!-- inreplyto="" -->
<title>sane-devel: gimp plugin weirdness (workaround included)</title>
<h1>gimp plugin weirdness (workaround included)</h1>
<b>=?ISO-8859-1?Q?Mikko_Ty=F6l=E4j=E4rvi?=</b> (<a href="mailto:mikko@dynas.se"><i>mikko@dynas.se</i></a>)<br>
<i>Tue, 10 Mar 1998 21:25:59 +0100 (CET)</i>
<p>
<ul>
<li> <b>Messages sorted by:</b> <a href="date.html#76">[ date ]</a><a href="index.html#76">[ thread ]</a><a href="subject.html#76">[ subject ]</a><a href="author.html#76">[ author ]</a>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0077.html">Bjoern Chyba: "SANE"</a>
<li> <b>Previous message:</b> <a href="0075.html">Hugo van der Kooij: "Re: PB compile sane-0.71"</a>
<!-- nextthread="start" -->
<!-- reply="end" -->
</ul>
<!-- body="start" -->
Hello!<br>
<p>
I've had problems running xscanimage as a gimp plugin while using the<br>
snapscan backend. I have sort-of found the problem, but can't really<br>
figure out which part of the code to "blame".<br>
<p>
What I'm using:<br>
<p>
Agfa Snapscan 310<br>
sane-0.71<br>
gimp-0.99.18<br>
gtk-0.99.3<br>
FreeBSD 2.2.5<br>
<p>
Symptoms: Running xscanimage as a gimp plug-in will hang the<br>
xscanimage process when the scan is done.<br>
<p>
I located the problem to xscanimage.c:scan_done(). When it writes the<br>
last, partial, tile it has a line count that is off-by-one -- it<br>
somehow believes that it has an area that is one line larger than the<br>
actual image. This eventually causes an endless loop in<br>
gimp_pixel_rgn_set_rect(), which makes sure it is not writing outside<br>
its buffer (or tile or whatever).<br>
<p>
Applying a sanity check like this works around the problem:<br>
<p>
<p>
--- xscanimage.c.org Sat Feb 28 16:08:58 1998<br>
+++ xscanimage.c Tue Mar 10 19:01:46 1998<br>
@@ -771,6 +771,9 @@<br>
int remaining;<br>
<br>
/* GIMP mode */<br>
+ if (scan_win.y &gt; scan_win.param.lines)<br>
+ scan_win.y = scan_win.param.lines;<br>
+<br>
remaining = scan_win.y % gimp_tile_height ();<br>
if (remaining)<br>
gimp_pixel_rgn_set_rect (&amp;scan_win.region, scan_win.tile,<br>
@@ -809,6 +812,9 @@<br>
int height, remaining;<br>
<br>
/* write the last tile of the frame to the GIMP region: */<br>
+<br>
+ if (scan_win.y &gt; scan_win.param.lines) /* Sanity check */<br>
+ scan_win.y = scan_win.param.lines;<br>
<br>
remaining = scan_win.y % gimp_tile_height ();<br>
if (remaining)<br>
<p>
<p>
Right before a hang, (scan_win.y == scan_win.param.lines+1), which is<br>
bad, and should not happen at all.<br>
<p>
Am I really the only one with this problem?! (Rhetorical question...:^)<br>
<p>
Looking at the code I don't feel entirely convinced that the way<br>
xscanimage.c:advance() gets called when reading RGB data is correct,<br>
but I wouldn't bet either way. (Well, I know for a fact that<br>
scan_win.y gets incremented one time too many :-)<br>
<p>
However, this has to be triggered by the way data is delivered by the<br>
snapscan backend in RBG mode (perhaps hte way it always returns full<br>
lines in each block, as it has to assemble the colour components from<br>
a buffer), or users of other scanners should have seen it too.<br>
<p>
At first I assumed the snapscan backend was at fault, but I have spent<br>
quite a lot of time tracking it now, and feel fairly sure it is<br>
behaving correctly.<br>
<p>
Any helpful insights would be most welcome!<br>
<p>
<p>
/Mikko<br>
<p>
<p>
<p>
<pre>
--
Source code, list archive, and docs: <a href="http://www.mostang.com/sane/">http://www.mostang.com/sane/</a>
To unsubscribe: echo unsubscribe sane-devel | mail <a href="mailto:majordomo@mostang.com">majordomo@mostang.com</a>
</pre>
<!-- body="end" -->
<p>
<ul>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0077.html">Bjoern Chyba: "SANE"</a>
<li> <b>Previous message:</b> <a href="0075.html">Hugo van der Kooij: "Re: PB compile sane-0.71"</a>
<!-- nextthread="start" -->
<!-- reply="end" -->
</ul>