Commit Graph

172 Commits

Author SHA1 Message Date
reed
6e43465039 simplify RawIter - don't return a pt in kClose
BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1156893003
2015-05-27 19:53:25 -07:00
caryclark
95bc5f3495 change isNestedRect to isNestedFillRect
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
2015-04-08 08:34:15 -07:00
caryclark
b421650e13 add double precision convex test
BUG=389050

Review URL: https://codereview.chromium.org/975523002
2015-03-02 13:02:34 -08:00
caryclark
5ccef57790 treat backwards quads as not convex
If a quad, cubic, or conic goes back on itself, assume it's not convex.
In a future CL, we could check to see if the curve is linear so that
linear curves are treated the same as lines.

BUG=skia:3469

Review URL: https://codereview.chromium.org/971773002
2015-03-02 10:07:56 -08:00
robertphillips
b8de1f4659 Reset conicWeights in SkPath::consumeDegenerateSegments when rewinding to last Move op
Without this patch the iterator can end up running off the end of the conic weights if there is a mixture of degenerate and non-degenerate ops

Note: we might want to suppress the generation of degenerate conics and lines in SkPath::addRRect

BUG=459897

Review URL: https://codereview.chromium.org/954453003
2015-02-23 11:17:01 -08:00
djsollen
50da1d8c3b Fix broken build due to updated #define
TBR=scroggo@google.com

Review URL: https://codereview.chromium.org/934803003
2015-02-17 09:09:53 -08:00
djsollen
523cda3943 Remove android specific srcPath from SkPath
Review URL: https://codereview.chromium.org/926693002
2015-02-17 08:06:33 -08:00
reed
454fa71cc3 check for nonfinites in rrects
BUG=457128

Review URL: https://codereview.chromium.org/913743002
2015-02-10 08:46:22 -08:00
reed
d5d27d9b14 use conics for arcTo
guarded by SK_SUPPORT_LEGACY_ARCTO_QUADS

BUG=skia:

Review URL: https://codereview.chromium.org/892703002
2015-02-09 13:54:43 -08:00
reed
3f43f8ab9c remove dead SkPersp macros
BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/864713002
2015-01-20 19:58:36 -08:00
robertphillips
2b6ab61e22 Remove SkPath::asRect
AFAICT the asRect entry point is not needed.

Greg: GPU
Reed: API
Cary: Path

Review URL: https://codereview.chromium.org/833193002
2015-01-05 12:22:14 -08:00
robertphillips
91b0a35873 Cleanup isRect variants
Review URL: https://codereview.chromium.org/832083002
2015-01-05 10:13:46 -08:00
robertphillips
fe7c427e3d Fix bound returned by SkPath::isRect when the path contains a trailing moveTo
Oddly enough this was fixed in:

https://codereview.chromium.org/16950021/ (add rect-output parameter to isRect, allowing us to return the correct bounds even if a rectagular path has a trailing moveTo)

but was reverted here:

https://skia.googlesource.com/skia/+/8fd160350ca5f57fbb1b2e03383c5778414a9b48

since it appeared to be crashing Chrome's trybots. I think it just fell through the cracks after that.

If this sticks I will land a follow on patch for the stroke issue reported in the original bug (crbug.com/247770).

BUG=247770,445368

Review URL: https://codereview.chromium.org/834483002
2014-12-29 11:36:39 -08:00
reed
220f926d9d use conics
BUG=skia:

Review URL: https://codereview.chromium.org/455043002
2014-12-17 08:21:05 -08:00
reed
5bcbe91304 Fix rrects that are large enough that we lose/gain a bit when we add the radius to a bounds coordinate.
add test that triggers assert in addRRect

BUG=skia:3239

Review URL: https://codereview.chromium.org/803153003
2014-12-15 12:28:33 -08:00
bsalomon
9880607151 Even more win64 warning fixes
Review URL: https://codereview.chromium.org/800993002
2014-12-12 15:11:18 -08:00
reed
3054be16df Remove canvas::NewRaster, and rename surface::NewRasterPMColor to N32Premul
patch from issue 781403002 at patchset 20001 (http://crrev.com/781403002#ps20001)

BUG=skia:
TBR=
re-landing after chrome fixes have landed

Review URL: https://codereview.chromium.org/784223007
2014-12-10 07:24:28 -08:00
reed
a8918a0650 Revert of remove (dumb) canvas::NewRaster, and rename surface::NewRasterPMColor to N32Premul (patchset #3 id:40001 of https://codereview.chromium.org/790733003/)
Reason for revert:
need to update chrome first

Original issue's description:
> remove (dumb) canvas::NewRaster, and rename surface::NewRasterPMColor to N32Premul
>
> patch from issue 781403002 at patchset 20001 (http://crrev.com/781403002#ps20001)
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/2c1605a1fbaa2e35a27399a34254fb1200ec2ae6

TBR=fmalita@google.com,fmalita@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/791763002
2014-12-09 13:55:20 -08:00
reed
2c1605a1fb remove (dumb) canvas::NewRaster, and rename surface::NewRasterPMColor to N32Premul
patch from issue 781403002 at patchset 20001 (http://crrev.com/781403002#ps20001)

BUG=skia:

Review URL: https://codereview.chromium.org/790733003
2014-12-09 12:33:38 -08:00
caryclark
d3d1a988b1 add convexity logic and tests for scalar max, Inf, and NaN
PathOps relies on isConvex() only returning true for trivially
convex paths. The old logic also returns true if the paths that
contain NaNs and Infinities. Return kUnknown_Convexity instead
in those cases and in cases where the convexity logic computes
intermediaries that overflow.

Review URL: https://codereview.chromium.org/784593002
2014-12-08 04:57:38 -08:00
robertphillips
f52a063dfd Fix yet another convexicator issue
This CL fixes the case where a bad initial vector (i.e., nearly zero) managed to short circuit all of the convexicator's logic. The initial bad vector would become the last vector and then never get displaced.

The history of this is:

https://codereview.chromium.org/298973004/
Switched the convexicator to not advance the last vector when the cross product wasn't significant

https://codereview.chromium.org/573763002/
Fixed a bug (crbug.com/412640) wherein a zero area path was being incorrectly categorized as convex b.c. opposite but equal vectors were not signaling concavity.

BUG=433683

Review URL: https://codereview.chromium.org/727283003
2014-11-17 12:11:42 -08:00
mtklein
d4897591fd Don't pass null to memcmp.
This will allow us to add nonnull-attribute to the UBSAN bot.

We are in fact hitting a case where one of the arguments is null and the other
not, which seems dicey.  I think the scenario is comparing the empty pathref
with another path ref that's just been COWed, without any verbs or points yet.

BUG=skia:

Review URL: https://codereview.chromium.org/732643002
2014-11-14 09:22:40 -08:00
caryclark
08fa28cd31 add float equivalent in dumpHex output as comment
R=reed@google.com,bsalomon@google.com

Review URL: https://codereview.chromium.org/676803002
2014-10-23 13:08:57 -07:00
robertphillips
c506e3007e Fix convexicator bug
BUG=crbug.com/412640
R=caryclark@google.com, bsalomon@google.com

Author: robertphillips@google.com

Review URL: https://codereview.chromium.org/573763002
2014-09-16 09:43:32 -07:00
caryclark
e956259c5a add dumpHex() option to SkPath
This provides exact precision
to help debugging when the float
representation of a SkScalar may
introduce error.

R=reed@google.com

Author: caryclark@google.com

Review URL: https://codereview.chromium.org/571973003
2014-09-15 09:26:09 -07:00
bsalomon
49f085dddf "NULL !=" = NULL
R=reed@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/544233002
2014-09-05 13:34:00 -07:00
bsalomon
b17c129108 Add dirty_after_edit to SkPath::moveTo. Add commented out test case that triggers assert.
BUG=skia:1460
R=reed@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/517023003
2014-08-28 14:04:55 -07:00
piotaixr
fac4e0e836 Fallback to moveTo when unable to find the first tangent in cubicTo
When calling cubicTo(a, b, c) and if the distance between fPrevPt and a
is too small, b is used instead of a to calculate the first tangent,
even if the distance between fPrevPt and b is too small.

In debug mode, this is causing an assertion to fail in
SkPathStroker::preJoinTo() and, in Release, the use of an
unitialized value.

The first patch set is adding a failing test.
The second one add the fix to SkPathStroker::cubicTo()

BUG=skia:2820
R=bsalomon@chromium.org, junov@chromium.org, reed@google.com, caryclark@google.com, bsalomon@google.com

Author: piotaixr@chromium.org

Review URL: https://codereview.chromium.org/460813002
2014-08-26 11:59:04 -07:00
caryclark
66a5d8bf13 add path dump test
Add a unit test for SkPath::dump(). The unit test exposed a minor
bug (inconsistent CRs) and an unused parameter (title).

R=bsalomon@google.com
TBR=bsalomon
BUG=skia:1836

Author: caryclark@google.com

Review URL: https://codereview.chromium.org/351833003
2014-06-24 08:30:18 -07:00
commit-bot@chromium.org
8be07bb12d In convexity checker don't advance last vector when x-product isn't significant.
BUG=skia:2235
R=caryclark@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/298973004

git-svn-id: http://skia.googlecode.com/svn/trunk@14845 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-05-22 14:58:53 +00:00
commit-bot@chromium.org
4e332f82fc add rounding-using-doubles methods on SkScalar and SkRect
Inspired by the excellent repro case for https://crbug.com/364224

patch from issue 265933010

BUG=skia:
R=bungeman@google.com

Author: reed@google.com

Review URL: https://codereview.chromium.org/267003002

git-svn-id: http://skia.googlecode.com/svn/trunk@14566 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-05-05 16:04:42 +00:00
skia.committer@gmail.com
877c44956d Sanitizing source files in Housekeeper-Nightly
git-svn-id: http://skia.googlecode.com/svn/trunk@13418 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-02-12 03:02:04 +00:00
commit-bot@chromium.org
14747e58f8 Adding new 'extend' mode to SkPath::addPath
BUG=261727
R=reed@google.com, caryclark@google.com, schenney@chromium.org, robertphillips@google.com

Author: junov@chromium.org

Review URL: https://codereview.chromium.org/151353006

git-svn-id: http://skia.googlecode.com/svn/trunk@13415 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-02-11 21:16:29 +00:00
commit-bot@chromium.org
7e90e8dbb9 fix minor error between kStroke_PathAsRect and kFill_PathAsRect in SkPath::asRect
R=caryclark@google.com, reed@google.com

Author: yunchao.he@intel.com

Review URL: https://codereview.chromium.org/138703008

git-svn-id: http://skia.googlecode.com/svn/trunk@13390 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-02-11 01:38:30 +00:00
commit-bot@chromium.org
c2abd54eda add alternative to isRect named asRect
This defines yunchao's proposed interface in terms of
an existing implementation.

BUG=skia:
R=reed@google.com, yunchao.he@intel.com

Author: caryclark@google.com

Review URL: https://codereview.chromium.org/140953003

git-svn-id: http://skia.googlecode.com/svn/trunk@13183 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-01-25 16:54:31 +00:00
tfarina@chromium.org
8f6884aab8 Cleanup: Sanitize the order of includes under tests/
Initially this was to make sure Test.h appeared after the Sk*.h includes.

Patch generated by the following command line:

$ ~/chromium/src/tools/sort-headers.py tests/*.cpp

BUG=None
TEST=tests
R=robertphillips@google.com

Review URL: https://codereview.chromium.org/145313004

git-svn-id: http://skia.googlecode.com/svn/trunk@13177 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-01-24 20:56:26 +00:00
commit-bot@chromium.org
05ec2233e3 change isRect to return true for 3-sided rectangular paths
BUG=skia:
R=caryclark@google.com, yunchao.he@intel.com

Author: reed@google.com

Review URL: https://codereview.chromium.org/139483002

git-svn-id: http://skia.googlecode.com/svn/trunk@13092 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-01-15 18:00:57 +00:00
commit-bot@chromium.org
e2eac8b2fd Move macros from TestClassDef.h to Test.h
Motivation: those macros don't make any sense without the definitions
in Test.h.

BUG=
R=mtklein@google.com

Author: halcanary@google.com

Review URL: https://codereview.chromium.org/138563004

git-svn-id: http://skia.googlecode.com/svn/trunk@13074 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-01-14 21:04:37 +00:00
commit-bot@chromium.org
19382421b9 Convert SkWriter32 to use an SkTDArray for its internal storage.
This reduces the allocation overhead of a null picture (create, beginRecording(), endRecording) from about 18K to about 1.9K.  (There's still lots more to prune.)

SkPictureFlat can exploit the fact that Writer32 is contiguous simplify its memory management.  The Writer32 itself becomes the scratch buffer.

Remove lots and lots of arbitrary magic numbers that were size guesses and minimum allocation sizes.  Keep your eyes open for the big obvious DUH why we save 16K per picture!  (Spoiler alert.  It's because that first save we issue in beginRecording() forces the old SkWriter32 to allocate 16K.)

Tests passing, DM passing.

bench --match writer: ~20% faster
null bench_record: ~30% faster
bench_record on buildbot .skps: ~3-6% slower, ranging 25% faster to 20% slower
bench_pictures on buildbot .skps: ~1-2% faster, ranging 13% faster to 28% slower

BUG=skia:1850
R=reed@google.com

Author: mtklein@google.com

Review URL: https://codereview.chromium.org/137433003

git-svn-id: http://skia.googlecode.com/svn/trunk@13073 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-01-14 20:51:26 +00:00
reed@google.com
8f4d2306fa remove SK_SCALAR_IS_[FLOAT,FIXED] and assume floats
To keep the CL (slightly) managable, this does not make any changes to
existing macros (e.g. SkScalarMul). Just tackling #ifdef constructs this
time around.

BUG=
R=bsalomon@google.com, caryclark@google.com

Review URL: https://codereview.chromium.org/117053002

git-svn-id: http://skia.googlecode.com/svn/trunk@12712 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-12-17 16:44:46 +00:00
robertphillips@google.com
0efb21bd1c Improved SkPathRef interface security
https://codereview.chromium.org/115323004/



git-svn-id: http://skia.googlecode.com/svn/trunk@12676 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-12-13 19:36:25 +00:00
robertphillips@google.com
6b8dbb668f Move segment mask from SkPath to SkPathRef
https://codereview.chromium.org/105083003/



git-svn-id: http://skia.googlecode.com/svn/trunk@12660 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-12-12 23:03:51 +00:00
tfarina@chromium.org
e4fafb146e Use DEFINE_TESTCLASS_SHORT macro in tests.
The three version of DEFINE_TESTCLASS macro is deprecated and thus just
use the simple, short one.

BUG=None
TEST=out/Debug/tests
R=mtklein@google.com, bsalomon@google.com, robertphillips@google.com

Review URL: https://codereview.chromium.org/100113004

git-svn-id: http://skia.googlecode.com/svn/trunk@12653 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-12-12 21:11:12 +00:00
skia.committer@gmail.com
6e515d67d2 Sanitizing source files in Housekeeper-Nightly
git-svn-id: http://skia.googlecode.com/svn/trunk@12477 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-12-04 07:02:26 +00:00
robertphillips@google.com
b06e88dc65 Fix for SkPathRef::CreateTransformedCopy bug
https://codereview.chromium.org/99423004/



git-svn-id: http://skia.googlecode.com/svn/trunk@12464 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-12-03 17:15:36 +00:00
robertphillips@google.com
466310dbd3 Move fIsOval from SkPath to SkPathRef
https://codereview.chromium.org/89123002/



git-svn-id: http://skia.googlecode.com/svn/trunk@12463 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-12-03 16:43:54 +00:00
robertphillips@google.com
ca316f576e Revert of r12450 (Move fIsOval from SkPath to SkPathRef)
git-svn-id: http://skia.googlecode.com/svn/trunk@12452 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-12-03 00:23:39 +00:00
robertphillips@google.com
31f0ffc9c3 Move fIsOval from SkPath to SkPathRef
https://codereview.chromium.org/89123002/



git-svn-id: http://skia.googlecode.com/svn/trunk@12450 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-12-02 23:55:11 +00:00
commit-bot@chromium.org
4b413c8bb1 remove SkFloatToScalar macro
BUG=
R=reed@google.com, djsollen@google.com

Author: caryclark@google.com

Review URL: https://codereview.chromium.org/85463005

git-svn-id: http://skia.googlecode.com/svn/trunk@12385 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-11-25 19:44:07 +00:00
commit-bot@chromium.org
a1a097ee81 increase coverage of SkPath.cpp, remove unused code
Using Mike Klein's excellent coverage tool, increase the
unit testing of SkPath.cpp from 70% to 95%.

Along the way, determined that these functions were not
maintained or used:

SkPath::pathTo
SkPath::contains

as well as a large block of SkPath::cheapGetDirection().

Changed SkPath::validate() to permit infinities in
the path data points.

Fixed errors in preserving direction.
Fixed error setting direction when convexity is unknown.

Added missing conic to moveTo only detector.

BUG=
R=bsalomon@google.com, reed@google.com

Author: caryclark@google.com

Review URL: https://codereview.chromium.org/65493004

git-svn-id: http://skia.googlecode.com/svn/trunk@12291 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-11-14 16:53:22 +00:00