Commit Graph

6500 Commits

Author SHA1 Message Date
Mike Reed
212e9060ed don't use drawPosText
Skia can now build if we mark drawPosText as private,
Will hide/remove next (after Chrome CL)

Bug: skia:
Change-Id: I156560b025c119af302545bb5bd60678f7b8e8f7
Reviewed-on: https://skia-review.googlesource.com/c/179985
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2018-12-25 23:07:35 +00:00
Mike Reed
0951cc212c Revert "Reland "Revert "serialize fonts instead of paints"""
This reverts commit f4dd96c6b8.

Fix: restore flattening bounds (cc_unittests fail w/o this)
     not sure why this should matter...

Bug: skia:
Change-Id: I37c532b0e5e0c7be3c4cd0d272faa7109f12a5d9
Reviewed-on: https://skia-review.googlesource.com/c/179883
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-12-21 21:44:52 +00:00
Mike Reed
f4dd96c6b8 Reland "Revert "serialize fonts instead of paints""
This reverts commit 9803b8f1d1.

Reason for revert: break cc/paint/oop_pixeltest.cc ?

Original change's description:
> Revert "Revert "serialize fonts instead of paints""
> 
> This reverts commit 576633cf57.
> 
> Fix: add new version to both variants of SkReadBuffer
> 
> Bug: skia:
> Change-Id: I8ba60d374860718402328398a4a09b8c97d65e33
> Reviewed-on: https://skia-review.googlesource.com/c/179845
> Commit-Queue: Mike Reed <reed@google.com>
> Auto-Submit: Mike Reed <reed@google.com>
> Reviewed-by: Mike Reed <reed@google.com>

TBR=reed@google.com

Change-Id: Ic20b22ae305f9b22863f6f441d45457c4e565f66
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/179882
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-12-21 20:49:58 +00:00
Cary Clark
9d6049a96f fix pathops bug 8380
Paths to intersect have two nearly coincident cubics. Where they
cross, the intersection error makes the curves start at slightly
different points. To sort the intersection, one curve is translated
to the start of the opposite point, moving it from one side to the
other, introducing a winding error.

The fix looks for that error in a very tiny range (enlarging that
range causes other tests that now pass to fail). This fix is very
fragile and points to the need for a better approach than sorting
angles to find winding values, as documented in the bug.

Also renamed some angle functions to show that they operate only
on lines and not general curves.

All tests pass with this fix:
./out/release/pathops_unittest -V -x
./out/debug/pathops_unittest -V -x

TBR=reed@google.com
Bug: skia:8380
Change-Id: I04e53d4c6a96035f661a4c9f31a17055ce13e3eb
Reviewed-on: https://skia-review.googlesource.com/c/179241
Commit-Queue: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
2018-12-21 19:15:54 +00:00
Mike Reed
9803b8f1d1 Revert "Revert "serialize fonts instead of paints""
This reverts commit 576633cf57.

Fix: add new version to both variants of SkReadBuffer

Bug: skia:
Change-Id: I8ba60d374860718402328398a4a09b8c97d65e33
Reviewed-on: https://skia-review.googlesource.com/c/179845
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2018-12-21 16:13:57 +00:00
Mike Reed
576633cf57 Revert "serialize fonts instead of paints"
This reverts commit f1ae66bedd.

Reason for revert: need to guard for no-serialization builds (I think)

Original change's description:
> serialize fonts instead of paints
> 
> Some changes from before:
> - we don't force serializing a typeface if the field is null
> - we don't serialize the blob bounds (don't trust them)
> 
> Bug: skia:
> Change-Id: I41281b2aa63a1026de87330023346f1da5378c1f
> Reviewed-on: https://skia-review.googlesource.com/c/179735
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Reviewed-by: Herb Derby <herb@google.com>

TBR=bungeman@google.com,herb@google.com,fmalita@chromium.org,reed@google.com

Change-Id: Id891198bc683b9b5e7417a30c2f7adb0bd978e30
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/179843
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-12-21 15:35:57 +00:00
Mike Reed
f1ae66bedd serialize fonts instead of paints
Some changes from before:
- we don't force serializing a typeface if the field is null
- we don't serialize the blob bounds (don't trust them)

Bug: skia:
Change-Id: I41281b2aa63a1026de87330023346f1da5378c1f
Reviewed-on: https://skia-review.googlesource.com/c/179735
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Herb Derby <herb@google.com>
2018-12-21 14:59:17 +00:00
Hal Canary
d104cc4730 SkPDF: debugging flag SK_PDF_BASE85_BINARY applies to JPEG
Change-Id: I16e21d492df7de5d17fcce6070642e3e732b7d96
Reviewed-on: https://skia-review.googlesource.com/c/179727
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2018-12-21 14:34:58 +00:00
Mike Reed
df3d225e80 use SkFont for measuring and paths
Bug: skia:
Change-Id: I1810edfef6e04be0380bac0eeab5450fe302e078
Reviewed-on: https://skia-review.googlesource.com/c/179728
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-12-20 22:43:05 +00:00
Jim Van Verth
578b089986 Revert "Tweak Plot size to try to get better perf."
This reverts commit fdcbe206f5.

Reason for revert: Produced a further perf regression.

Original change's description:
> Tweak Plot size to try to get better perf.
> 
> Large plots allow tighter packing of large glyphs, but smaller plots
> take less time to update. Trying a size in between for the largest
> A8 size.
> 
> Bug: skia:8642
> Change-Id: Ib6d7651b70fe3a2101a3bfc5b367c433123cb914
> Reviewed-on: https://skia-review.googlesource.com/c/179242
> Commit-Queue: Jim Van Verth <jvanverth@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

TBR=jvanverth@google.com,robertphillips@google.com

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

Bug: skia:8642
Change-Id: I9bc32abfae1fb4a6380b2fd5c0a1ea269447c534
Reviewed-on: https://skia-review.googlesource.com/c/179726
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2018-12-20 21:16:54 +00:00
Mike Reed
30cf62bf48 add rsxform runs to textblobs
Bug: skia:
Change-Id: I72a1921a0300dfdac567e25acbdf20cc168ac0be
Reviewed-on: https://skia-review.googlesource.com/c/175834
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-12-20 16:46:09 +00:00
Hal Canary
748015840e SkPDF: SkPDFObject no longer reference-counted!
* sed 's/sk_sp<SkPDF\(Object\|Array\|Dict\)>/std::unique_ptr<SkPDF\1>/g'
  * Added SkPDFMakeDict()
  * Let SkPDFMakeArray() take zero arguments.

Bug: skia:8630

Change-Id: I08dc11e974f1d71e09a33af6bdbcb5f01b07d186
Reviewed-on: https://skia-review.googlesource.com/c/179063
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
2018-12-19 22:45:06 +00:00
Brian Salomon
614c1a838a Add idle texture callback mechanism.
A proc can be registered with a GrTexture. The proc will be called when
it is safe to delete the texture is "idle." Idle means it referred to
outside of GrResourceCache and that the I/O operations on the GPU are
completed (this latter part applieas to Vulkan only).

The intended use case for this is to call promise image texture release
procs once we start caching GrTextures for deinstantiated promise
images.

Bug= skia:8613

Change-Id: Idce9a4292fef7b15370a053060d8878a9d6828fa
Reviewed-on: https://skia-review.googlesource.com/c/178937
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-12-19 21:12:42 +00:00
Jim Van Verth
fdcbe206f5 Tweak Plot size to try to get better perf.
Large plots allow tighter packing of large glyphs, but smaller plots
take less time to update. Trying a size in between for the largest
A8 size.

Bug: skia:8642
Change-Id: Ib6d7651b70fe3a2101a3bfc5b367c433123cb914
Reviewed-on: https://skia-review.googlesource.com/c/179242
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2018-12-19 20:43:03 +00:00
Ethan Nicholas
92e01cfc82 added SPIR-V persistent cache support for Vulkan
Bug: skia:
Change-Id: Iec9053655f6ec2cc49a90c4b686995feaff6e488
Reviewed-on: https://skia-review.googlesource.com/c/178923
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2018-12-19 18:42:18 +00:00
Mike Reed
148b7fd3ad add saveBehind to canvas
Bug: skia:
Change-Id: I62e48b116b2d7efef585d4f465441f24ae4d2b29
Reviewed-on: https://skia-review.googlesource.com/c/177892
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-12-19 14:44:09 +00:00
Hal Canary
f34131ae9b SkPDF: even more PDFIndirectRefs
* SkPDFUnion.h hidden.
  * SkPDFObjectSerializer::serializeObject gone.
  * SkPDFDocument::serialize gone
  * SkPDFMetadata::MakeXMPObject return PDFIndirectRef
  * SkPDFTag rewritten from scratch.
  * SkPDFObject::addResources virtual gone.
  * SkPDFObject::drop virtual gone.
  * SkPDFArray::appendObjRef gone.
  * SkPDFDict::insertObjRef gone.
  * SkPDFDict::Record becomes std::pair
  * SkPDFObjNumMap gone;
  * SkPDFObject::fIndirectReference gone;

Bug: skia:8630
Change-Id: I7425eef30548b54f10fbfe96dd502800cb150caf
Reviewed-on: https://skia-review.googlesource.com/c/178935
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2018-12-19 03:20:42 +00:00
Mike Klein
dac694dbaf draw big images (with raster pipeline)
It's probably nicer to draw these images than not draw them.

Cq-Include-Trybots: luci.chromium.try:linux-blink-rel
Change-Id: I9f8df081c8256d345ad2d8bbbb30dbad982ad94e
Reviewed-on: https://skia-review.googlesource.com/c/178981
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2018-12-18 22:41:30 +00:00
Hal Canary
9a3f554154 SkPDF: refactor streams, experimental threading
All PDF Streams are immediatly serialized, and are never long-lived
    in memory.

    if EXPERIMENTAL fExecutor is set on the Document, streams are
    compressed in parallel.

    Results for PDFBigDocBench:

        without patch                    1807885.01 μs
        with    patch without executor   1802808.35 μs
        with    patch with    executor    246313.72 μs

    SkPDFStreamOut() function replaces SkPDFStream classes.

    Page resources are all serialized early.

    Several Document-level objects are serialzied early.

    SkUUID introduced as top-level object.

    Many {insert|append}ObjRef() converted to memory efficient
    {insert|append}Ref().

Bug: skia:8630
Change-Id: Ic336917d0c8b9ac1c2423b43bfe9b49a3533fbff
Reviewed-on: https://skia-review.googlesource.com/c/176588
Auto-Submit: Hal Canary <halcanary@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2018-12-18 20:48:25 +00:00
Mike Klein
7dfe6d9ea7 minor Sk4px cleanup
I've removed a bunch of unused code,
inlined routines that are only used once,
removed platform code where a portable code works fine,
and renamed methods and updated comments.

I'm thinking about getting rid of Sk4px entirely, and boiling it down
instead to a couple helper methods on Sk16b/Sk16h.  This is a start.

Change-Id: I35b6c44710aa2cefe8c1e07fc2cb877a4042e8a5
Reviewed-on: https://skia-review.googlesource.com/c/178985
Auto-Submit: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2018-12-18 20:46:25 +00:00
Brian Salomon
34a2030d0a Remove window rects flag from GrInternalSurfaceFlags.
This flag is annoying to set correctly when writing test code.
Fortunately it has become redundant with the "is GL FBO 0" flag.

Change-Id: Ifd88292d2d6ea05bfe0d269e853baff857e70bfe
Reviewed-on: https://skia-review.googlesource.com/c/178929
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-12-18 18:17:03 +00:00
Mike Reed
fb5f43b09f add regression test for stale fLastMoveToIndex
This test used to assert/fail under ASAN because copyPath's
fLastMoveToIndex was garbage after the internal copy (in SkPath::transform).
Now the code sets it to the src's value.

Bug:883596
Change-Id: I3cba82fb63398bf4aa0abc9d3f2a0067d8ad9006
Reviewed-on: https://skia-review.googlesource.com/c/178931
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2018-12-18 17:45:12 +00:00
Greg Daniel
b2a259cb3b Pass in clip bounds when creating a GpuDrawHandler for SkDrawable.
Bug: skia:
Change-Id: I2f79622aa9796e239e0487987e1fb2833055a99e
Reviewed-on: https://skia-review.googlesource.com/c/177891
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2018-12-18 14:46:09 +00:00
Robert Phillips
f54883cd90 Fix recording multiple DDLs from a single DDL Recorder (take 2)
The current system works if all the DDLs (generated from a single DDL Recorder) are all replayed into the same surface but would probably fail otherwise.

Change-Id: I07fb0ca9ecfb7a6aa27766bdb62e5b41311021d4
Reviewed-on: https://skia-review.googlesource.com/c/178900
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2018-12-18 14:41:44 +00:00
Robert Phillips
b67edbd12b Revert "Fix recording multiple DDLs from a single DDL Recorder"
This reverts commit 99e1709ef5.

Reason for revert: DDL failures

Original change's description:
> Fix recording multiple DDLs from a single DDL Recorder
> 
> The current system works if all the DDLs (generated from a single DDL Recorder) are all replayed into the same surface but would probably fail otherwise.
> 
> Change-Id: I0e76ecbf36aa3975049e4f48aaadd35b113a22eb
> Reviewed-on: https://skia-review.googlesource.com/c/178260
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

TBR=bsalomon@google.com,robertphillips@google.com

Change-Id: I958c0419647eee4be621bd09c2421ff3801ffe71
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/178860
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2018-12-18 12:45:11 +00:00
Robert Phillips
99e1709ef5 Fix recording multiple DDLs from a single DDL Recorder
The current system works if all the DDLs (generated from a single DDL Recorder) are all replayed into the same surface but would probably fail otherwise.

Change-Id: I0e76ecbf36aa3975049e4f48aaadd35b113a22eb
Reviewed-on: https://skia-review.googlesource.com/c/178260
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2018-12-17 21:54:40 +00:00
Herb Derby
e7f662b6cb Use SkFont in getOrCreateCache for RemoteGlyphCache
Change-Id: I784e85cb154be077a1ca1949d7806ac95269d8c8
Reviewed-on: https://skia-review.googlesource.com/c/178281
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2018-12-17 21:11:38 +00:00
Mike Reed
560d5b3cf1 use font to measure
Bug: skia:
Change-Id: I571de8f4234bd74c32fe8fba4f8726792b655c45
Reviewed-on: https://skia-review.googlesource.com/c/177887
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-12-16 22:02:40 +00:00
Mike Reed
ce5831e004 add paint param to measureText
Bug: skia:
Change-Id: I09ccb770ec37296e5e37b852296cead6cd23e00e
Reviewed-on: https://skia-review.googlesource.com/c/177884
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-12-16 20:16:53 +00:00
Mike Reed
2e6db18c43 use font instead of paint
Bug: skia:
Change-Id: I82b0b37c8e7b295df62cefb4053dcfeba1521e27
Reviewed-on: https://skia-review.googlesource.com/c/177803
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-12-15 19:11:13 +00:00
Brian Salomon
f391d0f771 Reduce the number of backend->pixelconfig GrCaps virtuals.
Moves method to get GrBackendFormat from GrBackendTexture from GrCaps
to GrBackendTexture so that a GrContext is not required.

Uses kUnknown_GrPixelConfig as failure return from GrCaps functions
rather than an GrPixelConfig* out param and bool result.

Having the texture type be part of GrBackendFormat made removing the
GrCaps function that goes from GrBackendRenderTarget to GrPixelConfig
awkward so that was left alone for now.

Change-Id: If9be0f898c538be4a7b24022b6011f63441a0317
Reviewed-on: https://skia-review.googlesource.com/c/175991
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-12-14 17:12:36 +00:00
Jim Van Verth
f6206f91b3 Add new method for calculating text atlas sizes
Uses a fixed quantized table to compute the ARGB texture dimensions,
and compute the A8 dimensions from that. Plot sizes are computed
based on the respective atlas's dimensions.

Bug: skia:
Change-Id: I28c56557094efa49d1a011a1d6145ef3a79b7cac
Reviewed-on: https://skia-review.googlesource.com/c/177068
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2018-12-14 13:53:11 +00:00
Mike Reed
42e7a7ed65 use SkFont for text
Bug: skia:
Change-Id: I75d4f2b9e6696099ef6b221f420e766cbca8f968
Reviewed-on: https://skia-review.googlesource.com/c/177682
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-12-14 02:50:00 +00:00
Cary Clark
21a7be0741 fix roll
Remove SkPathPriv::IsConvex() if SK_LEGACY_PATH_CONVEXITY
is defined to fix the Google3 roll.

TBR=ethannicholas@google.com

Bug: skia:
Change-Id: I2d2177213ec43dd048f15685d0afe49fb07656fe
Reviewed-on: https://skia-review.googlesource.com/c/177680
Commit-Queue: Cary Clark <caryclark@google.com>
Auto-Submit: Cary Clark <caryclark@google.com>
Reviewed-by: Cary Clark <caryclark@google.com>
2018-12-13 21:11:39 +00:00
Ethan Nicholas
8e265a7520 Re-land "Perform Vulkan resets in a background thread"
Bug: skia:
Change-Id: I1c7ec365a370137ca64d9091cb60e6430c3f1c28
Reviewed-on: https://skia-review.googlesource.com/c/177069
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2018-12-13 20:24:22 +00:00
Mike Reed
d839cfaa33 make ctor and setter consistent -- just take the typeface param as is
Bug: skia: 8626
Change-Id: Ia730c5e28039760f4e194d97abe892052509e735
Reviewed-on: https://skia-review.googlesource.com/c/177345
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-12-13 16:53:33 +00:00
Leon Scroggins III
762ff974c9 Add a test to imitate GIFImageDecoderTest.parseAndDecodeByteByByte
With skia_use_wuffs=true, calling getFrameCount after the partial
decode results in the full decode failing.

Bug: skia:8235
Change-Id: I9ac5496e3fecf309f1e303a8d3e8725a6d00731b
Reviewed-on: https://skia-review.googlesource.com/c/176590
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Nigel Tao <nigeltao@google.com>
2018-12-13 16:16:18 +00:00
Mike Reed
f9e824b8e7 use SkFont for textToGlyphs
Bug: skia:
Change-Id: Ifbbd3d99789c142ebd5b1ef2a149799a25c310a0
Reviewed-on: https://skia-review.googlesource.com/c/177343
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-12-13 15:58:36 +00:00
Cary Clark
3d6b438b99 remove legacy pathref validation
Chrome added a public method to validate SkPathRef,
but always called it when validating SkPath. We did too.

Remove the SkPathRef entry point, validate SkPathRef
when validating SkPath, and remove Skia's callers.
(Chrome has already been fixed.)

TBR=reed@google.com
R=fmalita@chromium.org

Bug:913930
Change-Id: I0828b00b42cc1f031b4216ddeace50f80aa21e62
Reviewed-on: https://skia-review.googlesource.com/c/177065
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-12-13 14:29:09 +00:00
Cary Clark
c9b7c720dd two pass convexity
This separates the existing convexity logic into
two passes. The first pass detects concavity by
counting the changes in direction.
The second pass computes the cross product to
see that all angles bend in the same direction, and
computes the dot product to see if the angle
doubles back on itself.

The second pass treats axis-aligned vectors
separately, and computes the dot and cross products
by comparing point values; it does not use arithmetic
to determine convexity, so it works with all finite
values.

A compile time switch enables returning concave
for co-linear diagonal points:
If successive points are not axis-aligned, and
those points are co-linear along a diagonal;
the path is treated as concave. This is conservative
but avoids paths that change convexity when the
are translated or scaled, since transforming the
path may cause the midpoint to shift to either
side of a line formed by the endpoints.

The compile time switch is set so that co-linear
diagonal points do not affect convexity. Note that
this permits shapes formerly considered concave, such
as stroked lines with round caps, to become convex;
this accounts for many of the GM differences.

A path may double back on itself and be convex;
for instance, a path containing a single line.

Path may have multiple initial moveTo verbs, or
trailing moveTo verbs, and still evaluate as convex.

A separate entry point, SkPathPriv::IsConvex()
allows passing an array of points instead of a path.

A legacy define has been checked into Chrome to
use the old code until layout tests have been
rebaselined.

R=reed@google.com,bsalomon@google.com
Bug:899689
Change-Id: I392bbe04836ffb19666ad92ab2a2404c56543019
Reviewed-on: https://skia-review.googlesource.com/c/173427
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Cary Clark <caryclark@skia.org>
2018-12-13 13:04:44 +00:00
Mike Reed
17c574a193 use font for measuring
Bug: skia:
Change-Id: Ie1cd247af06af515e078017d0716e345b1efc3fd
Reviewed-on: https://skia-review.googlesource.com/c/177076
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-12-12 23:47:15 +00:00
Ethan Nicholas
bff4e07398 Revert "Perform Vulkan resets in a background thread"
This reverts commit 30e6343b35.

Reason for revert: occasional failures

Original change's description:
> Perform Vulkan resets in a background thread
> 
> Bug: skia:
> Change-Id: I90783dc9ac2fcae560cd54e6c8c6df11d7195ac0
> Reviewed-on: https://skia-review.googlesource.com/c/168488
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>

TBR=egdaniel@google.com,ethannicholas@google.com

Change-Id: Iab0d65331c44fa8976bd35e5efea4b42174836b0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/177061
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2018-12-12 18:17:33 +00:00
Ethan Nicholas
30e6343b35 Perform Vulkan resets in a background thread
Bug: skia:
Change-Id: I90783dc9ac2fcae560cd54e6c8c6df11d7195ac0
Reviewed-on: https://skia-review.googlesource.com/c/168488
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2018-12-11 21:43:13 +00:00
Leon Scroggins III
b41321b584 Better testing of SkCodec to 565
If getPixels returns an unexpected result, do not create a digest
and compare it to digests for premul and unpremul.

Print a better error message, including the name of the image and
string versions of the SkCodec::Result.

Change-Id: Ie98e350a1ef91c0745fe9de0855192e5793e033c
Reviewed-on: https://skia-review.googlesource.com/c/176582
Auto-Submit: Leon Scroggins <scroggo@google.com>
Reviewed-by: Nigel Tao <nigeltao@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2018-12-11 21:12:42 +00:00
Mike Klein
1688507f83 Try out clang-tidy, starting with bugprone-use-after-move
- add drop-in clang-tidy cxx wrapper
 - get build clean for bugprone-use-after-move

The wrapper can be used by setting

   cxx = "/path/to/skia/tools/clang-tidy.sh"

in GN.

Change-Id: Idbba911e23bd6ef7530b08fd31906b92c1c1b28c
Reviewed-on: https://skia-review.googlesource.com/c/176523
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2018-12-11 17:28:19 +00:00
Mike Reed
22170b3178 Revert "Treat kWEBP encode with quality=100 as lossless"
This reverts commit e7f165be2e.

Reason for revert: doesn't compile in google3

Original change's description:
> Treat kWEBP encode with quality=100 as lossless
> 
> In SkEncodeImage and friends, treat quality of 100 as a lossless encode
> when using kWEBP. This seems a good fit for the intent - which is
> presumably to save the highest quality image. This also matches
> Chromium's blink::ImageEncoder::ComputeWebpOptions, which treats a
> quality of 1 (on a float scale from 0 to 1) as a lossless encode.
> 
> FWIW, Chromium has had this behavior since
> https://codereview.chromium.org/1937433002, in response to
> crbug.com/523098. The goal is to "maintain sharpness to
> match the JPEG encoder behavior (use WEBP lossless encoding)".
> 
> Add a test to verify the new behavior. This requires making tests
> depend on libwebp to use WebPGetFeatures, since the Skia API does not
> provide a way to determine whether an encoded webp file was encoded
> lossless-ly or lossily.
> 
> Bug: skia:8586
> Change-Id: Ie9e09c2f7414ab701d696c4ad9edf405868a716f
> Reviewed-on: https://skia-review.googlesource.com/c/175823
> Commit-Queue: Leon Scroggins <scroggo@google.com>
> Reviewed-by: Derek Sollenberger <djsollen@google.com>
> Reviewed-by: Mike Reed <reed@google.com>

TBR=djsollen@google.com,scroggo@google.com,reed@google.com

Change-Id: I91680f65a2a5e6f0a13b84e97c9541ebe0606b33
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:8586
Reviewed-on: https://skia-review.googlesource.com/c/176584
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-12-11 17:12:49 +00:00
Cary Clark
aa3b291717 bracket SkPath pathRefIsValid with define
Add defines around the places calls
SkPath::pathRefIsValid()

R=fmalita@chromium.org

Bug:913930
Change-Id: Iffaa85cecf127cf8cb405dffe76666f9184de76e
Reviewed-on: https://skia-review.googlesource.com/c/176583
Commit-Queue: Cary Clark <caryclark@skia.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-12-11 17:10:09 +00:00
Michael Ludwig
72ab3461b7 Consolidate stroke-rect ops and use GrFillRectOp instead of GrNonAA/AARectOp
Bug: skia:
Change-Id: Iee57bc970a026de2ad5a0758153e9cbb20753fa1
Reviewed-on: https://skia-review.googlesource.com/c/173105
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2018-12-11 16:33:35 +00:00
Leon Scroggins III
e7f165be2e Treat kWEBP encode with quality=100 as lossless
In SkEncodeImage and friends, treat quality of 100 as a lossless encode
when using kWEBP. This seems a good fit for the intent - which is
presumably to save the highest quality image. This also matches
Chromium's blink::ImageEncoder::ComputeWebpOptions, which treats a
quality of 1 (on a float scale from 0 to 1) as a lossless encode.

FWIW, Chromium has had this behavior since
https://codereview.chromium.org/1937433002, in response to
crbug.com/523098. The goal is to "maintain sharpness to
match the JPEG encoder behavior (use WEBP lossless encoding)".

Add a test to verify the new behavior. This requires making tests
depend on libwebp to use WebPGetFeatures, since the Skia API does not
provide a way to determine whether an encoded webp file was encoded
lossless-ly or lossily.

Bug: skia:8586
Change-Id: Ie9e09c2f7414ab701d696c4ad9edf405868a716f
Reviewed-on: https://skia-review.googlesource.com/c/175823
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2018-12-11 15:07:48 +00:00
Mike Reed
a0b54cd589 add test (and fix) for glyphsToUnichars
Bug: skia:
Change-Id: I2defcea7e9a37bdd203acc4ca97fc47a7f57cd43
Reviewed-on: https://skia-review.googlesource.com/c/176221
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-12-10 21:11:49 +00:00