dikalo / lienzo-core

Lienzo Structure Graphics GWT Toolkit
Apache License 2.0
51 stars 58 forks source link

Showing Picture using IE 9-10 does not work #66

Open mani76 opened 9 years ago

mani76 commented 9 years ago

Hello,

I am not able to show jpg image in LienzoPanel when using IE 9 or 10. When adding following CanvasPanel to the RootLayout it should show test.jpg, but with IE it shows error message in the console: SCRIPT5022: IndexSizeError

It works ok with Safari and Chrome.


public class CanvasPanel extends LienzoPanel {

    private Layer layer;

    public CanvasPanel() {
        super(500, 500);
        layer = new Layer();

        add(layer);
        String url = "test.jpg";
        Picture picture = new Picture(url, false).onLoaded(new PictureLoadedHandler() {
            @Override
            public void onPictureLoaded(Picture picture) {
                layer.draw();
            }
        });

        layer.add(picture);
    }
}
SprocketNYC commented 9 years ago

Which version of Lienzo?

Dev mode or compiled mode?

I'll need to look for an IE9/10 machine, I don't have access to one at the moment.

mani76 commented 9 years ago

Latest development version using super dev mode and also deployed application

SprocketNYC commented 9 years ago

ugh, can not reproduce error. I don't have ANY dev box with IE9/10, IE11 is working fine. ANY more info would help, console error logs, SDM console log, Old dev mode stack, ANYTHING. Also exact GWT version, Lienzo version, etc.... how big is test.jpg? can you try layer.add(picture) in the handler?

Need some help.

mani76 commented 9 years ago

Hello,

It seems to be that minimum code line needed is to just create a new Picture:

Picture p = new Picture(url, false);

if url points to the correct image url exception is thrown, if image is not found constructor works ok.

GWT version is 2.7

Here is DEV mode trace:

17:17:30.403 [ERROR] [lienzotester] Uncaught exception escaped

com.google.gwt.event.shared.UmbrellaException: Exception caught: (IndexSizeError) @com.ait.lienzo.client.core.NativeContext2D::drawImage(Lcom/google/gwt/dom/client/Element;DDDDDDDD)([JavaScript object(107), double: 0.0, double: 0.0, double: 0.0, double: 0.0, double: 0.0, double: 0.0, double: 0.0, double: 0.0]): IndexSizeError at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:129) at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:129) at com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:125) at com.google.gwt.user.client.ui.Widget.onBrowserEvent(Widget.java:177) at com.google.gwt.user.client.ui.Image.onBrowserEvent(Image.java:816) at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1480) at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1419) at com.google.gwt.user.client.impl.DOMImplStandard.dispatchEvent(DOMImplStandard.java:317) at com.google.gwt.user.client.impl.DOMImplStandard.dispatchUnhandledEvent(DOMImplStandard.java:337) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:72) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:341) at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:222) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:137) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:589) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:293) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91) at com.google.gwt.core.client.impl.Impl.apply(Impl.java) at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:299) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:72) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:296) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:551) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:368) at java.lang.Thread.run(Thread.java:744) Caused by: com.google.gwt.core.client.JavaScriptException: (IndexSizeError) @com.ait.lienzo.client.core.NativeContext2D::drawImage(Lcom/google/gwt/dom/client/Element;DDDDDDDD)([JavaScript object(107), double: 0.0, double: 0.0, double: 0.0, double: 0.0, double: 0.0, double: 0.0, double: 0.0, double: 0.0]): IndexSizeError at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:252) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:137) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:589) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:315) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107) at com.ait.lienzo.client.core.NativeContext2D$.drawImage$(NativeContext2D.java) at com.ait.lienzo.client.core.Context2D.drawImage(Context2D.java:382) at com.ait.lienzo.client.core.image.ImageProxy.doInitialize(ImageProxy.java:388) at com.ait.lienzo.client.core.image.ImageProxy.access$8(ImageProxy.java:350) at com.ait.lienzo.client.core.image.ImageProxy$1.onLoad(ImageProxy.java:307) at com.ait.lienzo.client.core.image.ImageLoader$1.onLoad(ImageLoader.java:61) at com.google.gwt.event.dom.client.LoadEvent.dispatch(LoadEvent.java:56) at com.google.gwt.event.dom.client.LoadEvent.dispatch(LoadEvent.java:1) at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1) at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40) at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193) at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88) at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127) at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:129) at com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:125) at com.google.gwt.user.client.ui.Widget.onBrowserEvent(Widget.java:177) at com.google.gwt.user.client.ui.Image.onBrowserEvent(Image.java:816) at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1480) at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1419) at com.google.gwt.user.client.impl.DOMImplStandard.dispatchEvent(DOMImplStandard.java:317) at com.google.gwt.user.client.impl.DOMImplStandard.dispatchUnhandledEvent(DOMImplStandard.java:337) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:72) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:341) at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:222) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:137) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:589) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:293) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91) at com.google.gwt.core.client.impl.Impl.apply(Impl.java) at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:299) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:72) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:296) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:551) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:368) at java.lang.Thread.run(Thread.java:744)

jmgabriel commented 9 years ago

I confirm the bug on my side also (GWT 2.6.1)

SprocketNYC commented 9 years ago

Ahh, from the exception I see the image size is 0.0 for everything. I'll take a look.

SprocketNYC commented 9 years ago

OK, I rolled IE 11 back to 10 on a VM, can reproduce, which is half the battle...

SprocketNYC commented 9 years ago

Try 2.0.151-RC1

helmutprovost commented 8 years ago

Hi Dean,

After updating to 2.0.231-RC1, the same problem exists on IE9 (WIN7). 0471cb9e-cffa-11e5-84e0-371eaf941fde 04857446-cffa-11e5-8ac5-fafdaa8bbeca

I am unable to view the real stacktrace, but it matches the same stacktrace given by mani76, on Apr 8, 2015

helmutprovost commented 8 years ago

Additional information: This fails on IE9 (WIN7) but works fine on

I use a 256x256 PNG image resource. The source code looks like this: Predefined variables: LienzoPanel lienzoPanel, ImageResource imageResource, int x, int y, int width, int height

Group group = new Group();
Layer layer = new Layer();
lienzoPanel.add(layer);
layer.add(group);
new Picture(imageResource, false).onLoaded(new PictureLoadedHandler() {

    @Override
    public void onPictureLoaded(final Picture picture) {
        picture.setLocation(new Point2D(x, y));
        picture.setClippedImageDestinationHeight(height);
        picture.setClippedImageDestinationWidth(width);
        group.add(img);
        lienzoPanel.draw();
    }
});
SprocketNYC commented 8 years ago

Gimme a bit to try to dig up an old VM image of Windows with IE9. It's a long shot... and will take quite a while to get everything set up. If you want to submit a PR, go ahead, I'll test it, and if it's fine, I'll merge.

Its the open source way :-)

helmutprovost commented 8 years ago

Dean, when I setup such an environment, I go to https://dev.windows.com/en-us/microsoft-edge/tools/vms/linux/ and there I select the Windows Image I want to test in my vm. Maybe this can come in very handy for testing these images.

SprocketNYC commented 8 years ago

Oooooh, THAT IS COOL. Thanks, I'll give it a try tonight.

helmutprovost commented 8 years ago

Read https://www.maketecheasier.com/import-export-ova-files-in-virtualbox/ if you're not used to install this.

SprocketNYC commented 8 years ago

I have both VirtualBox and VMWare Fusion on Mac... one will work.