Commit Graph

152 Commits

Author SHA1 Message Date
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
commit-bot@chromium.org
42feaaf0a5 use quads for mixed radius rrects
Create a specialized version of adding a pair of corner quads
that avoids the overhead of the full arc machinery.

This is on the way to changing Chrome to calling Skia directly to create fully general round rects rather than rolling their own.

R=robertphillips@google.com, reed@google.com

Author: caryclark@google.com

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

git-svn-id: http://skia.googlecode.com/svn/trunk@12190 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-11-08 15:51:12 +00:00
commit-bot@chromium.org
4faa869cda Checking structure sizes before reading them from memory to avoid overflowing the buffer's stream.
BUG=
R=reed@google.com, mtklein@google.com, senorblanco@chromium.org

Committed: https://code.google.com/p/skia/source/detail?r=12114

Committed: https://code.google.com/p/skia/source/detail?r=12119

Author: sugoi@chromium.org

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

git-svn-id: http://skia.googlecode.com/svn/trunk@12130 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-11-05 15:46:56 +00:00
reed@google.com
12a23866fe Revert "Checking structure sizes before reading them from memory to avoid overflowing the buffer's stream."
This reverts commit 6bc22e8ef1ea70a1b58409aa21254358c50f149a.

git-svn-id: http://skia.googlecode.com/svn/trunk@12124 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-11-04 21:35:55 +00:00
sugoi@google.com
b48a59ae81 Checking structure sizes before reading them from memory to avoid overflowing the buffer's stream.
BUG=
R=reed@google.com

Committed: https://code.google.com/p/skia/source/detail?r=12114

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

git-svn-id: http://skia.googlecode.com/svn/trunk@12119 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-11-04 20:28:23 +00:00
epoger@google.com
eb221268ab Revert r12114 due to https://code.google.com/p/skia/issues/detail?id=1794 ('Assertion failures on various buildbots as of r12114')
git-svn-id: http://skia.googlecode.com/svn/trunk@12115 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-11-04 18:06:12 +00:00
sugoi@google.com
305f78e8c1 Checking structure sizes before reading them from memory to avoid overflowing the buffer's stream.
BUG=
R=reed@google.com

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

git-svn-id: http://skia.googlecode.com/svn/trunk@12114 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-11-04 16:18:15 +00:00
reed@google.com
4469938e92 Revert "Revert "add SK_ATTR_DEPRECATED -- will need to disable for chrome, since it triggers a warning""
This reverts commit 1e787c38fa71f2a21fd728f1b1d620b9b09b0d3d.

BUG=

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

git-svn-id: http://skia.googlecode.com/svn/trunk@12057 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-10-31 17:28:30 +00:00
reed@google.com
6fcbfcead5 Revert "add SK_ATTR_DEPRECATED -- will need to disable for chrome, since it triggers a warning"
This reverts commit 1d22c4aaf9d8f053f25194a1ed74b137bfb19497.

git-svn-id: http://skia.googlecode.com/svn/trunk@12056 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-10-31 16:31:11 +00:00
reed@google.com
081560e3ab add SK_ATTR_DEPRECATED -- will need to disable for chrome, since it triggers a warning
BUG=
R=robertphillips@google.com, senorblanco@chromium.org, vandebo@chromium.org

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

git-svn-id: http://skia.googlecode.com/svn/trunk@12055 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-10-31 16:24:08 +00:00
commit-bot@chromium.org
1ab9f737f0 Use SkPathRef gen id for SkPath::getGenerationID
R=mtklein@google.com, robertphillips@google.com

Author: bsalomon@google.com

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

git-svn-id: http://skia.googlecode.com/svn/trunk@12029 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-10-30 18:57:55 +00:00
reed@google.com
f32322b9ce add disabled tests, in pref for experimental isRect behavior
BUG=
R=bsalomon@google.com

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

git-svn-id: http://skia.googlecode.com/svn/trunk@11810 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-10-16 15:14:04 +00:00
skia.committer@gmail.com
472629190e Sanitizing source files in Housekeeper-Nightly
git-svn-id: http://skia.googlecode.com/svn/trunk@11800 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-10-16 07:02:24 +00:00
reed@google.com
b58ba8912a account for inverse-paths when we prealloc storage in the rgn-builder
test inversepath->rgn

BUG=
R=caryclark@google.com

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

git-svn-id: http://skia.googlecode.com/svn/trunk@11776 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-10-15 15:44:35 +00:00
reed@google.com
77658b5600 meant to DISABLE this test
git-svn-id: http://skia.googlecode.com/svn/trunk@11775 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-10-15 15:40:32 +00:00
reed@google.com
cc8be77bc2 add test for https://code.google.com/p/skia/issues/detail?id=1706
BUG=

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

git-svn-id: http://skia.googlecode.com/svn/trunk@11774 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-10-15 15:35:29 +00:00
bungeman@google.com
b8d9d5bd29 Refactor PathTest.cpp test_isNestedRects and test_isRect.
The existing implementations make it difficult to add new tests
and rely on non-local side effects.

R=bsalomon@google.com

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

git-svn-id: http://skia.googlecode.com/svn/trunk@11455 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-25 18:21:39 +00:00
reed@google.com
d28ba8010c promote SkImage::AlphaType to SkAlphaType
BUG=
R=bsalomon@google.com

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

git-svn-id: http://skia.googlecode.com/svn/trunk@11421 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-20 19:33:52 +00:00
commit-bot@chromium.org
e0e7cfe44b Change old PRG to be SkLCGRandom; change new one to SkRandom
The goal here is to get people to start using the new random number
generator, while leaving the old one in place so we don't have to 
rebaseline GMs.

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

Author: jvanverth@google.com

Review URL: https://chromiumcodereview.appspot.com/23576015

git-svn-id: http://skia.googlecode.com/svn/trunk@11169 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-09 20:09:12 +00:00
mtklein@google.com
330313a8a8 My clang now doesn't complain about !"foo".
BUG=
R=robertphillips@google.com

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

git-svn-id: http://skia.googlecode.com/svn/trunk@10874 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-08-22 15:37:26 +00:00
mtklein@google.com
cb8b0eeacf Update how SkPath handles fGenerationID and fSourcePath, and add tests to cover.
BUG=
R=bungeman@google.com, reed@google.com

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

git-svn-id: http://skia.googlecode.com/svn/trunk@10756 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-08-15 21:14:51 +00:00