Closed
Bug 803124
Opened 12 years ago
Closed 12 years ago
Implement isPointInStroke
Categories
(Core :: Graphics: Canvas2D, enhancement)
Core
Graphics: Canvas2D
Tracking
()
RESOLVED
FIXED
mozilla19
Tracking | Status | |
---|---|---|
firefox17 | --- | unaffected |
firefox18 | --- | unaffected |
firefox19 | --- | fixed |
firefox20 | --- | fixed |
People
(Reporter: tschneider, Assigned: tschneider)
References
Details
(Keywords: dev-doc-complete)
Attachments
(2 files, 6 obsolete files)
29.76 KB,
patch
|
jrmuizel
:
review+
|
Details | Diff | Splinter Review |
24.69 KB,
patch
|
jrmuizel
:
review+
bajaj
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
In addition to isPointInPath, the Canvas API should also provide isPointInStroke for hit testing. Right now there is no efficient way to test if a point lies inside the filled AND stroked region of a path. (except of checking for nontransparend pixels using getImageData, which is awful slow if 2D rendering is hw accelerated).
Assignee | ||
Updated•12 years ago
|
Attachment #672798 -
Attachment filename: patch.diff → 803124-mozIsPointInStroke.patch
Attachment #672798 -
Attachment is patch: true
Assignee | ||
Comment 1•12 years ago
|
||
Attachment #672798 -
Attachment is obsolete: true
Assignee | ||
Updated•12 years ago
|
Attachment #672886 -
Attachment description: Implement mozIsPointInStroke → Remove whitespace changes
Assignee | ||
Comment 2•12 years ago
|
||
Attachment #672886 -
Attachment is obsolete: true
Assignee | ||
Comment 3•12 years ago
|
||
Attachment #672894 -
Attachment is obsolete: true
Assignee | ||
Updated•12 years ago
|
Attachment #672886 -
Attachment description: Remove whitespace changes → Patch v2
Assignee | ||
Updated•12 years ago
|
Attachment #672894 -
Attachment description: Add test, change IDL UUID → Patch v3
Assignee | ||
Updated•12 years ago
|
Attachment #672928 -
Attachment description: Fix syntax error → Patch v4
Assignee | ||
Comment 4•12 years ago
|
||
Attachment #672928 -
Attachment is obsolete: true
Assignee | ||
Updated•12 years ago
|
Attachment #672886 -
Attachment filename: 803124-mozIsPointInStroke.diff → 803124-mozIsPointInStroke.patch
Assignee | ||
Updated•12 years ago
|
Attachment #672894 -
Attachment filename: 803124-mozIsPointInStroke.diff → 803124-mozIsPointInStroke.patch
Assignee | ||
Updated•12 years ago
|
Attachment #672928 -
Attachment filename: 803124-mozIsPointInStroke.diff → 803124-mozIsPointInStroke.patch
Assignee | ||
Updated•12 years ago
|
Attachment #673128 -
Attachment filename: 803124-mozIsPointInStroke.diff → 803124-mozIsPointInStroke.patch
Comment 5•12 years ago
|
||
Comment on attachment 673128 [details] [diff] [review]
Patch v5
Review of attachment 673128 [details] [diff] [review]:
-----------------------------------------------------------------
::: content/canvas/test/test_mozIsPointInStroke.html
@@ +33,5 @@
> +
> +ok(ctx.mozIsPointInStroke(20, 20) === false);
> +ok(ctx.mozIsPointInStroke(80, 20) === false);
> +ok(ctx.mozIsPointInStroke(80, 30) === false);
> +ok(ctx.mozIsPointInStroke(20, 30) === false);
This test should include curves and transformed paths/transformed userspace. It might also be worth testing different cap modes.
Assignee | ||
Comment 6•12 years ago
|
||
Attachment #673128 -
Attachment is obsolete: true
Assignee | ||
Updated•12 years ago
|
Attachment #675015 -
Flags: review?(jmuizelaar)
Comment 7•12 years ago
|
||
Comment on attachment 675015 [details] [diff] [review]
Patch v6
Review of attachment 675015 [details] [diff] [review]:
-----------------------------------------------------------------
::: content/canvas/test/test_mozIsPointInStroke.html
@@ +191,5 @@
> +ok(ctx.mozIsPointInStroke(14, 15) === true, 'ctx.mozIsPointInStroke(14, 15) === true');
> +ok(ctx.mozIsPointInStroke(81, 15) === true, 'ctx.mozIsPointInStroke(81, 15) === true');
> +ok(ctx.mozIsPointInStroke(79, 41) === true, 'ctx.mozIsPointInStroke(79, 41) === true');
> +ok(ctx.mozIsPointInStroke(73, 21) === true, 'ctx.mozIsPointInStroke(73, 21) === true');
> +
How about a final test that does a curve scaled by 3x?
Also you should test changing the scale during path construction.
::: gfx/2d/PathSkia.cpp
@@ +184,5 @@
> + int32_t(SkFloatToScalar(transformed.y + 1)));
> +
> + SkRegion pathRegion;
> +
> + return pathRegion.setPath(strokePath, pointRect);
This should use SkPathContainsPoint if possible.
Attachment #675015 -
Flags: review?(jmuizelaar) → review+
Assignee | ||
Comment 8•12 years ago
|
||
(In reply to Jeff Muizelaar [:jrmuizel] from comment #7)
>
> How about a final test that does a curve scaled by 3x?
>
> Also you should test changing the scale during path construction.
Sounds reasonable, will add those tests.
> > + return pathRegion.setPath(strokePath, pointRect);
>
> This should use SkPathContainsPoint if possible.
Don't think SkPathContainsPoint is a standard Skia API, is it? Seems to be an internal helper defined and used in Chromium (http://code.google.com/p/chromium/source/search?q=SkPathContainsPoint&origq=SkPathContainsPoint&btnG=Search+Trunk) and itself uses setPath().
Flags: needinfo?
Comment 9•12 years ago
|
||
(In reply to Tobias Schneider from comment #8)
> (In reply to Jeff Muizelaar [:jrmuizel] from comment #7)
>
> Don't think SkPathContainsPoint is a standard Skia API, is it? Seems to be
> an internal helper defined and used in Chromium
> (http://code.google.com/p/chromium/source/
> search?q=SkPathContainsPoint&origq=SkPathContainsPoint&btnG=Search+Trunk)
> and itself uses setPath().
True. I thought they had fixed this in Skia.
Flags: needinfo?
Comment 10•12 years ago
|
||
(In reply to Jeff Muizelaar [:jrmuizel] from comment #9)
> (In reply to Tobias Schneider from comment #8)
> > (In reply to Jeff Muizelaar [:jrmuizel] from comment #7)
> >
> > Don't think SkPathContainsPoint is a standard Skia API, is it? Seems to be
> > an internal helper defined and used in Chromium
> > (http://code.google.com/p/chromium/source/
> > search?q=SkPathContainsPoint&origq=SkPathContainsPoint&btnG=Search+Trunk)
> > and itself uses setPath().
>
> True. I thought they had fixed this in Skia.
Actually, the function is SkPath::contains(x,y)
Assignee | ||
Comment 11•12 years ago
|
||
Attachment #675015 -
Attachment is obsolete: true
Assignee | ||
Updated•12 years ago
|
Attachment #676169 -
Flags: review?(jmuizelaar)
Updated•12 years ago
|
Attachment #676169 -
Flags: review?(jmuizelaar) → review+
Assignee | ||
Updated•12 years ago
|
Keywords: checkin-needed
Comment 12•12 years ago
|
||
Pushed to Try since I don't see any results posted here.
https://tbpl.mozilla.org/?tree=Try&rev=079dc1ebac54
Comment 13•12 years ago
|
||
Unfortunately, this causes hangs in android armv6 builds.
https://tbpl.mozilla.org/?tree=Try&rev=7f236ae2ee94
Keywords: checkin-needed
Comment 14•12 years ago
|
||
I wonder if it still hangs on armv6 without the test changes. I find it pretty unlikely that this would cause all the mochitests to fail...
Assignee | ||
Comment 15•12 years ago
|
||
Didn't happen in https://tbpl.mozilla.org/?tree=Try&rev=8cab7ad6c0bf.
Assignee | ||
Updated•12 years ago
|
Keywords: checkin-needed
Comment 16•12 years ago
|
||
Flags: in-testsuite+
Keywords: checkin-needed
Comment 17•12 years ago
|
||
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
Comment 18•12 years ago
|
||
Was this ever even suggested on a standards list?
Comment 19•12 years ago
|
||
(In reply to :Ms2ger from comment #18)
> Was this ever even suggested on a standards list?
I don't believe it was. Would you be willing to do so?
Comment 20•12 years ago
|
||
I have no idea what this API is good for; it's probably better to let someone who does suggest it.
Comment 21•12 years ago
|
||
Comment 22•12 years ago
|
||
There's no need for this to be prefixed, by the way. It'll either be added, in which case I'll ensure it's compatible and so it won't conflict, or it won't, in which case nothing with this name will be added and it still won't conflict.
The idea seems pretty sound, the main thing that would stop me from adding it to the spec right now is lack of interest from other vendors. I'll ask around, but if you can convince another vendor to indicate an interest that would certainly help.
Comment 23•12 years ago
|
||
Can this be unprefixed, please? As Hixie says, the prefix is useless and unprefixing later will cause breakage later.
Assignee | ||
Comment 24•12 years ago
|
||
Attachment #684393 -
Flags: review?(jmuizelaar)
Updated•12 years ago
|
Attachment #684393 -
Flags: review?(jmuizelaar) → review+
Assignee | ||
Updated•12 years ago
|
Keywords: checkin-needed
Comment 25•12 years ago
|
||
Keywords: checkin-needed
Updated•12 years ago
|
Keywords: dev-doc-needed
Comment 26•12 years ago
|
||
Updated•12 years ago
|
Assignee: nobody → schneider
Comment 27•12 years ago
|
||
Comment on attachment 684393 [details] [diff] [review]
Patch to remove prefix
[Approval Request Comment]
Bug caused by (feature/regressing bug #): N/A
User impact if declined: proliferating more -moz prefixes
Testing completed (on m-c, etc.): on m-c
Risk to taking this patch (and alternatives if risky): maybe low, simple renaming
String or UUID changes made by this patch: none
Attachment #684393 -
Flags: approval-mozilla-aurora?
Updated•12 years ago
|
status-firefox17:
--- → unaffected
status-firefox18:
--- → unaffected
status-firefox19:
--- → affected
status-firefox20:
--- → fixed
Comment 28•12 years ago
|
||
Comment on attachment 684393 [details] [diff] [review]
Patch to remove prefix
Approving based on the m-c testing.
Attachment #684393 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Comment 29•12 years ago
|
||
Updated•12 years ago
|
Summary: Implement mozIsPointInStroke → Implement isPointInStroke
Comment 30•12 years ago
|
||
Documented:
https://developer.mozilla.org/en-US/docs/DOM/CanvasRenderingContext2D#isPointInStroke%28%29
https://developer.mozilla.org/en-US/docs/Firefox_19_for_developers#DOM
Keywords: dev-doc-needed → dev-doc-complete
You need to log in
before you can comment on or make changes to this bug.
Description
•