Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(879)

Issue 5482051: Modifying SkPath to store all verbs provided by the user, and to give (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 9 months ago by Stephen Chenney
Modified:
12 years, 8 months ago
CC:
skia-review_googlegroups.com
Base URL:
http://skia.googlecode.com/svn/trunk/
Visibility:
Public.

Description

Modifying SkPath to store all verbs provided by the user, and to give correct results for all stroke and fill modes even on the various types of degenerate paths. The goals of this patch include: 1. Have Skia store all of the verbs implied by path construction methods, even if those define degenerate paths. The SVG implementation in WebKit, which is backed by Skia, needs to know about all elements of the path, even degenerate ones, for the correct drawing of markers and line caps. For example, in SVG you should be able to draw a scatter plot by specifying a marker for vertices and then giving a sequence of moveTo commands. Skia will not store the moveTos, requiring a different storage mechanism. 2. Assuming 1, maintain the current Skia behavior. That is, make Skia robust to degenerate paths. 3. Fix an existing bug in Skia where a degenerate moveTo-lineTo pair spits out warnings from rasterization and produces incorrect results in inverse-fill renderings. 4. Adds extensive testing for degenerate paths and path rendering in general. To meet these goals, the patch I am proposing will result in minor additional storage for degenerate paths (a few bytes per degenerate path, only if the user defines such paths). There is also some additional overhead in the iteration code, with the path now cleaned to remove degenerate segments as part of the iteration process. I suspect this will also fix issues with computing normal vectors to degenerate segments. Benchmarking suggests that this change may result in slightly (< 1%) slower path drawing due to the checks for degeneracy. This overhead could be removed (in fact, a significant speedup could occur) if the results of iterating to clean up the path were cached. This would cost memory, of course, and quite a bit of it. BUG=398 TEST=tests/PathTest.cpp gm/cubicpaths.cpp gm/degeneratesegments.cpp gm/movepaths.cpp gm/linepaths.cpp gm/quadpaths.cpp Committed: http://code.google.com/p/skia/source/detail?r=2901

Patch Set 1 #

Total comments: 14

Patch Set 2 : Modifying SkPath to store all verbs provided by the user, and to give #

Total comments: 6

Patch Set 3 : '' #

Total comments: 3

Patch Set 4 : '' #

Total comments: 25

Patch Set 5 : '' #

Total comments: 3

Patch Set 6 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1448 lines, -47 lines) Patch
A gm/cubicpaths.cpp View 1 2 3 1 chunk +189 lines, -0 lines 0 comments Download
A gm/degeneratesegments.cpp View 1 2 3 4 1 chunk +398 lines, -0 lines 0 comments Download
A gm/linepaths.cpp View 1 2 3 1 chunk +181 lines, -0 lines 0 comments Download
A gm/movepaths.cpp View 1 2 3 1 chunk +180 lines, -0 lines 0 comments Download
A gm/quadpaths.cpp View 1 2 3 1 chunk +185 lines, -0 lines 0 comments Download
M gyp/gmslides.gypi View 1 2 3 4 2 chunks +5 lines, -0 lines 0 comments Download
M include/core/SkPath.h View 1 2 3 4 2 chunks +31 lines, -1 line 0 comments Download
M include/core/SkPoint.h View 1 2 3 4 5 1 chunk +7 lines, -0 lines 0 comments Download
M src/core/SkPath.cpp View 1 2 3 4 5 11 chunks +121 lines, -34 lines 0 comments Download
M src/core/SkStroke.cpp View 1 2 3 4 4 chunks +6 lines, -12 lines 0 comments Download
M tests/PathTest.cpp View 1 2 3 4 5 chunks +145 lines, -0 lines 0 comments Download

Messages

Total messages: 30
TomH
Looks pretty good; leaving the review with reed@ for semantics. I expect we'll take a ...
12 years, 9 months ago (2011-12-12 22:45:21 UTC) #1
reed1
Can we see an updated test before reviewing this. http://codereview.appspot.com/5477054/ Also, can you document here ...
12 years, 9 months ago (2011-12-13 13:34:15 UTC) #2
TomH
http://codereview.appspot.com/5482051/diff/1/src/core/SkStroke.cpp File src/core/SkStroke.cpp (left): http://codereview.appspot.com/5482051/diff/1/src/core/SkStroke.cpp#oldcode620 src/core/SkStroke.cpp:620: // need a real shift methid on path. antialias ...
12 years, 9 months ago (2011-12-13 13:39:07 UTC) #3
caryclark1
http://codereview.appspot.com/5482051/diff/1/src/core/SkPath.cpp File src/core/SkPath.cpp (right): http://codereview.appspot.com/5482051/diff/1/src/core/SkPath.cpp#newcode136 src/core/SkPath.cpp:136: fSegmentMask = src.fSegmentMask; more formatting changes, while important, not ...
12 years, 9 months ago (2011-12-13 13:56:19 UTC) #4
Stephen Chenney
I'll get another patch up incorporating the changes necessary. I'll add some testing in the ...
12 years, 9 months ago (2011-12-13 14:57:39 UTC) #5
Stephen Chenney
To address Mike's question about goals of this patch: 1. Have Skia store all of ...
12 years, 9 months ago (2011-12-13 15:22:27 UTC) #6
reed1
That explanation helps, thanks. What is the drawing result of keeping all of the moveTos? ...
12 years, 9 months ago (2011-12-13 15:53:52 UTC) #7
Stephen Chenney
On 2011/12/13 15:53:52, reed1 wrote: > That explanation helps, thanks. > > What is the ...
12 years, 9 months ago (2011-12-13 16:34:07 UTC) #8
reed1
from an email thread, I think my answer is: No change is planned for skia, ...
12 years, 9 months ago (2011-12-13 18:32:30 UTC) #9
reed1
I think we can easily cache the degenerate state (i.e. nothing to fill or stroke) ...
12 years, 9 months ago (2011-12-13 18:34:20 UTC) #10
Stephen Chenney
I think I'm done, although I have found another bug (415) in the process. I ...
12 years, 9 months ago (2011-12-14 20:26:16 UTC) #11
reed1
I don't think all the changes around convexity are warranted. We actually anticpate that we ...
12 years, 8 months ago (2011-12-15 14:14:06 UTC) #12
Stephen Chenney
This patch passes all the tests I could throw at it, and addresses previous comments. ...
12 years, 8 months ago (2011-12-16 17:06:46 UTC) #13
reed1
Thanks for the cleanup around convexity and flags: much easier to read. http://codereview.appspot.com/5482051/diff/9002/include/core/SkPath.h File include/core/SkPath.h ...
12 years, 8 months ago (2011-12-16 17:23:55 UTC) #14
reed1
BTW -- I know this is a long CL review cycle, but consider it your ...
12 years, 8 months ago (2011-12-16 17:25:03 UTC) #15
Stephen White
http://codereview.appspot.com/5482051/diff/9002/include/core/SkPoint.h File include/core/SkPoint.h (right): http://codereview.appspot.com/5482051/diff/9002/include/core/SkPoint.h#newcode320 include/core/SkPoint.h:320: bool equalsWithinTolerance(const SkPoint& v, const SkScalar tol) const { ...
12 years, 8 months ago (2011-12-16 19:24:36 UTC) #16
Stephen Chenney
One more test to come, with any bug fixes that come out of it. http://codereview.appspot.com/5482051/diff/9002/include/core/SkPath.h ...
12 years, 8 months ago (2011-12-16 19:32:28 UTC) #17
reed1
http://codereview.appspot.com/5482051/diff/9002/src/core/SkCanvas.cpp File src/core/SkCanvas.cpp (left): http://codereview.appspot.com/5482051/diff/9002/src/core/SkCanvas.cpp#oldcode1309 src/core/SkCanvas.cpp:1309: if (path.isEmpty()) { What warning messages? Slower the first ...
12 years, 8 months ago (2011-12-16 19:37:02 UTC) #18
Stephen Chenney
http://codereview.appspot.com/5482051/diff/9002/src/core/SkCanvas.cpp File src/core/SkCanvas.cpp (left): http://codereview.appspot.com/5482051/diff/9002/src/core/SkCanvas.cpp#oldcode1309 src/core/SkCanvas.cpp:1309: if (path.isEmpty()) { On 2011/12/16 19:37:02, reed1 wrote: > ...
12 years, 8 months ago (2011-12-16 19:57:53 UTC) #19
Stephen Chenney
On 2011/12/16 19:57:53, Stephen Chenney wrote: > http://codereview.appspot.com/5482051/diff/9002/src/core/SkCanvas.cpp > File src/core/SkCanvas.cpp (left): > > http://codereview.appspot.com/5482051/diff/9002/src/core/SkCanvas.cpp#oldcode1309 ...
12 years, 8 months ago (2011-12-16 20:00:55 UTC) #20
reed1
Sounds like two different things. 1. warning from SkGpuDevice. 2. we don't draw inverse correctly ...
12 years, 8 months ago (2011-12-16 20:18:02 UTC) #21
Stephen Chenney
On 2011/12/16 20:18:02, reed1 wrote: > Sounds like two different things. > > 1. warning ...
12 years, 8 months ago (2011-12-16 20:25:37 UTC) #22
reed1
rev. 2891 removes the printf. If the inverse-degenerate bug exists outside of this CL, I ...
12 years, 8 months ago (2011-12-16 20:35:32 UTC) #23
Stephen Chenney
I have removed all the isDegenerate code, as it is not required now that the ...
12 years, 8 months ago (2011-12-19 18:20:48 UTC) #24
TomH
Luckily we don't have to perfectly follow the Chromium dictate that no performance loss is ...
12 years, 8 months ago (2011-12-19 18:40:22 UTC) #25
Stephen Chenney
On 2011/12/19 18:40:22, TomH wrote: > Luckily we don't have to perfectly follow the Chromium ...
12 years, 8 months ago (2011-12-19 18:48:27 UTC) #26
reed1
http://codereview.appspot.com/5482051/diff/9004/include/core/SkPoint.h File include/core/SkPoint.h (right): http://codereview.appspot.com/5482051/diff/9004/include/core/SkPoint.h#newcode319 include/core/SkPoint.h:319: */ Skia doesn't use 'const' for p.o.d. parameters, only ...
12 years, 8 months ago (2011-12-19 21:49:13 UTC) #27
reed1
lgtm w/ fixes mentioned in previous post.
12 years, 8 months ago (2011-12-19 22:18:43 UTC) #28
Stephen Chenney
All done. I'll submit in the morning and follow up with instructions on how to ...
12 years, 8 months ago (2011-12-19 23:11:04 UTC) #29
TomH
12 years, 8 months ago (2011-12-28 18:47:46 UTC) #30
This change seems to have broken the SampleApp Fuzzer; see
http://code.google.com/p/skia/issues/detail?id=425. r2900 Fuzzer runs for
several minutes; r2901 Fuzzer fails an assert within a few frames.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b