aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkPath.h
Commit message (Collapse)AuthorAge
* Ignore deserialized path convexity and first direction.Gravatar Brian Salomon2017-11-29
| | | | | | | Change-Id: Ib7bfff6225774b83d9b6e9c5baae254aab17353b Reviewed-on: https://skia-review.googlesource.com/77680 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
* move parts of SkPoint to SkPointPrivGravatar Cary Clark2017-11-08
| | | | | | | | | | | | Move specialized SkPoint methods to SkPointPriv. Use constexpr and inline initialization where possible. R=reed@google.com,bsalomon@google.com Bug: skia: 6898 Change-Id: I01ec5186f010f2dc80c068c70d9cc352f3221338 Reviewed-on: https://skia-review.googlesource.com/68700 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Ravi Mistry <rmistry@google.com>
* generated include refreshGravatar Cary Clark2017-10-30
| | | | | | | | | | | | The latest, minor changes on includes already generated, plus four new ones. TBR=reed@google.com Bug: skia:6898 Change-Id: If06ae9b9aaa3a0a9fae570aa7a6698ff340c43b8 Reviewed-on: https://skia-review.googlesource.com/62862 Commit-Queue: Cary Clark <caryclark@skia.org> Reviewed-by: Cary Clark <caryclark@skia.org>
* make SkPath::fConvexity atomicGravatar Mike Klein2017-09-28
| | | | | | | | | | | | | | | | | The TSAN bots fail regularly with races on fConvexity. Very annoying. We used to have this very same problem with SkPath::fFirstDirection until we made it atomic. This does the same to fConvexity. This makes the field as lightly atomic as possible, with all operations using a relaxed memory order. The value of fConvexity isn't guarding any other non-atomic memory or implying any other writes have happened so I don't think we need anything beyond relaxed here. Change-Id: I0da1f892dc2b7072d692ce8b460fb1862aebef77 Reviewed-on: https://skia-review.googlesource.com/52180 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Serialize rrect/oval paths as rrects rather than points and verbs.Gravatar Brian Salomon2017-09-21
| | | | | | | | | This is a step towards not trusting deserialized isoval/isrrect for general paths without losing the performance advantages of knowing that a path is a rrect/oval. Change-Id: I1a8c0608c0f29f4bf7a118dfa1d475e2ab5802ea Reviewed-on: https://skia-review.googlesource.com/49761 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
* regenerate includesGravatar Cary Clark2017-09-21
| | | | | | | | | | | | | Fresh off the griddle versions of: SkPaint.h, SkCanvas.h, SkPath.h, and SkPixmap.h. TBR=reed@google.com Bug: skia: 9868 Change-Id: If3f0c1cd7973c53482772c2478b12f1070c9fc4d Reviewed-on: https://skia-review.googlesource.com/46587 Commit-Queue: Cary Clark <caryclark@skia.org> Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Cary Clark <caryclark@skia.org>
* make kPathRefGenIDBitCnt privateGravatar Cary Clark2017-09-14
| | | | | | | | | | | | | | | kPathRefGenIDBitCnt is used only by SkPath.cpp and SkPathRef.cpp. Curiously, there's no existing private declarations shared by SkPath and SkPathRef, so I added kPathRefGenIDBitCnt to SkPathPriv.h as the go-between. If there's an existing convention I overlooked, please let me know. R=reed@google.com,djsollen@google.com Bug: skia: 6898 Change-Id: I929d780c3b4a10e5cf78e7176a7516abf912508e Reviewed-on: https://skia-review.googlesource.com/46560 Reviewed-by: Derek Sollenberger <djsollen@google.com> Commit-Queue: Cary Clark <caryclark@skia.org>
* generated SkCanvas.hGravatar Cary Clark2017-09-01
| | | | | | | | | | | | | | | | | | | SkCanvas.h generated from docs/SkCanvas.bmh using bookmaker. Also added corrections to SkPaint.h, and generated SkPath.h. Once these are functionally correct (e.g., they don't break anything) I plan to check them in -- feel free to continue to review them before and after the check in event. R=brianosman@google.com TBR=reed@google.com Bug: skia:6898 Change-Id: I6d01e9eee422304e5ab871b3870a7ed710efd645 Reviewed-on: https://skia-review.googlesource.com/30460 Commit-Queue: Cary Clark <caryclark@skia.org> Reviewed-by: Cary Clark <caryclark@skia.org> Reviewed-by: Yuqian Li <liyuqian@google.com>
* work on pathGravatar Cary Clark2017-08-30
| | | | | | | | | | | | | | | | | Work on SkPath.h documentation; fixed self-consistency bugs identified by bookmaker. Fixed a couple of minor typos in SkPath.h itself. Also brought SkPaint and SkCanvas docs up to date. TBR=reed@google.com Docs-Preview: https://skia.org/?cl=39040 Bug: skia: 6898 Change-Id: Id89d4e2fa7fb6ee2e3cbec7ea762e06308b67d8b Reviewed-on: https://skia-review.googlesource.com/39040 Commit-Queue: Cary Clark <caryclark@skia.org> Reviewed-by: Cary Clark <caryclark@google.com> Reviewed-by: Cary Clark <caryclark@skia.org>
* simplify path validateGravatar Cary Clark2017-08-29
| | | | | | | | | | | | | Reduce path validation interfaces, deferring the harder work of rewriting the callers until later. R=reed@google.com,enne@chromium.org Change-Id: Iea56f1cd1be93bb1d96b50836a9bd3cd4872ad23 Reviewed-on: https://skia-review.googlesource.com/37541 Commit-Queue: Cary Clark <caryclark@google.com> Reviewed-by: Adrienne Walker <enne@chromium.org>
* Convert NULL and 0 to nullptr.Gravatar Ben Wagner2017-08-28
| | | | | | | | | | | | | | This was created by looking at warnings produced by clang's -Wzero-as-null-pointer-constant. This updates most issues in Skia code. However, there are places where GL and Vulkan want pointer values which are explicitly 0, external headers which use NULL directly, and possibly more uses in un-compiled sources (for other platforms). Change-Id: Id22fbac04d5c53497a53d734f0896b4f06fe8345 Reviewed-on: https://skia-review.googlesource.com/39521 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
* Expose SkPath validation as booleanGravatar Adrienne Walker2017-08-10
| | | | | | | | | | | | | | | | As a part of serializing SkPaths, I want to be able to know (without asserting) whether or not a path is valid so that I can discard potentially malicious deserialized paths. Currently, SkPath(Ref) both just have asserting validation functions which can't be used externally. This patch adds accessors that don't assert. Bug: chromium:752755 skia:6955 Change-Id: I4d0ceb31ec660b87e3fda438392ad2b60a27a0da Reviewed-on: https://skia-review.googlesource.com/31720 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Mike Reed <reed@google.com>
* Revert "Revert "Fix SkPathRef deserialization malloc crash""Gravatar Mike Reed2017-07-27
| | | | | | | | | | | | | | | | This reverts commit a4ce4b1f6bef22e7ca5c7a952197fc2bc70923fc. Fix SkPathRef deserialization malloc crash If the path says it has more points/verbs/etc than the buffer could be holding, then resetToSize could try to allocate something huge and crash. Bug: skia: Change-Id: I23b8870e9f74386aca89fb8f9a60d3b452044094 Reviewed-on: https://skia-review.googlesource.com/26805 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Mike Klein <mtklein@chromium.org>
* Correctly stroke zero length segments in multi-contour pathsGravatar Brian Osman2017-07-10
| | | | | | | | Bug: skia: Change-Id: I959287780ef94a258a6746132f3acb9f90e6c6cc Reviewed-on: https://skia-review.googlesource.com/21863 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
* move SkPathRef.h into privateGravatar Mike Reed2017-06-07
| | | | | | | | Bug: skia: Change-Id: I3370c594301ae833ec1fe3cb16ac544e5b2128e8 Reviewed-on: https://skia-review.googlesource.com/18982 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
* remove unneeded class declarationsGravatar Mike Reed2017-06-07
| | | | | | | | Bug: skia: Change-Id: I7ca7f69e444279fe85d8aa66367194768736995f Reviewed-on: https://skia-review.googlesource.com/18964 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
* comment SK_API and add fix paramsGravatar Cary Clark2017-05-18
| | | | | | | | | | | | | | | | | I thought that SK_API on operator== was redundant with SK_API on the enclosing class, and was not needed. Turns out for mac_chromium_debug_ng it is needed. Added comments for history. Meanwhile, bookmaker found some missing and mis-named parameters, so all is not lost. R=reed@google.com Change-Id: I88645666a9d06ec90c5ac133673460d6e6c75528 Reviewed-on: https://skia-review.googlesource.com/17277 Commit-Queue: Cary Clark <caryclark@google.com> Reviewed-by: Mike Reed <reed@google.com>
* Add some thread safety notes.Gravatar Mike Klein2017-03-02
| | | | | | | | | These are the main problems we tend to hit with multithreaded drawing. Change-Id: I63dc56f38a533eb839d36833e865af5fcc700d3b Reviewed-on: https://skia-review.googlesource.com/9100 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Mike Reed <reed@google.com>
* expose new tight-bounds method on SkPathGravatar Mike Reed2017-02-03
| | | | | | | | | BUG=skia: Change-Id: Ie50df49c1758af203042a84dc2cd505046373d2c Reviewed-on: https://skia-review.googlesource.com/7996 Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Mike Reed <reed@google.com>
* SkPath::fIsVolatile does not need to be mutable.Gravatar Mike Klein2016-11-12
| | | | | | | | | GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4696 Change-Id: I48b438ab1d99033ab2a422fb28e976cdf9188365 Reviewed-on: https://skia-review.googlesource.com/4696 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Klein <mtklein@chromium.org>
* use reversePathTo in place of addPathReverseGravatar caryclark2016-11-07
| | | | | | | | | | | | | | Path ops was using addPathReverse, instead of reversePathTo. The former adds a moveTo always, and the latter requires that the caller add the moveTo if needed. Simplify the reversePathTo implementation. R=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2481463002 Committed: https://skia.googlesource.com/skia/+/d8db392be9dd1887df04b10b5670991d6b098c17 Review-Url: https://codereview.chromium.org/2481463002
* Revert of use reversePathTo in place of addPathReverse (patchset #1 id:1 of ↵Gravatar caryclark2016-11-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://codereview.chromium.org/2481463002/ ) Reason for revert: breqking some bots Original issue's description: > use reversePathTo in place of addPathReverse > > Path ops was using addPathReverse, instead of reversePathTo. > The former adds a moveTo always, and the latter requires > that the caller add the moveTo if needed. > > Simplify the reversePathTo implementation. > > R=reed@google.com > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2481463002 > > Committed: https://skia.googlesource.com/skia/+/d8db392be9dd1887df04b10b5670991d6b098c17 TBR=reed@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review-Url: https://codereview.chromium.org/2478763003
* use reversePathTo in place of addPathReverseGravatar caryclark2016-11-04
| | | | | | | | | | | | | Path ops was using addPathReverse, instead of reversePathTo. The former adds a moveTo always, and the latter requires that the caller add the moveTo if needed. Simplify the reversePathTo implementation. R=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2481463002 Review-Url: https://codereview.chromium.org/2481463002
* Remove SkAutoTUnref and SkAutoTDelete from public includes.Gravatar bungeman2016-10-27
| | | | | | | | | | | | | | | This also makes the required changed to src, tests, and tools. The few public APIs modified by this change appear to be unused outside of Skia. Removing these from the public API makes it easier to ensure users are no longer using them. This also updates GrGpu::wrapBackendXXX and the ::onWrapBackendXXX methods to clarify ownership. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2448593002 Review-Url: https://codereview.chromium.org/2448593002
* Avoid warnings on GCC 4.8.4Gravatar jcgregorio2016-07-26
| | | | | | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2183243002 [mtklein adds...] TBR=reed@google.com No public API changes. Review-Url: https://codereview.chromium.org/2183243002
* Make SkPath::isOval() and SkPath::isRRect return the orientation and ↵Gravatar bsalomon2016-05-27
| | | | | | | | | | | starting index. These are tracked in SkPathRef. Unit tests are updated to test that the returned values are correct. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2012233002 Review-Url: https://codereview.chromium.org/2012233002
* allow move/zero-line/close to draw capsGravatar caryclark2016-02-22
| | | | | | | | R=fmalita@chromium.org BUG=skia:4784 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1720953002 Review URL: https://codereview.chromium.org/1720953002
* fix iter to document close correctlyGravatar caryclark2016-02-19
| | | | | | | | R=reed@google.com BUG=skia:4950 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1717623002 Review URL: https://codereview.chromium.org/1717623002
* Move SkTDArray to private.Gravatar bungeman2016-02-18
| | | | | | | TBR=reed Moving to private is good. Review URL: https://codereview.chromium.org/1707213002
* add interp pathGravatar caryclark2016-02-18
| | | | | | | | | | | Add path methods to determine if a pair of paths can be interpolated, and to interpolate them. R=reed@google.com, robertphillips@google.com BUG=skia:4549 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1703943003 Review URL: https://codereview.chromium.org/1703943003
* add last move to serialized pathGravatar caryclark2016-02-17
| | | | | | | | | | | | A deserialized path keeps the last move location so that a subsequent append to the path does not add an unwanted close verb. R=reed@oogle.com BUG=skia:4847 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1702393002 Review URL: https://codereview.chromium.org/1702393002
* Add svg path arctoGravatar caryclark2016-01-23
| | | | | | | | | | | | | The arcto() used by SVG in Chrome and Android is ported here, using conics instead of cubics. The logic is a direct transposition of the WebKit code. The attached GM includes SVG that draws the same as Skia. R=reed@google.com BUG=skia:3959 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1613303002 Review URL: https://codereview.chromium.org/1613303002
* Add SkPath::isLastContourClosed()Gravatar fs2016-01-20
| | | | | | | | | | | | | | Adds a simple method for checking if the last command/verb in the current contour is a 'close'. This will simplify determining "closedness" for blink::Path, and aid in the implementation of algorithms such as: https://drafts.fxtf.org/motion-1/#motion-processing (second item in list) GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1601103006 Review URL: https://codereview.chromium.org/1601103006
* add support for capped hairlinesGravatar caryclark2015-12-09
| | | | | | | | | Extend the ends of hairline and haircurve segments when the paint is set to square or round, and the line or curve is at the start or end of a contour. R=reed@google.com BUG=skia:4599 Review URL: https://codereview.chromium.org/1491843006
* Add an SkPath conic conversion utility.Gravatar fmalita2015-12-01
| | | | | | | | | Expose SkConic::chopIntoQuadsPOW2() as SkPath::ConvertConicToQuads(). BUG=chromium:315277 R=reed@google.com Review URL: https://codereview.chromium.org/1484373002
* add SkPath::isRRectGravatar caryclark2015-11-19
| | | | | | | | | | | Add helper to track when a round rect was added to a path, and then return the SkRRect specification that describes it. Move the implementation for SkPath::RawIter to SkPathRef so it can be used there as well. R=reed@google.com,robertphillips@google.com Review URL: https://codereview.chromium.org/1461763004
* Parametric SkPath oval/rect/rrect starting pointGravatar fmalita2015-11-17
| | | | | | | | | | | Extend the SkPath API to allow specifying the contour starting point. This will allow removing the explicit cubic code from Blink/Path. BUG=chromium:315277 R=reed@google.com,caryclark@google.com Review URL: https://codereview.chromium.org/1452203002
* SkPath::fFirstDirection: seq-cst -> relaxedGravatar mtklein2015-10-07
| | | | | | | | | | | | | | | | | | | We landed this originally with lazily-correct sequentially-consistent memory order. It turns out that's regressed performance, we think particularly when recording paths. We also think there's no need for anything but relaxed memory order here. We should see this chart go down if all goes well: https://perf.skia.org/#4329 There are also Chrome performance charts to watch in the linked bug. BUG=chromium:537700 CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-TSAN-Trybot,Test-Ubuntu-GCC-Golo-GPU-GT610-x86_64-Release-TSAN No public API changes. TBR=reed@google.com Review URL: https://codereview.chromium.org/1393833003
* Make SkPath fFirstDirection atomic to fix tsan.Gravatar herb2015-09-28
| | | | | | | | | | There is no API change. TBR=reed@google.com BUG=skia: Review URL: https://codereview.chromium.org/1372103003
* Use static_assert instead of SK_COMPILE_ASSERT.Gravatar bungeman2015-08-20
| | | | | | | Now that static_assert is allowed, there is no need to use a non- standard compile time assertion Review URL: https://codereview.chromium.org/1306443004
* change getBounds to return 0000 iff there are zero pointsGravatar reed2015-07-28
| | | | | | | | | | This is a contract change for SkPath::getBounds(), which formally was defined to return 0,0,0,0 for a 1-point path, regardless of the coordinates of that point. This seems wacky/inconsistent, and was causing other bugs (incorrect bounds) when this was unioned with other rects. Does anyone remember why we defined it this way? BUG=513799 Review URL: https://codereview.chromium.org/1261773002
* Very tiny paths are subsumed by the ConvexicatorGravatar caryclark2015-07-14
| | | | | | | | | | | | | | | and are treated as convex when they are not. Allow the SkPath::Iter to leave degenerate path segments unmolested by passing an additional exact bool to next(). Treat any non-zero length as significant in addPt(). R=reed@google.com,robertphillips@google.com BUG=493450 Review URL: https://codereview.chromium.org/1228383002
* remove SkInstCntGravatar mtklein2015-06-26
| | | | | | | | | | | | | | It's been outclassed by Valgrind and leak sanitizer, and it seems to be causing problems for external folks building Skia. I'm not sure why our own builds seem unaffected. Latest thread: https://groups.google.com/forum/#!topic/skia-discuss/oj9FsQwwSF0 BUG=skia: Review URL: https://codereview.chromium.org/1217573002
* fix deserialization after FirstDirection change to pathsGravatar reed2015-06-11
| | | | | | BUG=skia: Review URL: https://codereview.chromium.org/1185453003
* SkPath::Direction serves two masters:Gravatar reed2015-06-10
| | | | | | | | | | | | | - input param to addFoo (e.g. addRect), where only CW or CCW are valid) - output param from computing functions, that sometimes return kUnknown This CL's intent is to split these into distinct enums/features: - Direction (public) loses kUnknown, and is only used for input - FirstDirection (private) is used for computing the first direction we see when analyzing a contour BUG=skia: Review URL: https://codereview.chromium.org/1176953002
* simplify RawIter - don't return a pt in kCloseGravatar reed2015-05-27
| | | | | | | BUG=skia: TBR= Review URL: https://codereview.chromium.org/1156893003
* simplify RawIterGravatar reed2015-05-13
| | | | | | BUG=skia: Review URL: https://codereview.chromium.org/1137783006
* minor fixes to cubics code and overall alignment of how bounds and tops are ↵Gravatar caryclark2015-04-29
| | | | | | | | | | | | computed for all curve types All but 17 extended tests work. A helper function is privately added to SkPath.h to permit a test to modify a given point in a path. BUG=skia:3588 Review URL: https://codereview.chromium.org/1107353004
* change isNestedRect to isNestedFillRectGravatar caryclark2015-04-08
| | | | | | | | | R=reed@google.com, bsalomon@google.com Let isNested(Fill)Rect return true if drawn path describes filled rectangles. Review URL: https://codereview.chromium.org/1073473002
* fuzzer fixesGravatar caryclark2015-02-25
| | | | | | | | | | | | | | | | | | | Fix path bugs exposed by the path fuzzer. Changes to existing gm and samplecode files defer their calls to construct SkPath objects until the first draw instead of at test initialization. Add an experimental call to SkPath to validate the internal SkPathRef. Fix SkPath::addPoly to set the last moveto after adding a close verb. Fix stroke to handle failures when computing the unit normal. Add a unit test for the unit normal failure. R=reed@google.com Review URL: https://codereview.chromium.org/953383002