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 162790 - Implementation of GDK_LINE_DOUBLE_DASH on Win32
Implementation of GDK_LINE_DOUBLE_DASH on Win32
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Win32
unspecified
Other Windows
: Normal normal
: Small fix
Assigned To: gtk-win32 maintainers
gtk-bugs
Depends on:
Blocks: 162555 337545
 
 
Reported: 2005-01-03 09:43 UTC by Ivan Wong
Modified: 2009-02-10 02:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed patch (16.05 KB, patch)
2005-01-04 12:24 UTC, Ivan Wong
none Details | Review
revised (16.34 KB, patch)
2005-01-11 17:56 UTC, Ivan Wong
committed Details | Review
A diagram window with broken grid. (13.96 KB, image/png)
2005-03-05 10:01 UTC, Hans Breuer
  Details

Description Ivan Wong 2005-01-03 09:43:27 UTC
The problem is described in bug 162555, to be short:

"GDK_LINE_DOUBLE_DASH is not complete on Win32. Both GDK_LINE_ON_OFF_DASH and
GDK_LINE_DOUBLE_DASH are simulated by the Win32 pen style PS_DASH which means
that odd segments are not drawn."

Attachment 35360 [details] is the prposed patch which simulates LineDoubleDash (instead of
using PS_DASH) and dash_offset of XSetDashes also.
Comment 1 Ivan Wong 2005-01-04 12:24:43 UTC
Created attachment 35422 [details] [review]
proposed patch

Replaces attachment 35360 [details] [review]
Comment 2 Tor Lillqvist 2005-01-09 20:16:08 UTC
You wouldn't happen to have some minimal test program that draws various dashed
lines?
Comment 3 Tor Lillqvist 2005-01-09 20:38:16 UTC
Would the following ChangeLog entry be a correct summary:

2005-01-09  Tor Lillqvist  <tlillqvist@novell.com>

	Fix for #162790, by Iwan Wong:
	
	* gdk/win32/gdkdrawable-win32.c: Implement dashed lines
	correctly. Simplify the interface to render_line_horizontal() and
	render_line_vertical(). Need to draw lines "manually" also on
	NT-based Windowses if we have a dash offset or are drawing
	double-dashed lines.

	* gdk/win32/gdkprivate-win32.h: Keep also the dash offset,
	double-dash flag, and a brush for the background colour (used by
	the odd dashes in the double-dash line style) in the GdkGCWin32
	struct.

	* gdk/win32/gdkgc-win32.c: Set up above new fields.

Comment 4 Tor Lillqvist 2005-01-09 20:42:49 UTC
BTW, how common are dashed oblique lines? Seen such in any GTK+ app? Would it be
worth it to draw them "manually" also (instead of just calling LineTo())? My
guess would be no...
Comment 5 Ivan Wong 2005-01-10 06:49:49 UTC
> BTW, how common are dashed oblique lines? Seen such in any GTK+ app?
Please check Bug 162555.

> Would it be worth it to draw them "manually" also
> (instead of just calling LineTo())? 
I agree that the double dash line is not a common one. But we need to implement 
that for compatibility. While one claims that Gtk+ is cross platform, we need 
to keep the promise for every detail without obvious trade-off. 
GDK_LINE_SOLID/GDK_LINE_ON_OFF_DASH are most of the cases, and they are done by 
the native PS_DASH style. I can see no reason why we can't have a simulation of 
GDK_LINE_DOUBLE_DASH without affecting the performance/complexity of 
GDK_LINE_SOLID/GDK_LINE_ON_OFF_DASH. We ought not to forget a public feature of 
a cross platform toolkit forever just because it's not implemented natively or 
it's rare.
Comment 6 Tor Lillqvist 2005-01-10 08:46:03 UTC
> > BTW, how common are dashed oblique lines? Seen such in any GTK+ app?
> Please check Bug 162555.

Please look up "oblique" in a dictionary ;-) 

Obviously, yes, horizontal and vertical dashed and double-dashed lines should be
fixed, and thank you very much for working on this! But should something also be
done for such lines that are neither horizontal or vertical?
Comment 7 Ivan Wong 2005-01-10 09:18:38 UTC
> Please look up "oblique" in a dictionary ;-) 
Ah, I am really sorry about that. I missed the most critical word of your sentence.

> But should something also be done for such lines that
> are neither horizontal or vertical?
IMHO, I think it would be great if it's done. However, as it needs a certain
amount of effort to implement, just leave it until someone has time.
Comment 8 Ivan Wong 2005-01-11 17:56:28 UTC
Created attachment 35839 [details] [review]
revised

Should reset pen_double_dash when setting line style to solid line.

ChangLog entry in #3 looks sane. I will try to submit a dash lines drawing demo
later.
Comment 9 Tor Lillqvist 2005-01-12 21:29:03 UTC
OK, patch committed (to HEAD). Thanks! 
Comment 10 Tor Lillqvist 2005-01-23 01:23:49 UTC
Patch applied to gtk-2-6, too.
Comment 11 Hans Breuer 2005-03-05 09:42:49 UTC
There seems to be soemething wrong with this patch (or with
my understanding of 'dash_offset'). Simply adding the 
line patterns start offset to the start point f the line
has the ability of very ugly effects, e.g. when drawing 
grids. See following attachment.
Comment 12 Hans Breuer 2005-03-05 10:01:05 UTC
Created attachment 38288 [details]
A diagram window with broken grid.

The dashoffset Dia uses is kind of strange (and may be wrong in 
itself: x+y and as visible it draws the grid from top left to
buttom right. Very disturbing the missing parts by letting GDK 
start at x,y plus the offset. [The goal of the dash_offset 
usage is to keep the line pattern in place even with different
start points, drawing only a part of the image.]
I think the function to use for it is SetBrushOrgEx and there
needs to be some (dash_offset modulo dash_len).
Comment 13 Hans Breuer 2005-04-03 21:11:20 UTC
This is now fixed - see bug #171641 - for the non double dash case.
Not fixed for double dashing cause I do neither know a program using 
them not how they are supposed to look.
Comment 14 Tor Lillqvist 2005-10-01 00:04:43 UTC
I hope dashed lines are by now implemented as well as they will ever be in the
Win32 backend ;-) See also bug #306396 and bug #308413. Resolving as fixed.