sane-project-website/old-archive/1998-04/0305.html

141 wiersze
7.8 KiB
HTML

<!-- received="Mon Apr 27 22:49:28 1998 PDT" -->
<!-- sent="Tue, 28 Apr 1998 07:46:50 +0200 (MET DST)" -->
<!-- name="Hugo van der Kooij" -->
<!-- email="hvdkooij@caiw.nl" -->
<!-- subject="Re: Two *other* problems with xscanimage" -->
<!-- id="" -->
<!-- inreplyto="m0yU316-000J3NC@yoo-hoo.ai.mit.edu" -->
<title>sane-devel: Re: Two *other* problems with xscanimage</title>
<h1>Re: Two *other* problems with xscanimage</h1>
<b>Hugo van der Kooij</b> (<a href="mailto:hvdkooij@caiw.nl"><i>hvdkooij@caiw.nl</i></a>)<br>
<i>Tue, 28 Apr 1998 07:46:50 +0200 (MET DST)</i>
<p>
<ul>
<li> <b>Messages sorted by:</b> <a href="date.html#305">[ date ]</a><a href="index.html#305">[ thread ]</a><a href="subject.html#305">[ subject ]</a><a href="author.html#305">[ author ]</a>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0306.html">Matto Marjanovic: "Re: Two *other* problems with xscanimage"</a>
<li> <b>Previous message:</b> <a href="0304.html">Matto Marjanovic: "Re: Two *other* problems with xscanimage"</a>
<li> <b>In reply to:</b> <a href="0304.html">Matto Marjanovic: "Re: Two *other* problems with xscanimage"</a>
<!-- nextthread="start" -->
<li> <b>Next in thread:</b> <a href="0306.html">Matto Marjanovic: "Re: Two *other* problems with xscanimage"</a>
<!-- reply="end" -->
</ul>
<!-- body="start" -->
On Tue, 28 Apr 1998, Matto Marjanovic wrote:<br>
<p>
<i>&gt; </i><br>
<i>&gt; From: <a href="mailto:Oliver.Rauch@Wolfsburg.DE">Oliver.Rauch@Wolfsburg.DE</a></i><br>
<i>&gt; </i><br>
<i>&gt; &gt; b) ___Gamma Curve data is corrupted.___</i><br>
<i>&gt; &gt; When turning on table-based gamma correction (and thus instantiating the</i><br>
<i>&gt; &gt; gamma curve widget), the following happen:</i><br>
<i>&gt; &gt; o correct values are read from the (microtek) backend, so far so good.</i><br>
<i>&gt; &gt; o immediately after the call to gtk_curve_set_gamma in curve_new(),</i><br>
<i>&gt; &gt; a call to gtk_curve_get_gamma reveals the correct values were </i><br>
<i>&gt; &gt; written to the widget.</i><br>
<i>&gt; &gt; o sometime later (when the event loop updates/displays the widget, I</i><br>
<i>&gt; &gt; imagine), xscanimage declares</i><br>
<i>&gt; I already have seen this, too. I hope I will find the time to take a closer</i><br>
<i>&gt; look at it soon!</i><br>
<i>&gt; </i><br>
<i>&gt; </i><br>
<i>&gt; Hi Oliver, et al.,</i><br>
<i>&gt; </i><br>
<i>&gt; For no good reason, I went poking at this with gdb (well, at least I'm</i><br>
<i>&gt; learning how to use gdb), and made some discoveries. The problem is in</i><br>
<i>&gt; the widgets, not xscanimage. Someone who knows more about GTK widget</i><br>
<i>&gt; programming will need to take over from here....</i><br>
<i>&gt; </i><br>
<i>&gt; When xscanimage runs, the corruption to the gamma curve widget happens</i><br>
<i>&gt; during the call to gtk_widget_show(notebook) at the end of vector_new()</i><br>
<i>&gt; ["gtkglue.c"]. Here are before and after snapshots of the Curve:</i><br>
<i>&gt; </i><br>
<i>&gt; BEFORE:</i><br>
<i>&gt; </i><br>
<i>&gt; $36 = {graph = {widget = {object = {klass = 0x809b578, flags = 67328, </i><br>
<i>&gt; ref_count = 1, object_data = 0x8087690}, private_flags = 0, </i><br>
<i>&gt; state = 0 '\000', saved_state = 0 '\000', name = 0x0, style = 0x8084368, </i><br>
<i>&gt; requisition = {width = 262, height = 262}, allocation = {x = -1, y = -1, </i><br>
<i>&gt; width = 1, height = 1}, window = 0x0, parent = 0x809b308}, </i><br>
<i>&gt; draw_data = 0x0}, cursor_type = 132, min_x = 0, max_x = 255, min_y = 0, </i><br>
<i>&gt; max_y = 255, pixmap = 0x0, curve_type = GTK_CURVE_TYPE_FREE, height = 255, </i><br>
<i>&gt; grab_point = -1, last = 0, num_points = 256, point = 0x809ba48, </i><br>
<i>&gt; num_ctlpoints = 2, ctlpoint = 0x809ba30}</i><br>
<i>&gt; </i><br>
<i>&gt; AFTER:</i><br>
<i>&gt; </i><br>
<i>&gt; $37 = {graph = {widget = {object = {klass = 0x809b578, flags = 329664, </i><br>
<i>&gt; ref_count = 1, object_data = 0x8095660}, private_flags = 0, </i><br>
<i>&gt; state = 0 '\000', saved_state = 0 '\000', name = 0x0, style = 0x809d5f8, </i><br>
<i>&gt; requisition = {width = 262, height = 262}, allocation = {x = -1, y = -1, </i><br>
<i>&gt; width = 1, height = 1}, window = 0x809d3d8, parent = 0x809b308}, </i><br>
<i>&gt; draw_data = 0x0}, cursor_type = 132, min_x = 0, max_x = 255, min_y = 0, </i><br>
<i>&gt; max_y = 255, pixmap = 0x809d960, curve_type = GTK_CURVE_TYPE_FREE, </i><br>
<i>&gt; height = -5, grab_point = -1, last = 0, num_points = -5, point = 0x809d540, </i><br>
<i>&gt; num_ctlpoints = 2, ctlpoint = 0x809ba30}</i><br>
<i>&gt; </i><br>
<i>&gt; </i><br>
<i>&gt; Note how "height" and "num_points" are now the unlikely values of -5, and</i><br>
<i>&gt; the "point" vector has moved.</i><br>
<i>&gt; </i><br>
<i>&gt; The basic problem is that "allocation.width" and "allocation.height" are 1,1</i><br>
<i>&gt; and not 262,262. The chain of events (I believe) is: [in "gtk/gtkcurve.c"]</i><br>
<i>&gt; </i><br>
<i>&gt; gtk_curve_graph_events() is called for either a CONFIGURE or EXPOSE event,</i><br>
<i>&gt; and subsequently calls gtk_curve_draw() with the width and height taken</i><br>
<i>&gt; from the "allocation", as:</i><br>
<i>&gt; width = w-&gt;allocation.width - RADIUS * 2;</i><br>
<i>&gt; height = w-&gt;allocation.height - RADIUS * 2;</i><br>
<i>&gt; i.e. -5 and -5</i><br>
<i>&gt; </i><br>
<i>&gt; gtk_curve_draw() sees the requested width,height (-5,-5) doesn't match what</i><br>
<i>&gt; was loaded into it (256,256), and calls gtk_curve_interpolate(), which then</i><br>
<i>&gt; generates screwy numbers.</i><br>
<i>&gt; </i><br>
<i>&gt; </i><br>
<i>&gt; SO: Perhaps gtk_curve_graph_events() should use the curve's "requisition"</i><br>
<i>&gt; instead of its "allocation" to calculate those width and height.</i><br>
<i>&gt; Perhaps in an earlier incarnation of GTK, the curve widget got 'allocated'</i><br>
<i>&gt; earlier or something.</i><br>
<i>&gt; I don't really know what design issues are involved here.</i><br>
<i>&gt; </i><br>
<i>&gt; </i><br>
<i>&gt; Whatever the solution is, I'd love to hear it, just to get some more insights</i><br>
<i>&gt; into the workings of GTK.</i><br>
<i>&gt; </i><br>
<i>&gt; Hope this is a good head-start,</i><br>
<i>&gt; -matt m.</i><br>
<p>
Please report it to the authors of gtk and gimp!<br>
<p>
They are the ones that should be working on this problem.<br>
<p>
Hugo.<br>
<p>
+------------------------+------------------------------+<br>
<i> | Hugo van der Kooij | <a href="mailto:Hugo.van.der.Kooij@caiw.nl">Hugo.van.der.Kooij@caiw.nl</a> |</i><br>
<i> | Oranje Nassaustraat 16 | <a href="http://www.caiw.nl/~hvdkooij">http://www.caiw.nl/~hvdkooij</a> |</i><br>
<i> | 3155 VJ Maasland | (De man met de rode hoed) |</i><br>
+------------------------+------------------------------+<br>
"Computers let you make more mistakes faster than any other invention in <br>
human history, with the possible exception of handguns and tequila."<br>
(Mitch Radcliffe)<br>
<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="0306.html">Matto Marjanovic: "Re: Two *other* problems with xscanimage"</a>
<li> <b>Previous message:</b> <a href="0304.html">Matto Marjanovic: "Re: Two *other* problems with xscanimage"</a>
<li> <b>In reply to:</b> <a href="0304.html">Matto Marjanovic: "Re: Two *other* problems with xscanimage"</a>
<!-- nextthread="start" -->
<li> <b>Next in thread:</b> <a href="0306.html">Matto Marjanovic: "Re: Two *other* problems with xscanimage"</a>
<!-- reply="end" -->
</ul>