Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 15:20 Go to next message
Stefan Klaus is currently offline Stefan Klaus
Messages: 20
Registered: February 2011
Junior Member
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 17:23 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim Buschtoens
Messages: 383
Registered: July 2009
Senior Member
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 08:37 Go to previous messageGo to next message
Stefan Klaus is currently offline Stefan Klaus
Messages: 20
Registered: February 2011
Junior Member
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 10:20 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim Buschtoens
Messages: 383
Registered: July 2009
Senior Member
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 10:49 Go to previous message
Stefan Klaus is currently offline Stefan Klaus
Messages: 20
Registered: February 2011
Junior Member
Hi Tim!

Confused

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

Greets
Stefan
Previous Topic:Inherit CSS style - Shell and Composite
Next Topic:rap calendar
Goto Forum:
  


Current Time: Wed Oct 01 08:17:10 GMT 2014

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

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