Hi Thomas,

thomas.deweese wrote:
> 
>    Yes, the best way to do that is to override the 
> 'computeRenderingTransform()'
> method on the JSVGComponent.  Some care should be taken to emulate the
> behavior of the baseclass (in particular the initalTransform should 
> probably
> still be set to the identity transform but I would suggest using your 
> desired
> rendering transform in the initialTransform's place for the rest of the
> function).
> 
>   The whole purpose of the computeRenderingTransform function is to
> establish the inital rendering transform when a document is loaded.
> 

Are you sure that computeRenderingTransform is really the right place? I
checked and it is not called at all during the loading, processing and
showing of my SVG. When I looked into the code I found that it is called
only from the following places (none of them seems to be normal processing):
AbstractJSVGComponent:
  -> BridgeUserAgent.openLink
  -> setFragmentIdentifier
SVGListener:
  -> gvtBuildFailed
  -> svgLoadEventDispatchFailed
Maybe I'm wrong but I can't see how the computeRenderingTransform could
help?

Nevertheless, I came to another fix for my problem. I changed
AbstractJGVTComponent.renderingStopped() in a way that the event dispatching
is not re-enabled if we schedule another rendering so the event handling
will not interfere with the renderer. Could you have a look below to check
you agree to such a fix? If yes would you consider applying it to Batik
sources?

Existing code:

        private void renderingStopped() {
            haltProgressivePaintThread();

            if (doubleBufferedRendering) {
                suspendInteractions = false;
            }

            gvtTreeRenderer = null;
            if (needRender) {
                renderGVTTree();
                needRender = false;
            } else {
                immediateRepaint();
            }
            
            if (eventDispatcher != null) {
                eventDispatcher.setEventDispatchEnabled(true);
            }
        }

changed to:

        private void renderingStopped() {
            haltProgressivePaintThread();

            if (doubleBufferedRendering) {
                suspendInteractions = false;
            }

            gvtTreeRenderer = null;
            if (needRender) {
                renderGVTTree();
                needRender = false;
            } else {
                immediateRepaint();
                // moved here
                //--
                if (eventDispatcher != null) {
                        eventDispatcher.setEventDispatchEnabled(true);
                }
                //--
            }
            
// moved up
//            if (eventDispatcher != null) {
//                eventDispatcher.setEventDispatchEnabled(true);
//            }
        }


Thanks a lot!
Lukasz

-- 
View this message in context: 
http://www.nabble.com/Threading-problem-when-using-JSVGCanvas.setSVGDocument-tp20147098p20185115.html
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to