You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Jorge Cardoso <jc...@inescporto.pt> on 2003/08/21 12:54:58 UTC

Mouse over canvas fires up CPU

Hi,

I'm noticing a strange effect (at least to me it's strange) when displaying 
an SVG:

I use a JSVGCanvas to display an SVG document. The document shows up ok but 
when I pass the mouse over the canvas the cpu usage goes to 100% and it 
stays there for a couple of seconds (well, if the SVG is large enough, it 
stays there for a couple of minutes). This happens after the image is 
displayed on the canvas.

This happens even if I don't set any listeners on the canvas. I've also 
tried to set the ALWAYS_STATIC flag...

I'm using Batik 1.5.

Has anyone experienced anything similar? I've searched the archives but 
couldn't find an answer for this...

Thanks in advance,
jc


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Re: Mouse over canvas fires up CPU

Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Jorge,

    This is to let you know that this effect should be gone.
The hit was to calculate the 'sensitive' regions for every
shape, which for complex shapes (many segments) can get
extremely time consuming.  If you check out current CVS it
should behave better.

Thomas DeWeese wrote:

> Jorge Cardoso wrote:
> 
>> Hi,
>>
>> I'm noticing a strange effect (at least to me it's strange) when 
>> displaying an SVG:
>>
>> I use a JSVGCanvas to display an SVG document. The document shows up 
>> ok but when I pass the mouse over the canvas the cpu usage goes to 
>> 100% and it stays there for a couple of seconds (well, if the SVG is 
>> large enough, it stays there for a couple of minutes). This happens 
>> after the image is displayed on the canvas.
>>
>> This happens even if I don't set any listeners on the canvas. I've 
>> also tried to set the ALWAYS_STATIC flag...
>>
>> I'm using Batik 1.5.
>>
>> Has anyone experienced anything similar? I've searched the archives 
>> but couldn't find an answer for this...
> 
> 
>   This is because events are still enabled at some level (so for example
> to do text selection) - SVG requires walking the rendering tree in 
> reverse order
> to discover who recieves each event which can get expensive.  If you 
> really don't
> want this you can construct the JSVGCanvas with events disabled:
> 
> JSVGCanvas c = new JSVGCanvas(null /*userAgent*/,
>                               false /* eventsEnabled */,
>                               false /* selectableText */);
> 
>   Right now this can only be done at construction time...
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 
> 
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Re: Mouse over canvas fires up CPU

Posted by Thomas DeWeese <Th...@Kodak.com>.
Jorge Cardoso wrote:
> Hi,
> 
> I'm noticing a strange effect (at least to me it's strange) when 
> displaying an SVG:
> 
> I use a JSVGCanvas to display an SVG document. The document shows up ok 
> but when I pass the mouse over the canvas the cpu usage goes to 100% and 
> it stays there for a couple of seconds (well, if the SVG is large 
> enough, it stays there for a couple of minutes). This happens after the 
> image is displayed on the canvas.
> 
> This happens even if I don't set any listeners on the canvas. I've also 
> tried to set the ALWAYS_STATIC flag...
> 
> I'm using Batik 1.5.
> 
> Has anyone experienced anything similar? I've searched the archives but 
> couldn't find an answer for this...

   This is because events are still enabled at some level (so for example
to do text selection) - SVG requires walking the rendering tree in reverse order
to discover who recieves each event which can get expensive.  If you really don't
want this you can construct the JSVGCanvas with events disabled:

JSVGCanvas c = new JSVGCanvas(null /*userAgent*/,
                               false /* eventsEnabled */,
                               false /* selectableText */);

   Right now this can only be done at construction time...




---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org