Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Low Performance of Canvas in IE 8(Drawing about 7000 lines extremely slow)
Low Performance of Canvas in IE 8 [message #658251] Mon, 07 March 2011 10:20 Go to next message
Eclipse UserFriend
Hi!

When I'm trying to draw a chart and connect the different points each other with a single line by gc.drawline i get very slow drawing in IE 8 whereas firefox or chrome draw very fast.

The Problem is, that also with only drawing 500 lines performance is inacceptible slow.

I did a simple test with scaling a widget window up and down and i turns out that infirefox i was with just no delay whereas in IE 8 the delay was to long. (Nearly half a second depending on the drawn lines.)

Examplecode:
public class IEDelay extends ApplicationWindow {

	public IEDelay() {
		super(null);

	}

	@Override
	protected Control createContents(Composite parent) {
		Shell shell = getShell();
		shell.setLayout(new FillLayout());

		DrawChart c = new DrawChart(shell);

		return parent;

	}

	@Override
	protected boolean showTopSeperator() {
		return false;
	}

	public class DrawChart extends Canvas{

		/**
		 * @param parent
		 */
		public DrawChart(Composite parent) {
			super(parent, SWT.DOUBLE_BUFFERED);

			addPaintListener(new PaintListener() {
				@Override
				public void paintControl(PaintEvent e) {
					DrawChart.this.paintControl(e);
				}
			});

		}

		/**
		 * @param e
		 */
		protected void paintControl(PaintEvent e) {
			GC gc = e.gc;
			int halfy = gc.getClipping().height / 2;
			for(int i = 0; i < gc.getClipping().width; i++){
				gc.drawLine(i, halfy, i+1, halfy);
			}

		}



	}

}


Any ideas how to improve performance in IE 8 are welcome.

Thanks.
Stefan
Re: Low Performance of Canvas in IE 8 [message #658490 is a reply to message #658251] Tue, 08 March 2011 12:23 Go to previous messageGo to next message
Eclipse UserFriend
Hi.

> When I'm trying to draw a chart and connect the different points each
> other with a single line by gc.drawline i get very slow drawing in IE 8
> whereas firefox or chrome draw very fast.

> Any ideas how to improve performance in IE 8 are welcome.

Since this gets asked a lot i created a FAQ entry:
http://wiki.eclipse.org/RAP/FAQ#How_can_i_speed-up_drawing_o n_the_GC.3F

Greetings,
Tim
Re: Low Performance of Canvas in IE 8 [message #658595 is a reply to message #658251] Wed, 09 March 2011 03:37 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for your information.
Any ideas of an javascript drawing library which is able to draw 7000 lines in acceptable time to integrate in a custom widget?

Kind regards
Stefan
Re: Low Performance of Canvas in IE 8 [message #658627 is a reply to message #658595] Wed, 09 March 2011 05:20 Go to previous messageGo to next message
Eclipse UserFriend
Am 09.03.2011 09:37, schrieb Stefan:
> Thanks for your information.
> Any ideas of an javascript drawing library which is able to draw 7000
> lines in acceptable time to integrate in a custom widget?
>

I'm pretty sure there is no such thing, at least not without a plugin
AND working in IE. IEs only native ability to draw is a relative old
techology called VML which is just really slow. If you are okay with
using java or flash or silverlight there are probably some alternatives,
but i don't know any specific ones.

Greetings,
Tim
Re: Low Performance of Canvas in IE 8 [message #658631 is a reply to message #658251] Wed, 09 March 2011 05:49 Go to previous message
Eclipse UserFriend
Hi Tim!

Confused

Thanks for your info! Helped me very much. Will have a look at the other possibilities.

Greets
Stefan
Previous Topic:Indigo (3.7M5) + RAP - batik & w3c missing
Next Topic:Inherit CSS style - Shell and Composite
Goto Forum:
  


Current Time: Fri Jul 04 22:52:45 EDT 2025

Powered by FUDForum. Page generated in 0.03531 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top