Closed
Bug 926258
Opened 11 years ago
Closed 3 years ago
Compute path lengths with Moz2D
Categories
(Core :: Graphics, defect)
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: mattwoodrow, Assigned: bas.schouten)
References
Details
(Whiteboard: [leave open])
Attachments
(4 files)
35.56 KB,
patch
|
roc
:
review+
mattwoodrow
:
checkin+
|
Details | Diff | Splinter Review |
7.17 KB,
patch
|
bas.schouten
:
review+
mattwoodrow
:
checkin+
|
Details | Diff | Splinter Review |
1.81 KB,
patch
|
bas.schouten
:
review+
|
Details | Diff | Splinter Review |
5.31 KB,
patch
|
jwatt
:
checkin-
|
Details | Diff | Splinter Review |
SVG curently uses gfxFlattened path to compute lengths of paths, and coordinates along the path.
We need a way to implement this with Moz2D.
Reporter | ||
Comment 1•11 years ago
|
||
This merges the gfxPath and gfxFlattenedPath API's.
I don't think we want to have a separate 'flattened path' object before we can do measurements, since D2D at least provides an API for doing directly on any path.
This is going to be a bit slower than what we currently have (a few extra path copies), but we should be able to improve it again as we switch to moz2d. I also doubt it's called enough to matter.
Attachment #816406 -
Flags: review?(roc)
Reporter | ||
Comment 2•11 years ago
|
||
Attachment #816407 -
Flags: review?(bas)
Reporter | ||
Comment 3•11 years ago
|
||
Comment on attachment 816407 [details] [diff] [review]
Part 2: Implement a Moz2D version of gfxPath
Review of attachment 816407 [details] [diff] [review]:
-----------------------------------------------------------------
::: gfx/2d/2D.h
@@ +451,5 @@
> +
> + virtual double ComputeLength() { return 0; }
> +
> + virtual Point ComputePointAtLength(double aLength,
> + Point* aTangent) { return Point(); }
These should become pure virtual of course, once we have actual implementations.
Attachment #816406 -
Flags: review?(roc) → review+
Reporter | ||
Comment 4•11 years ago
|
||
Attachment #816409 -
Flags: review?(bas)
Reporter | ||
Comment 5•11 years ago
|
||
Reporter | ||
Comment 6•11 years ago
|
||
Refactoring (not actually using moz2d for anything): https://tbpl.mozilla.org/?tree=Try&rev=aaadf3b32b9e
Enabled Moz2D path measurement for d2d (some bugs left): https://tbpl.mozilla.org/?tree=Try&rev=2de0895f0884
Reporter | ||
Comment 7•11 years ago
|
||
Bas had ideas for doing path measurements of curved path segments without flattening.
I have some in-progress patches for refactoring the iteration of cairo paths and moving that into PathHelpers.h so that we can do an implementation for Moz2d/cairo.
I'll let him weight in here before continuing on that too much to avoid potentially wasting work.
Assignee | ||
Comment 8•11 years ago
|
||
Comment on attachment 816407 [details] [diff] [review]
Part 2: Implement a Moz2D version of gfxPath
Review of attachment 816407 [details] [diff] [review]:
-----------------------------------------------------------------
::: gfx/2d/2D.h
@@ +450,5 @@
> virtual FillRule GetFillRule() const = 0;
> +
> + virtual double ComputeLength() { return 0; }
> +
> + virtual Point ComputePointAtLength(double aLength,
We probably want this to be 'Float' as that's what we generally use in Moz2D.
::: gfx/thebes/gfxPath.cpp
@@ +113,5 @@
> + // The y value of aOffset is the offset along the normal vector to apply
> + Point normal(-tangent.y, tangent.x);
> + result += normal * aOffset.y;
> +
> + if (aAngle)
nit: { }
Attachment #816407 -
Flags: review?(bas) → review+
Assignee | ||
Comment 9•11 years ago
|
||
Comment on attachment 816409 [details] [diff] [review]
Part 3a: D2D implementation of path measurement
Review of attachment 816409 [details] [diff] [review]:
-----------------------------------------------------------------
::: gfx/2d/PathD2D.h
@@ +87,5 @@
>
> virtual FillRule GetFillRule() const { return mFillRule; }
>
> ID2D1Geometry *GetGeometry() { return mGeometry; }
> +
nit: whitespace
Attachment #816409 -
Flags: review?(bas) → review+
Reporter | ||
Comment 10•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/b37762151fbd
https://hg.mozilla.org/integration/mozilla-inbound/rev/21793156b6ea
Whiteboard: [leave open]
Reporter | ||
Comment 11•11 years ago
|
||
Assigning to Bas since he's looking at the other implementations.
Assignee: nobody → bas
Comment 12•11 years ago
|
||
Reporter | ||
Updated•11 years ago
|
Attachment #816406 -
Flags: checkin+
Reporter | ||
Updated•11 years ago
|
Attachment #816407 -
Flags: checkin+
Comment 14•11 years ago
|
||
Make that bug 930577.
Comment 15•11 years ago
|
||
A suggestion from Andreas on IRC:
gal I would add a helper for that using skia
gal instead of trying to add that to every backend
gal at least as a fallback
jwatt gal: how does skia fit in here - does that mean calling skia API from gecko code, or calling a Moz2D helper that uses skia regardless of platform?
jwatt the Moz2D helper taking a mozilla::Path
gal one way of doing it is adding a Factory::CreateDefaultSoftwareDrawTarget()
gal and then have skia be that
gal and then your helper can go there, get a DT, create a path, and do the math
gal you implement it for the actual skia backend, the rest fall into this path
Reporter | ||
Comment 16•11 years ago
|
||
I don't think the skia path API implements what we need here. SkPathHelpers has a getLength function, but I don't see any ComputePointAtLength equivalent.
I was thinking we'd probably have to do the same sort of thing with a cairo path. Unsupported backends replay their Path object into a cairo path object, and then do the computations using that.
Comment 17•11 years ago
|
||
It would certainly be helpful if the same DT backend can be used to get PathBuilders to create paths for painting, measuring, etc. That way we can cache the one path and reuse it for everything, rather than having to cache more than one path, or regularly recreate paths.
What's the current status of the various backends in regards to this bug? Which support what we need, and which do not?
Assignee | ||
Comment 18•11 years ago
|
||
I will do the required work here on the very short term, sorry I haven't gotten to it yet.
Comment 19•11 years ago
|
||
Using Cairo here seems counter-intuitive. We are trying to kill cairo.
Updated•11 years ago
|
Comment 20•11 years ago
|
||
Comment on attachment 816410 [details] [diff] [review]
Part 4: Start using Moz2D gfxContext's when measuring paths
This has been obsoleted.
Attachment #816410 -
Flags: checkin-
Assignee | ||
Updated•3 years ago
|
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•