I have closed Path-s, which consist of many Bezier segments. These Bezier segments have integer coordinates up to 5000,5000. I need to compute if a point is inside one of these closed Paths. I use this code:
// p is a Path, bounds is a RectF
p.computeBounds(bounds, true);
Region region = new android.graphics.Region();
region.setPath(path, new android.graphics.Region((int)bounds.left, (int)bounds.top, (int)bounds.right, (int)bounds.bottom));
I do that once per Path and then do
region.contains(x, y);
Problem is, that the computeBounds crashes the app for my big Paths. There is no force close, it just receives SIGSEGV and returns to home screen, with no message. I tried to downscale the coordinates to smaller number (divided by 1000), but it did not help, program still crashes.
Is there any other way to compute if a point is inside a complex Path, which will not crash?
EDIT Is there a way to compute this with RenderScript? I cannot find any RenderScript examples with paths/Bezier curves...
EDIT 2 This happens in Nexus 7 with 4.1.1 and also 4.1.2 and also in ICS x86 tablet emulator