After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 149452 - line width seems incorrectly initialized
line width seems incorrectly initialized
Status: RESOLVED FIXED
Product: gnome-print
Classification: Deprecated
Component: general
2.6.x
Other Linux
: Normal normal
: ---
Assigned To: Jody Goldberg
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2004-08-05 23:07 UTC by Emmanuel Pacaud
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: 2.5/2.6


Attachments
Example in gnumeric chart without workaround (56.62 KB, image/png)
2004-08-05 23:11 UTC, Emmanuel Pacaud
  Details
Same, with workaround (54.22 KB, image/png)
2004-08-05 23:12 UTC, Emmanuel Pacaud
  Details
compare the transformed values (1.45 KB, patch)
2004-08-08 14:24 UTC, Jody Goldberg
none Details | Review

Description Emmanuel Pacaud 2004-08-05 23:07:47 UTC
This bug is related to the use of gnome_print_setlinewidth. It seems the
linewidth member of gnome print context is incorrectly initialized.

If you draw severals lines with the following linewidth:

1.0 1.0 10.0 1.0 1.0

The first two lines won't have the same width as the last two. Apparently, as
soon as we call gnome_print_setlinewidth with a width != 1.0, line width is correct.

For example, as a workaround for this bug in gnumeric charting, I have a call to
gnome_print_setlinewidth (ctx, 0.1).

Bug occurs wathever the output is (screen or postscript).
Comment 1 Emmanuel Pacaud 2004-08-05 23:11:40 UTC
Created attachment 30256 [details]
Example in gnumeric chart without workaround

All the lines and outlines are 1.0 width, exept the thickest one.
Axis are drawn first, then polygons.
Comment 2 Emmanuel Pacaud 2004-08-05 23:12:10 UTC
Created attachment 30257 [details]
Same, with workaround
Comment 3 Andreas J. Guelzow 2004-08-06 02:37:03 UTC
Well, this may not be an issue of intialization but of what
gnome_print_setlinewidth is really doing. THe main code is:

	if (!GP_GC_EQ (width, ctx->linewidth)) {
		ctx->linewidth = (fabs (width * ctx->ctm[0]) + fabs (width * ctx->ctm[1]) +
				  fabs (width * ctx->ctm[2]) + fabs (width * ctx->ctm[3])) / 2;
		ctx->line_flag = GP_GC_FLAG_CHANGED;
	}

which by itself is already nonsense. GP_GC_EQ simply determines wheter the
current line width and the new width are identical within epsilon. BUt then we
are setting the new linewidth to a somewhat differnt value.

So if linewidth starts with 1.0, nothin happens as long as we are trying to set
it to 1.0, but after we have changed it to 10.0 then setting it to 1.0 will
really set it to
fabs (ctx->ctm[0]) + fabs (ctx->ctm[1]) + fabs (ctx->ctm[2]) + fabs
(ctx->ctm[3])) / 2
which may not be 1.
Comment 4 Jody Goldberg 2004-08-08 14:24:16 UTC
Created attachment 30332 [details] [review]
compare the transformed values

Thanks andreas.  This should fix that problem.	I've applied this to head.
Comment 5 Jody Goldberg 2004-09-08 22:11:44 UTC
but apparently did not close the bug.