soehler / androidsvg

Automatically exported from code.google.com/p/androidsvg
0 stars 0 forks source link

SVGAndroidRenderer.processMaskBitmaps is very slow #45

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Render the attached test.svg using renderToCanvas

What is the expected output? What do you see instead?
For a small file like this, I'd have expected a few ms to render. Instead, it 
took 200ms - 300ms. Using renderToPicture, and rendering the picture it was 
only 15ms.

I profiled it, and processMaskBitmaps was the major bottleneck. Instead of the 
custom processing, I'd guess drawBitmap using a PorterDuffXfermode would work 
here, too. E.g. paint.setXfermode(new PorterDuffXfermode(Mode.DST_IN));

Original issue reported on code.google.com by mar...@greenrobot.de on 17 Aug 2014 at 8:41

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the report.

> I'd guess drawBitmap using a PorterDuffXfermode would work here, too.

Unfortunately not.  The mask's translucency is based on the RGB values of the 
mask, not its alpha channel.  So none of the PorterDuff modes match what we 
need.

I have a faster implementation written in RenderScript in my 1.3 branch 
(filters).  But that branch needs a lot more work before it is releasable.

Original comment by paul.leb...@gmail.com on 18 Aug 2014 at 2:37