Low Performance of Canvas in IE 8 [message #658251] |
Mon, 07 March 2011 10:20  |
Eclipse User |
|
|
|
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
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03531 seconds