Bug 4616 - GC.drawLine() is really slow (1GAVSGP)
Summary: GC.drawLine() is really slow (1GAVSGP)
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P4 normal (vote)
Target Milestone: ---   Edit
Assignee: Silenio Quarti CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-11 14:19 EDT by Carolyn MacLeod CLA
Modified: 2004-10-20 15:16 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carolyn MacLeod CLA 2001-10-11 14:19:59 EDT
CONSIDER 0-thickness fastlines.

NOTES:

	CM (3/20/01 5:56:13 AM)
		P2/F1 (May 1st, 2001)

	McQ (27/03/2001 8:57:26 AM) -
		X windows supports the notion of "zero width" lines, which are actually width 1,
		but are drawn with the fastest possible line drawing algorithm. The comment
		was that perhaps we could do something like this. 

		Having looked at the code though, I think we would be better off trying to do
		the "dirty bits" caching idea, so we didn't have to do a "OS.GetTextColor (handle)"
		for each line we draw. This needs to be discussed however.

	SSQ (3/27/01 7:04:35 PM) -
		Line drawing on Windows has been improved about 8 times by using LOGPEN
		instead of EXTLOGPEN. Still need to see if Motif line drawing can be improved.

	McQ (26/06/2001 11:21:50 AM) -
		The above attempt did not work.
Comment 1 Randy Hudson CLA 2001-12-11 15:02:49 EST
I have no idea what the difference between a LOGPEN and a EXTLOGPEN are.  But, 
in general SWT <code>new</code>s Java Objects within methods such as 
GC.setForeground(Color).  Actually newing objects can be slower than the native 
call itself.

A lot of speedup can be achieved in SWT by doing one of the following:
A) pushing everything into the native implementation, which goes AGAINST the 
SWT philosophy.  In this aproach there would be no LOGPEN java class.
B) Reusing java instances somehow.  For example, re-using the LOGPEN java 
object for subsequent OS resources.  Maybe this doesn't apply to every case by 
I know the TextConverter can be spead-up substaintially.
C) Lazy application of settings.  For example, I may call setForeground(Color) 
twice before actually invoking a method that depends on the foreground color.  
Only the final operation causes a LOGPEN to be created.  However, we are 
already doing this in draw2d so we wouldn't see any benefit.
Comment 2 Silenio Quarti CLA 2004-10-20 15:16:34 EDT
Closing. There is nothing else to be done here.