Commit Graph

197 Commits

Author SHA1 Message Date
reed
b1b12f8666 handle large conic weights
BUG=627414
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2142393003

Review-Url: https://codereview.chromium.org/2142393003
2016-07-13 10:56:53 -07:00
halcanary
4dbbd04314 SkLeanWindows.h: #include "Windows.h" fewer places
$ git grep -l '<windows.h>' include src
    include/private/SkLeanWindows.h

    $ git grep -l SkLeanWindows.h | grep '\.h$'
    include/ports/SkTypeface_win.h
    include/utils/win/SkHRESULT.h
    include/utils/win/SkTScopedComPtr.h
    include/views/SkEvent.h
    src/core/SkMathPriv.h
    src/ports/SkTypeface_win_dw.h
    src/utils/SkThreadUtils_win.h
    src/utils/win/SkWGL.h

The same for  `#include <intrin.h>` that was found in SkMath.h.
Those functions that needed it are moved to SkMathPriv.h.

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2041943002

CQ_INCLUDE_TRYBOTS=tryserver.chromium.win:win_chromium_compile_dbg_ng,win_chromium_compile_rel_ng

Review-Url: https://codereview.chromium.org/2041943002
2016-06-07 17:21:10 -07:00
mbarbella
99600d0a15 Add a test to ensure that a case where SkCubicClipper::ChopMonoAtY returns 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
2016-06-01 15:39:48 -07:00
bsalomon
edc743a576 Add SkPathPriv::IsSimpleClosedRect
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
2016-06-01 09:42:31 -07:00
bsalomon
1978ce22eb Fix bug where SkPath will convert an arc to an oval and change the starting 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
2016-05-31 10:42:16 -07:00
bsalomon
78d58d1084 Make SkPath::isOval() and SkPath::isRRect return the orientation and 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
2016-05-27 09:17:04 -07:00
reed
e8f3062a36 switch surface to sk_sp
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1817383002
CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Ubuntu-GCC-x86_64-Release-CMake-Trybot,Build-Mac-Clang-x86_64-Release-CMake-Trybot

Review URL: https://codereview.chromium.org/1817383002
2016-03-23 18:59:25 -07:00
caryclark
8e7b19d0f0 add interp path
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
2016-02-18 04:11:49 -08:00
fs
b1475b0d41 Add SkPath::isLastContourClosed()
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
2016-01-20 09:51:08 -08:00
caryclark
ba25ddb7f2 fix nexus player
The path contains test has such large numbers that it is indeterminate
whether it will return true or false. Allow either result, ensuring
that the test itself doesn't crash.

TBR=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1565463002

Review URL: https://codereview.chromium.org/1565463002
2016-01-05 12:36:09 -08:00
caryclark
dbaec7323f give up on quad root if infinite
SkPath::contains() uses SkFindUnitQuadRoots to see
which side of a curve a point is on. If the
intermediate exceeds a float, return no found root.

R=reed@google.com
BUG=572406
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1556353002

Review URL: https://codereview.chromium.org/1556353002
2016-01-05 06:20:09 -08:00
caryclark
9cb5d755e7 fix bugs in path contains
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
2015-12-18 04:35:24 -08:00
fs
c91065d028 Use the unswapped end point y for early out case in winding_line
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
2015-12-17 09:03:28 -08:00
caryclark
9aacd9029c If a point is on a path edge, it's in the path, at least for all cases where 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
2015-12-14 08:38:09 -08:00
halcanary
6950de6c41 Comments Style: s/skbug.com/bug.skia.org/
DOCS_PREVIEW= https://skia.org/?cl=1432503003

Review URL: https://codereview.chromium.org/1432503003
2015-11-07 05:29:00 -08:00
halcanary
435657fd62 Forward declare SkStrokeRec in SkPathEffect
Review URL: https://codereview.chromium.org/1312163008
2015-09-15 12:53:07 -07:00
halcanary
96fcdcc219 Style Change: NULL->nullptr
DOCS_PREVIEW= https://skia.org/?cl=1316233002

Review URL: https://codereview.chromium.org/1316233002
2015-08-27 07:41:16 -07:00
halcanary
385fe4d4b6 Style Change: SkNEW->new; SkDELETE->delete
DOCS_PREVIEW= https://skia.org/?cl=1316123003

Review URL: https://codereview.chromium.org/1316123003
2015-08-26 13:07:49 -07:00
senorblanco
84cd621670 Implement caching of filled paths in the tessellated path renderer.
Paths are cached as tessellated triangle meshes in vertex buffers on the GPU. Stroked paths are not (yet) cached.

Paths containing no curved segments (linear paths) are reused at all scales. Paths containing curved segments are reused within a scale tolerance threshold.

In order to invalidate the cache when an SkPath is changed or deleted,
this required implementing genID change notification in SkPath. This is
modelled almost exactly on SkPixelRef::GenIDChangeListener.
However, It does not currently implement the check for unique genIDs,
so notifiers will fire when the first instance of an SkPathRef
using a given genID is destroyed.

Another caveat is that you cannot successfully add a change notifier
to an empty path, since it uses the "canonical" empty path which is
never modified or destroyed. For this reason, we prevent adding
listeners to it.

BUG=skia:4121,skia:4122, 497403
DOCS_PREVIEW= https://skia.org/?cl=1114353004

Committed: https://skia.googlesource.com/skia/+/468dfa72eb6694145487be17876804dfca3b7adb

Review URL: https://codereview.chromium.org/1114353004
2015-08-04 10:01:58 -07:00
mtklein
562a66b093 Revert "Implement caching of filled paths in the tessellated path renderer."
This reverts commit 468dfa72eb.

    This CL caused signficant GM diffs.

Revert "Fix resource cache test."
This reverts commit b001c41ed3.
Revert "Fix SkData leaks at GrResourceKey::setCustomData() call sites."
This reverts commit c369348aa5.

    These CLs depend on the first one.

BUG=skia:
TBR=bsalomon@google.com

Review URL: https://codereview.chromium.org/1260363007
2015-08-04 08:46:16 -07:00
senorblanco
468dfa72eb Implement caching of filled paths in the tessellated path renderer.
Paths are cached as tessellated triangle meshes in vertex buffers on the GPU. Stroked paths are not (yet) cached.

Paths containing no curved segments (linear paths) are reused at all scales. Paths containing curved segments are reused within a scale tolerance threshold.

In order to invalidate the cache when an SkPath is changed or deleted,
this required implementing genID change notification in SkPath. This is
modelled almost exactly on SkPixelRef::GenIDChangeListener.
However, It does not currently implement the check for unique genIDs,
so notifiers will fire when the first instance of an SkPathRef
using a given genID is destroyed.

Another caveat is that you cannot successfully add a change notifier
to an empty path, since it uses the "canonical" empty path which is
never modified or destroyed. For this reason, we prevent adding
listeners to it.

BUG=skia:4121,skia:4122, 497403
DOCS_PREVIEW= https://skia.org/?cl=1114353004

Review URL: https://codereview.chromium.org/1114353004
2015-08-03 13:04:03 -07:00
reed
3b2fb981ab rewrite path.getBounds test to work-around compiler bug
BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1262143002
2015-07-29 08:37:13 -07:00
reed
91f283bb4e change getBounds to return 0000 iff there are zero points
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
2015-07-28 06:00:50 -07:00
caryclark
e8c5666e03 Very tiny paths are subsumed by the Convexicator
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
2015-07-14 11:19:26 -07:00
reed
026beb52a2 SkPath::Direction serves two masters:
- 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
2015-06-10 14:23:15 -07:00
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