aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPath.cpp
Commit message (Collapse)AuthorAge
* Revert "Annotate benign race on SkPath::fConvexity."Gravatar Mike Klein2016-11-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit c51a3a4e3c81a1d4100d5d29d31bf3a02eda2a7c. Reason for revert: had to revert this in the copy constructor. Might as well revert here too for consistency. Original change's description: > Annotate benign race on SkPath::fConvexity. > > We're tired of this making our TSAN bot flaky, and equally tired of trying to fix it. > > BUG=skia:5776 > > CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release-TSAN-Trybot > > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4691 > > Change-Id: Ib6005282c514a6d785fd4fffe5387cbb1caccbe1 > Reviewed-on: https://skia-review.googlesource.com/4691 > Commit-Queue: Mike Klein <mtklein@chromium.org> > Reviewed-by: Ben Wagner <bungeman@google.com> > TBR=mtklein@chromium.org,bungeman@google.com,reed@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I906b1e017471d9e00fc58402136497459d881f72 Reviewed-on: https://skia-review.googlesource.com/4740 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Mike Klein <mtklein@chromium.org>
* Revert "Annotate SkPath::fCovexity benign race in the other constructor too."Gravatar Mike Klein2016-11-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit f978f12af553f899cfed7078ab63d3a71c6fbcb1. Reason for revert: slowing the TSAN bot down to the point of timeouts. Original change's description: > Annotate SkPath::fCovexity benign race in the other constructor too. > > I overlooked the copy constructor last time. > > BUG=skia:5776 > > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4730 > > Change-Id: I30bc89e1472dd48badf57664cfae8899f44bca9e > Reviewed-on: https://skia-review.googlesource.com/4730 > Reviewed-by: Mike Klein <mtklein@chromium.org> > Commit-Queue: Mike Klein <mtklein@chromium.org> > TBR=mtklein@chromium.org,reed@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I6e34b1fc80fd98387d79521ce24f4545b990eb25 Reviewed-on: https://skia-review.googlesource.com/4739 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Mike Klein <mtklein@chromium.org>
* Annotate SkPath::fCovexity benign race in the other constructor too.Gravatar Mike Klein2016-11-11
| | | | | | | | | | | | | I overlooked the copy constructor last time. BUG=skia:5776 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4730 Change-Id: I30bc89e1472dd48badf57664cfae8899f44bca9e Reviewed-on: https://skia-review.googlesource.com/4730 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Annotate benign race on SkPath::fConvexity.Gravatar Mike Klein2016-11-10
| | | | | | | | | | | | | | | We're tired of this making our TSAN bot flaky, and equally tired of trying to fix it. BUG=skia:5776 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release-TSAN-Trybot GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4691 Change-Id: Ib6005282c514a6d785fd4fffe5387cbb1caccbe1 Reviewed-on: https://skia-review.googlesource.com/4691 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Ben Wagner <bungeman@google.com>
* 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
* Fix quad convexity with only one backward dirGravatar liyuqian2016-11-03
| | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2465253008 Review-Url: https://codereview.chromium.org/2465253008
* 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
* Correct a small mistake in SkPath::build_arc_conicsGravatar xidachen2016-10-19
| | | | | | | | | | | | | | | In this function, when count is 0, it maps the dst point to start, where it should really be stop. A test case is also added. In the test case, it should be drawing three lines, without the change in SkPath class, it will draw 2 lines only with the top horizontal line missing because it maps the dst point to the start point, and hence the horizontal line is not drawn. BUG=640031 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2409983004 Review-Url: https://chromiumcodereview.appspot.com/2409983004
* remove SkErrorGravatar Mike Klein2016-10-13
| | | | | | | | | | | | | It has not caught on. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3321 Change-Id: Ib2ee4ef99bc89c8f4b7504e42a9d7d9dfc483015 Reviewed-on: https://skia-review.googlesource.com/3321 Reviewed-by: Leon Scroggins <scroggo@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
* Fix SkPath::arcTo when sweepAngle is tiny and radius is bigGravatar xidachen2016-10-06
| | | | | | | | | | | | | | | In this function, it first check whether this arc is a lone point or not. If not, it converts angles to unit vectors. The problem here is that when the radius is huge and the sweepAngle is small, the function angles_to_unit_vectors() could return a startV ==stopV. When that happens, it will draw a dot at the point that corresponding to the startAngle. This CL adds a special branch for this case, and draw a connecting line between the points at startAngle and endAngle. BUG=640031, skia:5807 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2388833002 Review-Url: https://codereview.chromium.org/2388833002
* disallow -4 pointerGravatar caryclark2016-10-04
| | | | | | | | | | | | | | A user's homegrown unsigned integer overflow tool complains if a nullptr is decremented. The conicWeight pointer likes to predecrement before walking, but this is unnecessary if its value is nullptr. R=reed@google.com BUG=skia:5415 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2061833005 Review-Url: https://codereview.chromium.org/2061833005
* Respecify SkCanvas::drawArc, consolidate conversion to SkPath, add GM for ↵Gravatar bsalomon2016-08-25
| | | | | | | | | | oddball drawArcs Allows the arc to wind more than 360 degrees when useCenter is true, specs that nothing draws if the oval is empty or the sweep angle is 0. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2281653002 Review-Url: https://codereview.chromium.org/2281653002
* Fix misdetection of rectangles in SkPath::IsSimpleClosedRect.Gravatar bsalomon2016-07-24
| | | | | | | BUG=chromium:630369 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2175923002 Review-Url: https://codereview.chromium.org/2175923002
* Fix mask applied to SkPath::fFillType in readFromMemory to fix fuzzer bugGravatar robertphillips2016-06-28
| | | | | | | | The fFillType field only needs/uses 2 bits - not all 8 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2099113004 Review-Url: https://codereview.chromium.org/2099113004
* Add a test to ensure that a case where SkCubicClipper::ChopMonoAtY returns ↵Gravatar mbarbella2016-06-01
| | | | | | | | | | | false is handled properly. Also fixes a style issue in the fix for the issue being tested. BUG=chromium:613918 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2021343004 Review-Url: https://codereview.chromium.org/2021343004
* Fix uninit warning on valgrind bot in SkPathPriv:IsSimpleClosedRectGravatar Brian Salomon2016-06-01
| | | | | | | TBR=robertphillips@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2030713002 Review URL: https://codereview.chromium.org/2030713002 .
* Add SkPathPriv::IsSimpleClosedRectGravatar bsalomon2016-06-01
| | | | | | | | This function looks for "simple" rect paths. Simple here means begins and ends at a corner and is closed (either manually or with a close verb). Unlike SkPath::isRect this returns the starting point index (using the same start indexing scheme as SkPath::addRect). GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2017313002 Review-Url: https://codereview.chromium.org/2017313002
* Check results from calls to SkCubicClipper::ChopMonoAtY.Gravatar mbarbella2016-05-31
| | | | | | | BUG=613918 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2006143009 Review-Url: https://codereview.chromium.org/2006143009
* Fix bug where SkPath will convert an arc to an oval and change the starting ↵Gravatar bsalomon2016-05-31
| | | | | | | | | point. Adds unit tests to test the behavior of addArc to oval conversions. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2017743002 Review-Url: https://codereview.chromium.org/2017743002
* 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
* Fix warnings that were exposed when running with SK_DEBUG enable on an ↵Gravatar djsollen2016-04-29
| | | | | | | | optimized release build. GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1917223006 Review-Url: https://codereview.chromium.org/1917223006
* Style bikeshed - remove extraneous whitespaceGravatar halcanary2016-03-29
| | | | | | GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1842753002 Review URL: https://codereview.chromium.org/1842753002
* 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
* check for zero conic weights in interpGravatar caryclark2016-02-18
| | | | | | | | | | | this will fix the current (and uncover the next) ASAN failure TBR=tomhudson@google.com BUG=skia:4549 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1711813002 Review URL: https://codereview.chromium.org/1711813002
* fix asan error deref-ing null ptrGravatar caryclark2016-02-18
| | | | | | | | TBR=tomhudson@google.com BUG=skia:4549 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1709023002 Review URL: https://codereview.chromium.org/1709023002
* 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 unit test to feed valid SVG sequences to make sure thatGravatar caryclark2016-02-09
| | | | | | | | | | | | | path strings can be parsed without returning an error. Draw the output through Skia and SVG to make sure they are parsed correctly. R=fmalita@chromium.org BUG=skia:4549 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1675053002 Review URL: https://codereview.chromium.org/1675053002
* Consolidate SK_CRASH and sk_throw into SK_ABORTGravatar djsollen2016-01-29
| | | | | | | TBR=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1648343003 Review URL: https://codereview.chromium.org/1648343003
* remove legacy definesGravatar caryclark2016-01-25
| | | | | | | | | | | | | | | | | | The defines SK_SUPPORT_LEGACY_ARCTO SK_SUPPORT_LEGACY_CONIC_MEASURE SK_SUPPORT_LEGACY_DASH_MEASURE SK_SUPPORT_LEGACY_HAIR_IGNORES_CAPS SK_SUPPORT_LEGACY_PATH_MEASURE_TVALUE have been removed from Chrome. This removes the obsolete code from Skia as well. R=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1627703002 Review URL: https://codereview.chromium.org/1627703002
* fix arcto exception handlingGravatar caryclark2016-01-25
| | | | | | | | | | | | | | | To match SVG behavior, draw a line when either radius is zero, or when the end point equals the start point. Update the GM to include these tests, and take the scale used to test it on a highres display. R=fmalita@chromium.org BUG=skia:4849 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1627423002 Review URL: https://codereview.chromium.org/1627423002
* 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
* Revert of Consolidate SK_CRASH and sk_throw into SK_ABORT (patchset #5 ↵Gravatar djsollen2016-01-22
| | | | | | | | | | | | | | | | | | | | | id:80001 of https://codereview.chromium.org/1610823002/ ) Reason for revert: Chrome is calling SK_CRASH Original issue's description: > Consolidate SK_CRASH and sk_throw into SK_ABORT > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1610823002 > > Committed: https://skia.googlesource.com/skia/+/4c5cd7d527ed29aabfa72aa47b23a4496eeda357 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/1620333002
* Consolidate SK_CRASH and sk_throw into SK_ABORTGravatar djsollen2016-01-22
| | | | | | GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1610823002 Review URL: https://codereview.chromium.org/1610823002
* replace arcto quads with a conicGravatar caryclark2016-01-20
| | | | | | | | | | | also, remove code used only for the quad generation R=reed@google.com BUG=578885 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1612543003 Review URL: https://codereview.chromium.org/1612543003
* 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
* Fix fuzzer-found deserialization bugsGravatar ajuma2016-01-13
| | | | | | | | | This fixes deserialization bugs found by fuzzing SkPaintImageFilter. BUG=576908,576910 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1589533002 Review URL: https://codereview.chromium.org/1589533002
* add commentGravatar caryclark2016-01-06
| | | | | | | | | TBR=reed@google.com NOTRY=true BUG=skia:4757 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1566733002 Review URL: https://codereview.chromium.org/1566733002
* fix valgrindGravatar caryclark2016-01-06
| | | | | | | | | | | | | | (A recently added fuzzer test broke the valgrind bot, intentionally, to isolate an uninitialized memory bug.) If the conic has ordered points, but cannot be broken into parts, treat it as if it were monotonic. R=reed@google.com BUG=skia:4757 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1568513002 Review URL: https://codereview.chromium.org/1568513002
* fix bugs in path containsGravatar caryclark2015-12-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Pull out the logic to check to see if the point is on the edge so all curve types can share. Reorder cubic to be like conic and quad so that mixed types consider the curves consistently. Don't count on curve points twice if they are on the end and compute a zero cross product. Remove logic that checks, when there are no roots, if the point is closer to the top or the bottom (it's always the top). Initialize the iterator correctly when it is accessing the list of on point curves. Use 'multiply' instead of 'subtract' to see if the vectors are pointing in opposite directions. Add more test cases. R=reed@google.com,fs@opera.com BUG=skia:4265 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1532003004 Review URL: https://codereview.chromium.org/1532003004
* Use the unswapped end point y for early out case in winding_lineGravatar fs2015-12-17
| | | | | | | | | | The x-coordinates are not swapped, so using the swapped y will result in a comparison with the wrong (end) point. BUG=skia:4265 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1533873002 Review URL: https://codereview.chromium.org/1533873002
* If a point is on a path edge, it's in the path, at least for all cases where ↵Gravatar caryclark2015-12-14
| | | | | | | | | | | the path edge is not canceled with another edge through coincidence. Add test cases for edges and conics, and make sure it all works. R=reed@google.com BUG=skia:4669,4265 Review URL: https://codereview.chromium.org/1517883002
* Another memcpy -> sk_careful_memcpyGravatar mtklein2015-12-09
| | | | | | | | | | | https://uberchromegw.corp.google.com/i/client.skia/builders/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-ASAN/builds/3787/steps/dm/logs/stdio dst is null. TBR=herb@google.com BUG=skia: Review URL: https://codereview.chromium.org/1507113007
* 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
* Base SkAutoTUnref on skstd::unique_ptr.Gravatar bungeman2015-10-01
| | | | | | | | | To further consolidate the various unique owning classes, this bases SkAutoTUnref on skstd::unique_ptr. Users are updated because of two breaking changes, swap now takes a reference and reset no longer returns its argument. Review URL: https://codereview.chromium.org/1370803002
* 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