Commit Graph

272 Commits

Author SHA1 Message Date
Cary Clark
dbc59ba23b path is rect track corners
This was triggered by an exploit that started the first
edge well outside the final rectangle, causing the captured
to exceed the correct result.

Ivan observes that we really only want the first and third
corners to compute the bounds, so remove the tracking code
that looks for a valid range of points, and record the
corners instead.

R=robertphillips@google.com
Bug: 824145,skia:7792
Change-Id: If228573d0f05c7158dba8142c144d13834e691ec
Reviewed-on: https://skia-review.googlesource.com/122081
Commit-Queue: Cary Clark <caryclark@skia.org>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Auto-Submit: Cary Clark <caryclark@skia.org>
2018-04-19 12:11:34 +00:00
Cary Clark
b120e9291a fix path is rect flaw exposed by gold
One of the path is rect bug fixes changed
the behavior of zero-length strokes which
showed up as a change in Gold.

The bug is if a rect is defined by a
series of colinear movetos, the bounds
did not work out if the rect started
and stopped in the middle of a side.

R=robertphillips@google.com
Bug: 824145,skia:7792
Change-Id: I226545efeda03dedd928eebc120d2508b428fef0
Reviewed-on: https://skia-review.googlesource.com/122002
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Cary Clark <caryclark@skia.org>
2018-04-18 17:46:03 +00:00
Cary Clark
4eb6f7a698 path is rect diag test is required
Removed a test that appeared to go uncalled;
Ivan to the rescue, with a test case
proving that it is required.

R=robertphillips@google.com
Bug: 824145,skia:7792
Change-Id: I7df9688072bd36b7597673148e3fe5dbbf82f5a7
Reviewed-on: https://skia-review.googlesource.com/121883
Commit-Queue: Cary Clark <caryclark@skia.org>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2018-04-17 18:15:34 +00:00
Cary Clark
1cd6098d52 path is rect bug number twelve
Exposes that final close along a diagonal need not
include a close verb if the subsequent verb is move;
so we have to check for a diagonal then.

The later check for diagonal included a comment that
it may not be needed which does appear to be the case.

R=robertphillips@google.com
Bug: 824145,skia:7792
Change-Id: I17a9414e8b3e69b82c2eda28195696eae4e3d513
Reviewed-on: https://skia-review.googlesource.com/121801
Commit-Queue: Cary Clark <caryclark@skia.org>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2018-04-17 16:42:04 +00:00
Cary Clark
a7651567ca yet another path is rect exploit
This one accumulates the othershoot when all four sides
have the same direction, and the final side when closed
should cause the overshoot to be ignored.

Docs-Preview: https://skia.org/?cl=121787
Bug: 824145,skia:7792
Change-Id: I71ea0fcdd0f03a4fcac224b57220c65c321112f6
Reviewed-on: https://skia-review.googlesource.com/121787
Commit-Queue: Cary Clark <caryclark@skia.org>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2018-04-17 13:50:13 +00:00
Cary Clark
48c464a3c4 a more involved path is rect bug
This is bug number ten in the series, and is the
most interesting. It exploits that the code tracks
corners 0, 2, and 3 but not corner 1.

Changing the code to track all corners is the biggest
so far, and while it (hopefully) simplifies things,
the presence of new code may signify more bugs to come.

R=robertphillips@google.com

Bug: 824145,skia::7792
Change-Id: Ia18e4d80fbed06ae6d9c89dcb4c462c5610213cc
Reviewed-on: https://skia-review.googlesource.com/121487
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Cary Clark <caryclark@google.com>
2018-04-17 11:46:53 +00:00
Cary Clark
d4228473a5 path is rect bug number nine
This variation exploits a sequence which uses a zero
length line to note that lines have been recorded, but
no rectangle edge has been encountered.

R=robertphillips@google.com

Docs-Preview: https://skia.org/?cl=121282
Bug: 824145,skia:7792
Change-Id: I652e9482b2867c3d7da30d5f5df2aecbfd0d716d
Reviewed-on: https://skia-review.googlesource.com/121282
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Cary Clark <caryclark@skia.org>
2018-04-13 14:01:32 +00:00
Cary Clark
88ba9710b5 son of path is rect bug
This variation tricks SkPath::isRect by exploiting
that the implementation resets the point pointer to
process the close verb, and using the reset pointer
to walk over a series of points that don't move.

In addition to fixing this, rename variables to
make the line creation more obvious, since left,
right, and friends, are not the left and right.

R=robertphillips@google.com

Bug: 824145,skia:7792
Change-Id: If8ebbc3eedd270652670d6e111a5bc02e61f0eec
Reviewed-on: https://skia-review.googlesource.com/121122
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Cary Clark <caryclark@skia.org>
2018-04-12 20:45:32 +00:00
Cary Clark
31608c02c2 another rect is path fix
This addresses comment #17 of skbug.com/7792.

The bug overshoots the end and exploits that the
first point tracked by close isn't the first
point in the rectangle.

Fixing this slightly regresses the example
in comment #14; before it was treated as a filled
rect but now it is not; this conservative approach
doesn't cause any other regressions.

bug7792 in pathfill.cpp verifies that all paths
in the bug draw correctly by comparing CPU and GPU.

R=robertphillips@google.com

Bug: 824145,skia:7792
Change-Id: I55bea023d2ad7456c8c3ebd9d1df95fe34e0a0d4
Reviewed-on: https://skia-review.googlesource.com/120996
Commit-Queue: Cary Clark <caryclark@skia.org>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2018-04-12 15:05:40 +00:00
Cary Clark
8540e110f9 more path is rect bugs
More edge cases found; clean up the logic a bit
to make more clear where the rectangle points
start and stop.

R=robertphillips@google.com,brianosman@google.com
Bug: 824145,skia:7792
Change-Id: Ie24dfd1519f30875f44ffac68e20d777490b00b9
Reviewed-on: https://skia-review.googlesource.com/120422
Commit-Queue: Cary Clark <caryclark@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2018-04-11 19:13:07 +00:00
Cary Clark
58627cb8eb one more path is rect bug
Add a check to see that the close path generated line
is horizontal or vertical when determining that path
is a rect.

Also change several tests to defer their initialization
to reduce debugging interference.

R=brianosman@google.com,robertphillips@google.com
Bug: 824145,skia:7792
Change-Id: I4a081ee4ffd3558b499a7a1aede2d6232059715e
Reviewed-on: https://skia-review.googlesource.com/120081
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Cary Clark <caryclark@google.com>
2018-04-10 14:17:21 +00:00
Cary Clark
5c71518847 fix path to rect when missing close verb
R=brianosman@google.com,robertphillips@google.com
TBR=reed@google.com
Bug: 824145,skia:7792
Change-Id: I24f121cfa7d437c95b94bd917d3c4888a10c519e
Reviewed-on: https://skia-review.googlesource.com/119569
Commit-Queue: Cary Clark <caryclark@skia.org>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2018-04-10 11:53:53 +00:00
Mike Reed
267ecccfed change path serialization version to 4
New format should be much simpler:
- only store public data (e.g. points, verbs, filltype)
- deserialize just uses public APIs

Refactor reading code to manage different (older) versions, to make
it clear (hopefully) what we can delete when we can abandon version
3 support.

Bug: skia:
Change-Id: I30465f891cba3f044ae1cb2c13c04f04fdc9da78
Reviewed-on: https://skia-review.googlesource.com/109160
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2018-02-21 21:22:37 +00:00
Mike Reed
0c3137c4f4 hide complex versions of isOval and isRRect
Bug: skia:
Change-Id: I9fa899d409470f424fdfbef5b0c3bb528bcce40e
Reviewed-on: https://skia-review.googlesource.com/108660
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2018-02-20 19:33:53 +00:00
Mike Reed
1c6e7831e5 handle paths with degenerate verbs
Bug: skia:7507
Change-Id: I13cedcf8a13f4ce4417ae5c19f7f74d2652724d2
Reviewed-on: https://skia-review.googlesource.com/101760
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-01-30 17:05:25 +00:00
Brian Salomon
1c80e99dd5 Allow printf style var args for messages in REPORTER_ASSERT.
Remove REPORTER_ASSERT_MESSAGE.

Change-Id: I6d00715901159c93e22d182fe24aac92b5fdbcf4
Reviewed-on: https://skia-review.googlesource.com/100361
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
2018-01-29 15:17:09 +00:00
Mike Reed
1fe0bcc4f9 check for huge paths
Bug:802976
Change-Id: Ibb5930442f75ca8483afc8dfa5869cac98573904
Reviewed-on: https://skia-review.googlesource.com/98440
Reviewed-by: Cary Clark <caryclark@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2018-01-22 22:33:11 +00:00
Brian Salomon
0a241ce808 Don't canonicalize empty SkRRects. They stroke differently.
Make insetting greater than width or height collapse to a point/line.

SkPath::addRRect() doesn't ignore an empty SkRRect.


Change-Id: I933a3419a6d75be534f1d8328faa715772045f67
Reviewed-on: https://skia-review.googlesource.com/85680
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-12-19 21:10:36 +00:00
Cary Clark
1acd3c7e84 keep SVG arcs axis aligned with suppression
another attempt at https://skia-review.googlesource.com/c/skia/+/79423

this time, bracket change with SK_SUPPORT_LEGACY_SVG_ARC_TO
to avoid prematurely changing SVG layout test results.

R=djsollen@google.com
Bug: b:69622768
Change-Id: Ia929f89d4f4292dfead191a381cdb431f743726a
Reviewed-on: https://skia-review.googlesource.com/82723
Commit-Queue: Cary Clark <caryclark@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
2017-12-08 18:34:11 +00:00
Cary Clark
5104137844 Revert "keep SVG arcs axis aligned"
This reverts commit c382384848.

Reason for revert: need to add legacy flag to chrome first

Original change's description:
> keep SVG arcs axis aligned
> 
> Computing the arc width introduces rounding errors that cause the
> arc to exceed 1/4 circle and cause integer anchored arcs to start
> outside their marks. A round rect may lose convexity as a result.
> 
> Check if arcTo() inputs are integers and arc is 90 degrees;
> if so, output conics which are axis-aligned on integers as well.
> 
> This is triggered when using SVG to represent a round rect.
> 
> Possible future enhancements are recorded in bug.skia.org/7383
> 
> R=​reed@google.com,djsollen@google.com
> Change-Id: I6609456fcefabcda6c9560a044533ecb5cda2d31
> Reviewed-on: https://skia-review.googlesource.com/79423
> Reviewed-by: Derek Sollenberger <djsollen@google.com>
> Commit-Queue: Derek Sollenberger <djsollen@google.com>

TBR=djsollen@google.com,caryclark@google.com,reed@google.com,caryclark@skia.org

Change-Id: Ia503ea62def15322df2b11da30d377a9543d6999
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/81281
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Cary Clark <caryclark@google.com>
2017-12-06 20:07:56 +00:00
Cary Clark
c382384848 keep SVG arcs axis aligned
Computing the arc width introduces rounding errors that cause the
arc to exceed 1/4 circle and cause integer anchored arcs to start
outside their marks. A round rect may lose convexity as a result.

Check if arcTo() inputs are integers and arc is 90 degrees;
if so, output conics which are axis-aligned on integers as well.

This is triggered when using SVG to represent a round rect.

Possible future enhancements are recorded in bug.skia.org/7383

R=reed@google.com,djsollen@google.com
Change-Id: I6609456fcefabcda6c9560a044533ecb5cda2d31
Reviewed-on: https://skia-review.googlesource.com/79423
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
2017-12-06 16:50:39 +00:00
Brian Salomon
7072e226ab Ignore deserialized path convexity and first direction.
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>
2017-11-29 20:38:56 +00:00
Yuqian Li
c5e4e7437a skipRect should only work for lines (not quads or cubics)
The added unit test shows that we'll trigger SkASSERT failure if we
forgot to check that the edges are lines (instead of quads or cubics).
Similar to skia:7015, this bug is not triggered in our production
because we don't use DAA for convex paths by default. The skipRect is
an optimization just for convex paths.

Bug: skia:7051
Change-Id: Id87ce2d452ede0db9a48425541f473af19ee0572
Reviewed-on: https://skia-review.googlesource.com/48045
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Yuqian Li <liyuqian@google.com>
2017-09-18 19:44:24 +00:00
Brian Osman
205a126760 Revert "Revert "Don't ignore degenerates when deciding if a path is convex""
This reverts commit f953523224.

Reason for revert: Re-landing now that gold has settled.

Original change's description:
> Revert "Don't ignore degenerates when deciding if a path is convex"
> 
> This reverts commit 53cd6c4331.
> 
> Reason for revert: Temporary to limit gold cross-talk with other CLs.
> 
> Original change's description:
> > Don't ignore degenerates when deciding if a path is convex
> > 
> > This ensures that a path with a second contour will always be marked
> > concave. GrDefaultPathRenderer was incorrectly drawing paths of this type
> > (thinking that it could fill them with simple triangulation).
> > 
> > Bug: skia:7020 skia:1460
> > Change-Id: I62bfd72e4c61da427687acf53c552357b57707aa
> > Reviewed-on: https://skia-review.googlesource.com/47082
> > Reviewed-by: Cary Clark <caryclark@google.com>
> > Commit-Queue: Brian Osman <brianosman@google.com>
> 
> TBR=bsalomon@google.com,brianosman@google.com,caryclark@google.com,reed@google.com
> 
> Change-Id: Id7d121633faeb8a43dbd334409408ba51db43d68
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:7020 skia:1460
> Reviewed-on: https://skia-review.googlesource.com/47343
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

TBR=bsalomon@google.com,brianosman@google.com,caryclark@google.com,reed@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: skia:7020 skia:1460
Change-Id: I45ff90a54b66ce9ea068f246d066cc24b310c966
Reviewed-on: https://skia-review.googlesource.com/47820
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-09-18 14:59:49 +00:00
Brian Osman
f953523224 Revert "Don't ignore degenerates when deciding if a path is convex"
This reverts commit 53cd6c4331.

Reason for revert: Temporary to limit gold cross-talk with other CLs.

Original change's description:
> Don't ignore degenerates when deciding if a path is convex
> 
> This ensures that a path with a second contour will always be marked
> concave. GrDefaultPathRenderer was incorrectly drawing paths of this type
> (thinking that it could fill them with simple triangulation).
> 
> Bug: skia:7020 skia:1460
> Change-Id: I62bfd72e4c61da427687acf53c552357b57707aa
> Reviewed-on: https://skia-review.googlesource.com/47082
> Reviewed-by: Cary Clark <caryclark@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

TBR=bsalomon@google.com,brianosman@google.com,caryclark@google.com,reed@google.com

Change-Id: Id7d121633faeb8a43dbd334409408ba51db43d68
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:7020 skia:1460
Reviewed-on: https://skia-review.googlesource.com/47343
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-09-15 20:30:47 +00:00
Brian Osman
53cd6c4331 Don't ignore degenerates when deciding if a path is convex
This ensures that a path with a second contour will always be marked
concave. GrDefaultPathRenderer was incorrectly drawing paths of this type
(thinking that it could fill them with simple triangulation).

Bug: skia:7020 skia:1460
Change-Id: I62bfd72e4c61da427687acf53c552357b57707aa
Reviewed-on: https://skia-review.googlesource.com/47082
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-09-15 19:13:24 +00:00
Yuqian Li
f13beef285 Add a utility function to save path test code size
Bug: skia:
Change-Id: Ie3ec5a57bacaabac544a2b01ab33fd665203031b
Reviewed-on: https://skia-review.googlesource.com/46841
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Yuqian Li <liyuqian@google.com>
2017-09-15 14:09:33 +00:00
Mike Klein
1170a553be Don't allow iteration through non-finite points.
Added a unit test too.

BUG=chromium:756563

Change-Id: Ic77a89b4a98d1a553877af9807a3d3bdcd077bb9
Reviewed-on: https://skia-review.googlesource.com/44420
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2017-09-08 19:56:38 +00:00
Yuqian Li
a81b62674a Fix SkASSERT for convex paths with DAA
As DAA does not chop edges at Y extrema, it's valid for convex edges to
have only one edge (e.g., a single cubic edge with the valley shape \_/).

This wasn't an issue for production because DAA is never called for
convex paths by default.

Bug=skia:7015
Change-Id: Iac79801d6a24188970ef6f7bf723494a25d92a1e
Reviewed-on: https://skia-review.googlesource.com/42942
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Yuqian Li <liyuqian@google.com>
2017-09-07 14:30:01 +00:00
Yuqian Li
3154a5351e Convert Windows CRLF newlines back to unix ones
The newlines got accidentally converted to CRLF in
https://skia-review.googlesource.com/c/skia/+/39521

This CL simply runs dos2unix to convert them back.
There are probably more files affected by 39521, but
these 3 files are the major ones that got thousands
of newlines converted.

Bug: skia:
Change-Id: I0aab5c9e2ab3d491bfe746d6b2db19532a89d654
Reviewed-on: https://skia-review.googlesource.com/42921
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Yuqian Li <liyuqian@google.com>
2017-09-06 20:04:01 +00:00
Ben Wagner
a93a14a998 Convert NULL and 0 to nullptr.
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>
2017-08-28 17:48:57 +00:00
Cary Clark
c8323aa51a tiny concave path point fix
The tiny path added to PathTest.cpp has
tinier cross products (e.g. 1e-12)
so appears to be a series of unbending
lines as far as getConvexity is concerned.

This point fix looks for paths that
do not bend left or right or go backwards,
but do have a bounds, and calls them
concave.

A better fix may be to consider empty
and degenerate paths to be concave
instead of convex; I don't know if
anyone relies on the existing behavior.

Another better fix may be to change
the math to compute the path turns
even though the numbers are very small;
on the surface, very difficult.

R=bsalomon@google.com,reed@google.com
Bug:755839
Change-Id: Ie2280f3f0b95fecab2899f5fc579fd39258e0647
Reviewed-on: https://skia-review.googlesource.com/38720
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Cary Clark <caryclark@google.com>
2017-08-25 14:40:47 +00:00
Yuqian Li
6ad3ffeed1 Guard AA change to wait for rebaselines
We use SK_SUPPORT_LEGACY_DELTA_AA to guard the golden image change.
Such flag is defined for Android, Chrome, and Google3 so our auto-rollers
should all be OK.

TBR: bungeman@google.com

Bug: skia:6947
Change-Id: Ic2705e82f4f7f15ec08499254dce75b93d41727e
Reviewed-on: https://skia-review.googlesource.com/33762
Reviewed-by: Yuqian Li <liyuqian@google.com>
Commit-Queue: Yuqian Li <liyuqian@google.com>
2017-08-11 21:12:37 +00:00
Yuqian Li
4a31c46006 Don't store clipped x which could break edge order
We only need to clip a temporary x to ensure that we don't blit
beyond clip. Storing such clipped x is problematic because it
may make our edges unsorted.

The added unit test would fail without this fix.

Bug: skia:6947
Change-Id: I6c21d7c7c097e50fef18ab151921d6c07c089318
Reviewed-on: https://skia-review.googlesource.com/33420
Commit-Queue: Yuqian Li <liyuqian@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2017-08-11 19:05:56 +00:00
Brian Salomon
e9bf6dc100 Don't compare against uninit edge in SkPath::conservativelyContainsRect
Bug: chromium:752478

Change-Id: Ic281f06b300329ea9823b3eb76cc56b7a43fd2a5
Reviewed-on: https://skia-review.googlesource.com/31520
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-08-08 15:38:30 +00:00
Mike Reed
41a930f85b Revert "Revert "Fix SkPathRef deserialization malloc crash""
This reverts commit a4ce4b1f6b.

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>
2017-07-27 12:15:03 +00:00
Mike Reed
a4ce4b1f6b Revert "Fix SkPathRef deserialization malloc crash"
This reverts commit df6660f64e.

Reason for revert: crashing dm on android and windows

Original change's description:
> 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.
> 
> Change-Id: I40e8db87e4f61abb23217281ab0365c6af222fa3
> Reviewed-on: https://skia-review.googlesource.com/24802
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=bungeman@google.com,reed@google.com,enne@chromium.org

Change-Id: I06fa89c05b785652b097ae04e7ebc001a7c176b2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/26944
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-07-26 18:35:01 +00:00
Adrienne Walker
df6660f64e 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.

Change-Id: I40e8db87e4f61abb23217281ab0365c6af222fa3
Reviewed-on: https://skia-review.googlesource.com/24802
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-07-26 17:49:09 +00:00
Cary Clark
e0b728726d fix drawDRRect for fuzzer
make assert abort instead

Bug: skia:6450
Change-Id: I23ff51124fa8f069f2c7e5260f800017d7475d46
Reviewed-on: https://skia-review.googlesource.com/13197
Commit-Queue: Cary Clark <caryclark@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
2017-04-12 16:48:31 +00:00
Hal Canary
fafe135349 SkSize can be aggregate-initialized
Previosly, SkSize had a base class, which prevented it.

Also removes unused SkISize::clampNegToZero() and
SkSize::clampNegToZero().

Change-Id: I7b93b42f6f6381c66e294bbedee99ad53c6c3436
Reviewed-on: https://skia-review.googlesource.com/13187
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2017-04-11 18:57:20 +00:00
Brian Salomon
d3b65972aa Mark overridden destructors with 'override' and remove 'virtual'
This silences a new warning in clang 5.0

Change-Id: Ieb5b75a6ffed60107c3fd16075d2ecfd515b55e8
Reviewed-on: https://skia-review.googlesource.com/10006
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
2017-03-22 16:06:18 +00:00
Mike Reed
3661bc9976 hide trivial helpers on canvas
BUG=skia:

Change-Id: I42d4ca92897bde5bd8e0575a0104b12b83134cef
Reviewed-on: https://skia-review.googlesource.com/8852
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-02-22 19:41:04 +00:00
Mike Reed
df85c38163 stop using SkScalarMul
BUG=skia:

Change-Id: Ie41d8665a1c62ba8eddc93d8cfefaf64ddc52ff8
Reviewed-on: https://skia-review.googlesource.com/8411
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-02-14 19:45:24 +00:00
Mike Reed
8d3196bdfc expose new tight-bounds method on SkPath
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>
2017-02-03 17:26:43 +00:00
Mike Reed
0d7dac8fb8 experimental tight-bounds
not sure about api -- perhaps it could just return the bounds, and make them 0,0,0,0 if the path
is empty -- the caller can trivially know if the path is empty themselves.

BUG=skia:

Change-Id: I2dbb861e8d981b27c5a6833643977f5bd6802217
Reviewed-on: https://skia-review.googlesource.com/7989
Reviewed-by: Cary Clark <caryclark@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2017-02-03 15:19:05 +00:00
Mike Reed
c121a8849c give up on big cubics (for now) and just draw a line
BUG=683631, skia:6152

Change-Id: I69aa741af74a37e1d7bed25ad0401535599f6af0
Reviewed-on: https://skia-review.googlesource.com/7659
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-01-27 18:17:59 +00:00
Mike Reed
0c0da2b0e2 add test for big cubic -- currently disabled
BUG=skia:

Change-Id: Ief11a1e54d427b1241b47f3cfab5b44fb656443a
Reviewed-on: https://skia-review.googlesource.com/7607
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-01-26 16:32:19 +00:00
Mike Reed
7717d4a343 conservativelyContainsRect is asserting
BUG=skia:6156

Change-Id: Iea571f001e9a4c4e70313c1bd49fb4e3c598869a
Reviewed-on: https://skia-review.googlesource.com/7423
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2017-01-24 15:57:31 +00:00
Lee Salzman
a19f024953 make SkPath::conservativelyContainsRect consume degenerate segments
BUG=skia:

Change-Id: I3a39318bceaf6c95a50d84961d93af4ba62550e3
Reviewed-on: https://skia-review.googlesource.com/6900
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-01-23 22:08:37 +00:00
Hal Canary
95e3c058ef SkTypes.h : move SkAutoMalloc into SkAutoMalloc.h
* SkAutoFree moved to SkTemplates.h (now implmented with unique_ptr).

  * SkAutoMalloc and SkAutoSMalloc moved to SkAutoMalloc.h

  * "SkAutoFree X(sk_malloc_throw(N));" --> "SkAutoMalloc X(N);"

Revert "Revert 'SkTypes.h : move SkAutoMalloc into SkAutoMalloc.h'"
This reverts commit c456b73fef.

Change-Id: Ie2c1a17c20134b8ceab85a68b3ae3e61c24fbaab
Reviewed-on: https://skia-review.googlesource.com/6886
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2017-01-11 18:55:34 +00:00