Commit Graph

5451 Commits

Author SHA1 Message Date
Hal Canary
c5b9498891 SkPDF: consolidate two functions in SkPDFObjNumMap
Change-Id: Id815920e664ba986258867b7c35a7618a6927b0f
Reviewed-on: https://skia-review.googlesource.com/54360
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2017-10-10 16:41:13 +00:00
Ben Wagner
3f98552933 Small pathops cleanup.
Newer clang compiler produces the diagnostic

../../tests/PathOpsDebug.cpp:1349:44:
error: comparison of unsigned enum expression >= 0 is always true
[-Werror,-Wtautological-unsigned-enum-zero-compare]
        if (!firstOp && c->operand() && op >= 0) {

The check seems to be defending against bad values of SkPathOp, but
this now seems unnecessary. This also adds 'rdiff' to kPathOpStr for
future debugging.

Change-Id: I08e5ba77c56e519ce4d9ae89491f7ccd5eb7f944
Reviewed-on: https://skia-review.googlesource.com/57104
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2017-10-09 22:01:34 +00:00
Ben Wagner
63fd760a37 Remove trailing whitespace.
Also adds a presubmit to prevent adding trailing whitespace to source
code in the future.

Change-Id: I41a4df81487f6f00aa19b188f0cac6a3377efde6
Reviewed-on: https://skia-review.googlesource.com/57380
Reviewed-by: Ravi Mistry <rmistry@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2017-10-09 21:20:34 +00:00
Brian Salomon
7f56d3d2d8 Revert "Revert "Disable GL buffer mapping on TSAN/Mac.""
This reverts commit 4e7cdd5a00.

Bug: skia:7058
Change-Id: I3b92c35835cf7a8c04e9218194bf293b790413e0
Reviewed-on: https://skia-review.googlesource.com/57222
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-10-09 20:24:04 +00:00
Mike Reed
df071d7885 use new computeByteSize api
Bug: skia:
Change-Id: I92ddb7768ace21afa45b3c2b07db556bf42f4f50
Reviewed-on: https://skia-review.googlesource.com/57261
Reviewed-by: Derek Sollenberger <djsollen@google.com>
2017-10-09 17:18:07 +00:00
Ethan Nicholas
abff956455 initClassID no longer auto-allocates ids
Auto-allocated IDs mean that the IDs depend upon the order in which
classes happen to get initialized and are therefore not consistent
from run to run. This change paves the way for a persistent shader
cache by fixing the IDs in an enum.

Bug: skia:
Change-Id: I3e923c6c54f41b3b3eb616458abee83e0909c09f
Reviewed-on: https://skia-review.googlesource.com/56401
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-10-09 15:20:33 +00:00
Brian Salomon
4e7cdd5a00 Revert "Disable GL buffer mapping on TSAN/Mac."
This reverts commit c203e65265.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> Disable GL buffer mapping on TSAN/Mac.
> 
> Also reverts 65e7063796 which disabled buffer mapping in GrResourceProvider::createPatternedIndexBuffer.
> 
> Bug: skia:7058
> Change-Id: I6816abe53251e1cd8e92eae41b8cdbe45218a341
> Reviewed-on: https://skia-review.googlesource.com/50100
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

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

Change-Id: Icf0cf40ba4d6e7081971eee2eea0a41033790df7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:7058
Reviewed-on: https://skia-review.googlesource.com/57220
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-10-09 15:18:45 +00:00
Brian Salomon
c203e65265 Disable GL buffer mapping on TSAN/Mac.
Also reverts 65e7063796 which disabled buffer mapping in GrResourceProvider::createPatternedIndexBuffer.

Bug: skia:7058
Change-Id: I6816abe53251e1cd8e92eae41b8cdbe45218a341
Reviewed-on: https://skia-review.googlesource.com/50100
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-10-09 13:33:54 +00:00
Ben Wagner
67ef5d7640 Remove SkTypeface::Style use in API.
All known callers of SkTypeface::MakeDefault call it with kNormal and
the only users specifying kNormal explicitly are in Skia, so remove the
parameter. There appear to be no users of SkTypeface::MakeFromTypeface,
so remove it. The current alternative is SkFontMgr::matchFaceStyle which
can do a better job anyway.

Change-Id: I89d94c77f9593407b0a319786848a8b823fcbae4
Reviewed-on: https://skia-review.googlesource.com/56762
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2017-10-09 03:13:33 +00:00
Chris Dalton
cc604e5e9e CCPR: Add workaround for PowerVR crash
Bug: skia:
Change-Id: Icd00f81fda5366813f9c959fdc91b0415894cbfc
Reviewed-on: https://skia-review.googlesource.com/55360
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2017-10-06 22:48:59 +00:00
Greg Daniel
e1da1d9a7d Add option to create a deferred render target context with mips
We need this since we have texture generators that draw the base level
but nothing more. Thus we want them to be able to directly draw into
a pre allocated mipped target instead of doing a copy later.

TBR: bsalomon@google.com
Bug: skia:
Change-Id: I1dfae0da7153b21b30fdfa51a7061fc255739a1e
Reviewed-on: https://skia-review.googlesource.com/54100
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2017-10-06 20:28:00 +00:00
Chris Dalton
f1b47bb299 Add a cap for geometry shader invocations
Bug: skia:7116
Change-Id: I3cc2ce7b2e5123c9adfd9781b2a5a8553747dfa5
Reviewed-on: https://skia-review.googlesource.com/56000
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2017-10-06 18:43:06 +00:00
Chris Dalton
1265894423 Don't execute onFlush op lists until after GPU data is uploaded
Bug: skia:
Change-Id: Ide85e802fd6e6a19412457dbaded3545b962c240
Reviewed-on: https://skia-review.googlesource.com/55562
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2017-10-06 16:04:14 +00:00
Cary Clark
583dd2bbc0 add constexpr to SkRect, SkIRect Make functions
Also, doing so exposed a couple of unused
variables in tests.

R: bsalomon@google.com
Bug: skia: 6898
Change-Id: I7b065e26a838fe55a1d772bcefaef5325e1baa61
Reviewed-on: https://skia-review.googlesource.com/55680
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Cary Clark <caryclark@skia.org>
2017-10-05 16:55:34 +00:00
Brian Osman
b379dcd64e Sever fOriginalPath connection whenever a GrShape becomes a simple type
When drawing a round-rect, for example, we may end up in drawPath with a
temporary path that was created with the rrect added. We ended up putting
a genID listener on that (stack allocated) path, so we would evict cache
entries immediately. This restores the old behavior, where cache entries
for paths derived from simple types are never invalidated.

Bug: skia:7087
Change-Id: I3eed9c3a289241bfe1e42036be3362f592256693
Reviewed-on: https://skia-review.googlesource.com/54460
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-10-04 20:30:03 +00:00
Brian Osman
5fcd3913da Fix path renderer cache test logic to account for other resources
Bug: skia:
Change-Id: Iadf88cc07fac23544317166699138644218b38d1
Reviewed-on: https://skia-review.googlesource.com/55141
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-10-04 19:10:12 +00:00
Robert Phillips
fa8c080449 Use SK_DISABLE_DEFERRED_PROXIES to only disable deferred proxies for Chrome
This relies on https://chromium-review.googlesource.com/c/chromium/src/+/700475 (Readd SK_DISABLE_DEFERRED_PROXIES flag) landing in Chrome first.

It refines the changes made in: https://skia-review.googlesource.com/c/skia/+/54004 (Temporarily disable deferred texture proxies)

Change-Id: I12af50349516d32f74cd7f7dfd25a668284f64fa
Reviewed-on: https://skia-review.googlesource.com/55100
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-10-04 15:42:22 +00:00
Greg Daniel
c42b20b832 Revert "Revert "When flushing, reset flush state before op lists""
This reverts commit f8bc0018be.

Reason for revert: disabling failing test

Original change's description:
> Revert "When flushing, reset flush state before op lists"
> 
> This reverts commit 78bdee200c.
> 
> Reason for revert: breaking PathRendererCacheTests.cpp unit test
> 
> Original change's description:
> > When flushing, reset flush state before op lists
> > 
> > When we reset the flush state after executing the ops in a flush, we reset
> > the stored pipelines which may be holding refs to resources in their processors.
> > 
> > We want the resources that we wrote to in the op list to be freed last for caching
> > LRU purposes. Thus we make sure to free all the pipeline resources first before
> > resetting and freeing the op lists
> > 
> > Bug: skia:
> > Change-Id: I5b02e9b7532007b5854e906bf4d64e901e7e7e53
> > Reviewed-on: https://skia-review.googlesource.com/54760
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
> 
> TBR=egdaniel@google.com,robertphillips@google.com
> 
> Change-Id: If74a158e90316553a401386c8c7a6b3c2b29a7df
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:
> Reviewed-on: https://skia-review.googlesource.com/55080
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>

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

Bug: skia:
Change-Id: Ibdfe37c1f9e54956bf1725d1d7474a69efcd7673
Reviewed-on: https://skia-review.googlesource.com/55102
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2017-10-04 15:03:33 +00:00
Mike Reed
f0ffb8943b Revert[4] "guard old apis for querying byte-size of a bitmap/imageinfo/pixmap"
This reverts commit 5a2e50edc5.

Bug: skia:
Change-Id: I8d28b5c07d90130e5a1653923740eaf189ecb954
Reviewed-on: https://skia-review.googlesource.com/53900
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-10-03 20:03:35 +00:00
Ben Wagner
af89366cb8 Make SkString reference counting thread/TSAN safe.
BUG=skia:7107

Change-Id: I8ead98f7694faaed8e6f6f29b1fcd88501d36b66
Reviewed-on: https://skia-review.googlesource.com/54400
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2017-10-03 18:34:35 +00:00
Brian Osman
7ea46bf9d9 Remove test suppresion for ANGLE GLPrograms test
The NaN shader literal bug has been worked around, so lets get this test
coverage back.

Bug: skia:6842
Change-Id: I7b6b00972d9e00e49e5f2eccac9f2eda7fffbb6c
Reviewed-on: https://skia-review.googlesource.com/54362
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-10-03 17:42:05 +00:00
Robert Phillips
73f7e1dbdd Temporarily disable deferred texture proxies
Bug: 769760
Change-Id: Id4197a73737f3a8df9159d9eb081be094df1f731
Reviewed-on: https://skia-review.googlesource.com/54004
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2017-10-02 18:25:44 +00:00
Mike Reed
5a2e50edc5 Revert "Revert "Revert "guard old apis for querying byte-size of a bitmap/imageinfo/pixmap"""
This reverts commit cd284c5323.

Reason for revert:

assert fired in SkMallocPixelRef.cpp:61: fatal error: "assert(info.computeByteSize(rowBytes) == info.getSafeSize(rowBytes))"

google3 thinks it was from surface_rowbytes

Original change's description:
> Revert "Revert "guard old apis for querying byte-size of a bitmap/imageinfo/pixmap""
> 
> This reverts commit 809cbedd4b.
> 
> Bug: skia:
> Change-Id: I680d8daeeeeb15526b44c1305d8fb0c6bfa38e1d
> Reviewed-on: https://skia-review.googlesource.com/52665
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>

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

Change-Id: I41e3f7a3f791cc8183291847e783ed8a53bc91d2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/53802
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-10-02 13:44:18 +00:00
Mike Reed
cd284c5323 Revert "Revert "guard old apis for querying byte-size of a bitmap/imageinfo/pixmap""
This reverts commit 809cbedd4b.

Bug: skia:
Change-Id: I680d8daeeeeb15526b44c1305d8fb0c6bfa38e1d
Reviewed-on: https://skia-review.googlesource.com/52665
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2017-10-02 12:55:37 +00:00
Robert Phillips
3ec9573ac3 Add unit test for pinned SkImages
Change-Id: I2e14353bc865b5994cc90ad643a6a58604955957
Reviewed-on: https://skia-review.googlesource.com/53500
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-09-29 20:04:54 +00:00
Leon Scroggins III
4cdbf6056d Avoid uninitialized memory in readByteArrayAsData
Bug: 769134

readByteArray can fail (due to not having enough available or due to the
wrong alignment). If it does, do not return an uninitialized block of
memory.

Further, drop the initial size check, which is covered by readByteArray.

Add a test.

Change-Id: Ia101697c5bb1ca3ae3df1795f37a74b2f602797d
Reviewed-on: https://skia-review.googlesource.com/52742
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2017-09-28 19:51:32 +00:00
Chris Dalton
29011a2bda Remove tolerance form SkClassifyCubic
It's too inexact as-is. If the caller wants tolerance they can do
their own with knowledge of the pixel grid. The homogeneous math
is stable with infinities so it's really unnecessary here.

Bug: skia:7073
Change-Id: I4dc34ad96b859a138714b6d4f8804fec4f89f17a
Reviewed-on: https://skia-review.googlesource.com/51182
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2017-09-28 18:39:58 +00:00
Jim Van Verth
809cbedd4b Revert "guard old apis for querying byte-size of a bitmap/imageinfo/pixmap"
This reverts commit 88757dacd4.

Reason for revert: Still seems to be failing Chromium "telemetry_perf_unittests (with patch) on Android" on android_n5x_swarming_rel.

Original change's description:
> guard old apis for querying byte-size of a bitmap/imageinfo/pixmap
> 
> Now with legacy behavior for allocpixels
> 
> This was reverted, so the current CL is a "fix" on top of ...
> https://skia-review.googlesource.com/c/skia/+/50980
> 
> Related update to Chrome (in preparation for this change)
> https://chromium-review.googlesource.com/c/chromium/src/+/685719
> 
> Bug: skia:
> Change-Id: I4b370ee7e95083ab27421f008132219c9c7b86e9
> Reviewed-on: https://skia-review.googlesource.com/51341
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Mike Reed <reed@google.com>

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

Change-Id: I827a0ca1d1e3909e648fde3342cdb8601d34da8d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/52381
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2017-09-27 23:15:07 +00:00
Chris Blume
0b5e7d16c2 Treat invalid indices as transparent in gifs
Other browsers (including old Chrome) treat invalid palette indices as
transparent for gifs. And there are gifs in the wild which rely on this.

As an example, if the palette only has 64 entries (0-63) then index 64
is treated as transparent.

BUG=skia:7069

Change-Id: I15e8919a953387506c9ac5945c3ae6a2b90189ab
Reviewed-on: https://skia-review.googlesource.com/51100
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Chris Blume <cblume@google.com>
2017-09-27 21:03:41 +00:00
Leon Scroggins III
e56774602c Fix truncated webp images
Bug: b/65290323

If a webp file is truncated such that no rows can be decoded,
WebPIDecGetRGB does not initialize its "last_y" parameter. We use
rowsDecoded (passed as last_y) to determine which remaining rows to
fill.

Check the return value of WebPIDecGetRGB. If it fails (returns null),
or rowsDecoded is <= 0 (matching Chromium's check), return
kInvalidInput, since there is nothing to draw.

Note that this is a change in behavior for Android. Previously we
would decode an empty webp to just a transparent/black rectangle,
whereas now we simply fail. I think this is a change for the better.

Add a test which truncates a file to have 0 rows available and attempts
to decode it. msan verifies that we no longer depend on the
uninitialized value.

Stop attempting to test decoding subsets from an incomplete webp (in
CodecTest.cpp). Unless we have decoded the portion covered by the
subset, this will fail.

Remove test images inc0.webp (from both dm/ and colorspace/) and
inc1.webp. These just decode to transparent rectangles. Replace them
with inc2.webp and inc3.webp, which decode part of the image and then
have to fill with transparent.

Change-Id: I64d40be91c574b45963f9a43d8dd8f4929dd2939
Reviewed-on: https://skia-review.googlesource.com/50303
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: James Zern <jzern@google.com>
2017-09-27 20:51:02 +00:00
Brian Osman
28c434b807 Handle instantiation of proxies with pending invalidation messages
Bug: skia:
Change-Id: Id6808734df2335c521d4a563122ceeca906b7601
Reviewed-on: https://skia-review.googlesource.com/52002
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-09-27 17:38:38 +00:00
Mike Reed
88757dacd4 guard old apis for querying byte-size of a bitmap/imageinfo/pixmap
Now with legacy behavior for allocpixels

This was reverted, so the current CL is a "fix" on top of ...
https://skia-review.googlesource.com/c/skia/+/50980

Related update to Chrome (in preparation for this change)
https://chromium-review.googlesource.com/c/chromium/src/+/685719

Bug: skia:
Change-Id: I4b370ee7e95083ab27421f008132219c9c7b86e9
Reviewed-on: https://skia-review.googlesource.com/51341
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2017-09-27 14:36:07 +00:00
Ethan Nicholas
fa7ee2447e changed vertex attribute precisions to be actual types
Bug: skia:
Change-Id: Ic5555d9f1be7f24655bdea9f2a3677bfb128ef70
Reviewed-on: https://skia-review.googlesource.com/50221
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2017-09-27 14:04:17 +00:00
Greg Daniel
f46633f8af Revert "guard old apis for querying byte-size of a bitmap/imageinfo/pixmap"
This reverts commit 98a6216b18.

Reason for revert: breaking the chrome roll. Looks like they may be writing data to create an image across all the row bytes and thus writing to unalloced data on the last row. Link to example failing bot:
 https://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_ng/builds/539960

Original change's description:
> guard old apis for querying byte-size of a bitmap/imageinfo/pixmap
> 
> Previously we had size_t and uint64_t variations.
> 
> The new (simpler) API always..
> - returns size_t, or 0 if the calculation overflowed
> - returns the trimmed size (does not include rowBytes padding for the last row)
> 
> Bug: skia:
> Change-Id: I05173e877918327c7b207d2f7f1ab0db36892e2e
> Reviewed-on: https://skia-review.googlesource.com/50980
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Reviewed-by: Leon Scroggins <scroggo@google.com>

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

Change-Id: I726f6ab1b36b14979ba6f37105e0a469b3f0dbc0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/51262
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2017-09-26 20:08:07 +00:00
Ethan Nicholas
bed683addb switched gl_Position and gl_PointSize to sk_*
Bug: skia:
Change-Id: Ie7508991aa975c1400bac23ae49d81041a313968
Reviewed-on: https://skia-review.googlesource.com/51320
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2017-09-26 19:17:46 +00:00
Brian Osman
e9242ca695 Invalidate textures cached by SW path renderer when paths go away
Bug: skia:
Change-Id: Icfc2f1bd57c0cf7be54469b6d86cbd436b59155d
Reviewed-on: https://skia-review.googlesource.com/51201
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-09-26 19:07:46 +00:00
Greg Daniel
e2d76d5ffe Remove fIsMipMapped from GrSurfaceDesc
Part 3 of 3 for relanding of https://skia-review.googlesource.com/c/skia/+/42083

Bug: skia:
Change-Id: I98c5406015213df5d11a0101df8722da6845157e
Reviewed-on: https://skia-review.googlesource.com/44464
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2017-09-26 18:17:37 +00:00
Greg Daniel
cd87140111 Add ability to remove unique key from proxy and underlying surface.
Bug: skia:
Change-Id: I66b891ce9ca35906fdbddb36f565b35b25825112
Reviewed-on: https://skia-review.googlesource.com/51240
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2017-09-26 17:11:21 +00:00
Mike Reed
98a6216b18 guard old apis for querying byte-size of a bitmap/imageinfo/pixmap
Previously we had size_t and uint64_t variations.

The new (simpler) API always..
- returns size_t, or 0 if the calculation overflowed
- returns the trimmed size (does not include rowBytes padding for the last row)

Bug: skia:
Change-Id: I05173e877918327c7b207d2f7f1ab0db36892e2e
Reviewed-on: https://skia-review.googlesource.com/50980
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2017-09-26 17:07:16 +00:00
Greg Daniel
90f28ec3da Add some asserts and explict setting of fIsMipMapped
Part 2 of 3 for relanding of https://skia-review.googlesource.com/c/skia/+/42083

Bug: skia:
Change-Id: Iddc2571d88486531c76ab47432c2a51f2ac79043
Reviewed-on: https://skia-review.googlesource.com/44463
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-09-26 15:17:07 +00:00
Mike Reed
592273965a Revert "Revert "migrate to sk_sp for SkFontMgr API""
This reverts commit f40ae1a4b5.

Bug: skia:
Change-Id: I752606de92ea405d6e50219c98030409b00a2841
Reviewed-on: https://skia-review.googlesource.com/51160
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-09-26 14:05:18 +00:00
Brian Osman
f6f7cf6098 Invalidate path VBs when paths are destroyed
For this to work, we need access to the "original" path,
before any style was applied. To that end, add an original
path to GrShape (and unit tests of that functionality).

Then add a version of addGenIDChangeListener to GrShape,
that propagates to the original path, and use that in
tessellating path renderer.

Includes unit tests of caching behavior in the PR, all
of which failed without this change.

Bug: skia:
Change-Id: I98bb505f521e8ff07184f5c3fbd3c5fd1a22d3d5
Reviewed-on: https://skia-review.googlesource.com/50300
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-09-26 12:52:36 +00:00
Mike Reed
f40ae1a4b5 Revert "migrate to sk_sp for SkFontMgr API"
This reverts commit 4bf296be28.

Reason for revert: need guard for flutter

Original change's description:
> migrate to sk_sp for SkFontMgr API
> 
> Bug: skia:
> Change-Id: I1bf2a13537f67938cdc9956080065d10ea0bd1d8
> Reviewed-on: https://skia-review.googlesource.com/48740
> Commit-Queue: Ben Wagner <bungeman@google.com>
> Reviewed-by: Ben Wagner <bungeman@google.com>

TBR=bungeman@google.com,reed@google.com

Change-Id: Ib0b2d00fcbcdb6131444f94d1046df6dae24f551
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/50940
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-09-25 20:00:41 +00:00
Mike Reed
4bf296be28 migrate to sk_sp for SkFontMgr API
Bug: skia:
Change-Id: I1bf2a13537f67938cdc9956080065d10ea0bd1d8
Reviewed-on: https://skia-review.googlesource.com/48740
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2017-09-25 19:45:09 +00:00
Xianzhu Wang
b449666fa2 Reland "Fix SkImageSource::filterBounds()" again
This relands commit cb4d587666
which was reverted by commit b6d2be1330
because the original CL broke some blink layout tests, and the first
reland was reverted by commit because it broke filterfastbounds gm.

This reland let SkImageSource::onFilterNodeBounds() return the dst rect
with ctm applied when mapping forward or otherwise the default value.

Original description:

> Previously SkImageSource::filterBounds() uses the default
> SkImageFilter::onFilterNodeBounds() which returns the input rect.
>
> Now override onFilterNodeBounds() in SkImageSource to return src
> or dst rect (with transform applied).

Change-Id: I4548981142b9a96beda8339d394cf9943c9f4c0f
Reviewed-on: https://skia-review.googlesource.com/50420
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2017-09-25 19:05:20 +00:00
Mike Klein
f3b4e16c36 Fold clamp_{x,y} into the gathers.
All three image tile modes go through exclusive_clamp() and then a
gather today, so we can move the work of exclusive_clamp() into eac
gather_ stage, eliminating the need for clamp_{x,y} stages.

Luckily, we've got a convenient place to bottleneck this, ptr_and_ix(),
which works out the pointer and vector of indices to load for gathers.

This deletes SkRasterPipeline_repeat_tiling unit test, which now
no longer exactly makes sense.  It tests that repeat_x does that
clamp, but that's now done automatically outside that stage.

Change-Id: I24637ef60921bec7aa00082984c0c6a49dd86ca9
Reviewed-on: https://skia-review.googlesource.com/50260
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2017-09-22 22:06:08 +00:00
Ethan Nicholas
8aa4569c13 switched SkSL's temporary 'highfloat' type back to 'float'
Bug: skia:
Change-Id: If0debae7318b6b5b4a7cb85d458996a09931127e
Reviewed-on: https://skia-review.googlesource.com/48760
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-09-22 13:54:38 +00:00
Robert Phillips
c0192e346c Remove pre-attachment of stencil buffers
Change-Id: I4ef555a2b36cf3a0ec74e0ecf7e8ab4f8779df3e
Reviewed-on: https://skia-review.googlesource.com/49740
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-09-21 16:42:41 +00:00
Robert Phillips
ae7d3f3992 Add native caching of uniquely keyed GrTextureProxies (take 2)
TBR=bsalomon@google.com

Change-Id: I590dcdc85fb60706c7eb06277694791dc04c9141
Reviewed-on: https://skia-review.googlesource.com/49543
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-09-21 13:52:10 +00:00
Jim Van Verth
311cc6b39a Another attempt to fix TSAN
Change-Id: I1d6aebcd679a406a13911f4b91f72f4198fc8dc1
Reviewed-on: https://skia-review.googlesource.com/49461
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2017-09-20 22:30:19 +00:00
Robert Phillips
76d640d14e Revert "Add native caching of uniquely keyed GrTextureProxies"
This reverts commit d4f100dad9.

Reason for revert: ASAN

Original change's description:
> Add native caching of uniquely keyed GrTextureProxies
> 
> Change-Id: I303fe025b7856b8d681a2d35b416c015bd468e1d
> Reviewed-on: https://skia-review.googlesource.com/48300
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

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

Change-Id: I7bbf549d4855ce6d985867c3880eef80080bd3d1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/49442
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-09-20 20:50:50 +00:00
Mike Reed
0ca21466da remove dead code for STREAM_API
Bug: skia:
Change-Id: I5c5a65710af443c60a3d13fb309ce31309be7f74
Reviewed-on: https://skia-review.googlesource.com/49460
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-09-20 20:43:50 +00:00
Robert Phillips
d4f100dad9 Add native caching of uniquely keyed GrTextureProxies
Change-Id: I303fe025b7856b8d681a2d35b416c015bd468e1d
Reviewed-on: https://skia-review.googlesource.com/48300
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-09-20 20:21:50 +00:00
Jim Van Verth
32bbf377e6 Fix TSAN issue with atlas expansion.
Removes SkString-related malloc from DM crash handler, and adds null check in ProxyRefTest.

Bug: skia:3550
Change-Id: I143c532b5d231a426b1a96b854e1effd6379b673
Reviewed-on: https://skia-review.googlesource.com/48440
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2017-09-20 17:46:59 +00:00
Brian Salomon
fb6a789191 Extra safety for SkRRect.
This moves closer to ensuring that all SkRRects are valid. It also checks for validity of deserialized SkRRects and sets the SkRRect to empty if the serialized data is invalid rather than asserting.

It is still possible to use mutators to create invalid SkRRects (e.g. outset() by large number, translate() so that type changes due to fp precision).


Bug: skia:
Change-Id: Ice5f73a020e99739ef4b3ce362181d3dbb35701c
Reviewed-on: https://skia-review.googlesource.com/49220
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-09-20 15:24:43 +00:00
Brian Osman
9a725dd948 Use shader based blending to clamp kPlus mode w/F16
Bug: skia:6173
Change-Id: I21042d484d9a7b3eee04aa3301d9793d00ad6908
Reviewed-on: https://skia-review.googlesource.com/48183
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-09-20 14:28:03 +00:00
Florin Malita
2ad0908b67 Revert "Reland "Fix SkImageSource::filterBounds()""
This reverts commit bf12c07970.

Reason for revert: broke the filterfastbounds GM (2nd column, 5th & 7th rows)

Original change's description:
> Reland "Fix SkImageSource::filterBounds()"
> 
> This relands commit cb4d587666
> which was reverted by commit b6d2be1330
> because the original CL broke some blink layout tests.
> 
> This reland let SkImageSource::filterBounds() return the dst rect with
> ctm applied regardless of direction.
> 
> Original description:
> 
> > Previously SkImageSource::filterBounds() uses the default
> > SkImageFilter::onFilterNodeBounds() which returns the input rect.
> >
> > Now override onFilterNodeBounds() in SkImageSource to return src
> > or dst rect (with transform applied).
> 
> Change-Id: I915b7889ff59829ddbc4479cd66d75a0bb581e54
> Reviewed-on: https://skia-review.googlesource.com/47501
> Commit-Queue: Stephen White <senorblanco@chromium.org>
> Reviewed-by: Stephen White <senorblanco@chromium.org>

TBR=senorblanco@chromium.org,reed@google.com,wangxianzhu@chromium.org

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

Change-Id: I698433de66cf3de145b9319e09cb9ec9e30d2fa9
Reviewed-on: https://skia-review.googlesource.com/48160
Reviewed-by: Florin Malita <fmalita@chromium.org>
2017-09-18 20:52:21 +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
Ethan Nicholas
f7b8820dc8 re-land of new SkSL precisions
Bug: skia:
Change-Id: Ic1deb3db2cbda6ca45f93dee99832971a36a2119
Reviewed-on: https://skia-review.googlesource.com/47841
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2017-09-18 18:32:13 +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
Ethan Nicholas
27185a9b97 Revert "Revert "Revert "Switched highp float to highfloat and mediump float to half."""
This reverts commit 05d5a13fea.

Reason for revert: looks like it broke filterfastbounds

Original change's description:
> Revert "Revert "Switched highp float to highfloat and mediump float to half.""
> 
> This reverts commit 1d816b92bb.
> 
> Bug: skia:
> Change-Id: I388b5e5e9bf619db48297a80c9a80c039f26c9f1
> Reviewed-on: https://skia-review.googlesource.com/46464
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>

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

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

Bug: skia:
Change-Id: Iddf6aef2ab084aa73da7ceebdfc303a1d2b80cde
Reviewed-on: https://skia-review.googlesource.com/47441
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2017-09-18 03:01:47 +00:00
Ethan Nicholas
56fbbd6580 Revert "Minor fixes to SkSL precisions"
This reverts commit 9752c3c307.

Reason for revert: prerequisite to reverting 05d5a13fea

Original change's description:
> Minor fixes to SkSL precisions
> 
> No-Presubmit: true
> No-Tree-Checks: true
> Bug: skia:
> Change-Id: Ife95d3ba457f79c00bf4fdd54af898a3a50402aa
> Reviewed-on: https://skia-review.googlesource.com/47241
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>

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

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

Bug: skia:
Change-Id: Ib1ef28bc94263154e54c01fd172d83ee48a797a8
Reviewed-on: https://skia-review.googlesource.com/47720
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2017-09-18 02:24:07 +00:00
Xianzhu Wang
bf12c07970 Reland "Fix SkImageSource::filterBounds()"
This relands commit cb4d587666
which was reverted by commit b6d2be1330
because the original CL broke some blink layout tests.

This reland let SkImageSource::filterBounds() return the dst rect with
ctm applied regardless of direction.

Original description:

> Previously SkImageSource::filterBounds() uses the default
> SkImageFilter::onFilterNodeBounds() which returns the input rect.
>
> Now override onFilterNodeBounds() in SkImageSource to return src
> or dst rect (with transform applied).

Change-Id: I915b7889ff59829ddbc4479cd66d75a0bb581e54
Reviewed-on: https://skia-review.googlesource.com/47501
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2017-09-16 18:55:53 +00:00
Mike Klein
f757ae6aa7 Retry, Bump stored lowp uniform color to 16-bit storage.
This makes loading into 16-bit channels more natural in _lowp.cpp.
Update a unit test to stop using out-of-range "colors".

Change-Id: I494687aac87948b60a40de447aa1527cf7167b2d
Cq-Include-Trybots: skia.primary:Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-UBSAN_float_cast_overflow
Reviewed-on: https://skia-review.googlesource.com/47580
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-09-16 02:25:23 +00:00
Mike Reed
98c5d92ee6 Revert "Revert "use unique_ptr for stream api""
This reverts commit 7031b247c9.

Bug: skia:
Change-Id: I24c34bbee703f02994be8e206bcb9c10b5427d84
Reviewed-on: https://skia-review.googlesource.com/47541
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-09-16 02:04:23 +00:00
Mike Klein
7e4e99386f Implement some easy _lowp stages.
- load_565 allows 565-src sprite blits
  - scale_565 / lerp_565 allow subpixel text
  - luminance_to_alpha is a color filter, and lets us write grey 8

And update CachedDecodingPixelRefTest with a yet more robust color.

Change-Id: I8af499c43f0f28093744d9c2993af553e36c9526
Reviewed-on: https://skia-review.googlesource.com/47021
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2017-09-16 01:07:34 +00:00
Ethan Nicholas
9752c3c307 Minor fixes to SkSL precisions
No-Presubmit: true
No-Tree-Checks: true
Bug: skia:
Change-Id: Ife95d3ba457f79c00bf4fdd54af898a3a50402aa
Reviewed-on: https://skia-review.googlesource.com/47241
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2017-09-15 21:22:54 +00:00
Mike Reed
7031b247c9 Revert "use unique_ptr for stream api"
This reverts commit 49f1f34438.

Reason for revert: broke win-chrome

../../third_party/skia/src/ports/SkFontMgr_win_dw.cpp(89): error C2228: left of '.release' must have class/struct/union
../../third_party/skia/src/ports/SkFontMgr_win_dw.cpp(89): note: type is 'SkStreamAsset *'
../../third_party/skia/src/ports/SkFontMgr_win_dw.cpp(89): note: did you intend to use '->' instead?


Original change's description:
> use unique_ptr for stream api
> 
> Bug: skia:6888
> Change-Id: I3459b4913982a7cae1c0061697c82cc65ad9a2d8
> Reviewed-on: https://skia-review.googlesource.com/26740
> Reviewed-by: Mike Klein <mtklein@chromium.org>
> Commit-Queue: Mike Reed <reed@google.com>

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

Change-Id: Ic1e4af557317abd06b7f6b7f5056645df7e469f0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:6888
Reviewed-on: https://skia-review.googlesource.com/47440
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-09-15 21:04:07 +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
Mike Reed
b6d2be1330 Revert "Fix SkImageSource::filterBounds()"
This reverts commit cb4d587666.

Reason for revert: speculative fix for broken layout tests

https://storage.googleapis.com/chromium-layout-test-archives/linux_chromium_rel_ng/547101/layout-test-results/results.html

+fast/css/transformed-mask.html		images diff	image	pass
+svg/W3C-SVG-1.1-SE/filters-image-03-f.svg		images diff	image	pass
+svg/W3C-SVG-1.1-SE/filters-image-05-f.svg		images diff	image	pass
+svg/W3C-SVG-1.1/filters-displace-01-f.svg		images diff	image	pass
+svg/filters/feImage-preserveAspectRatio-all.svg		images diff	image	pass
+svg/filters/feImage-preserveAspectratio.svg		images diff	image	pass

Original change's description:
> Fix SkImageSource::filterBounds()
> 
> Previously SkImageSource::filterBounds() uses the default
> SkImageFilter::onFilterNodeBounds() which returns the input rect.
> 
> Now override onFilterNodeBounds() in SkImageSource to return src
> or dst rect (with transform applied).
> 
> Change-Id: I6681e1ba97affb09ef1ca5bc03b3d0f66c10f149
> Reviewed-on: https://skia-review.googlesource.com/46741
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Mike Reed <reed@google.com>

TBR=senorblanco@chromium.org,reed@google.com,wangxianzhu@chromium.org

Change-Id: Ib335f8e2ccbadc2335d23bc5f122fc5de53a8740
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/47342
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-09-15 20:30:36 +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
Ethan Nicholas
05d5a13fea Revert "Revert "Switched highp float to highfloat and mediump float to half.""
This reverts commit 1d816b92bb.

Bug: skia:
Change-Id: I388b5e5e9bf619db48297a80c9a80c039f26c9f1
Reviewed-on: https://skia-review.googlesource.com/46464
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2017-09-15 18:50:54 +00:00
Mike Reed
49f1f34438 use unique_ptr for stream api
Bug: skia:6888
Change-Id: I3459b4913982a7cae1c0061697c82cc65ad9a2d8
Reviewed-on: https://skia-review.googlesource.com/26740
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2017-09-15 18:46:45 +00:00
Xianzhu Wang
cb4d587666 Fix SkImageSource::filterBounds()
Previously SkImageSource::filterBounds() uses the default
SkImageFilter::onFilterNodeBounds() which returns the input rect.

Now override onFilterNodeBounds() in SkImageSource to return src
or dst rect (with transform applied).

Change-Id: I6681e1ba97affb09ef1ca5bc03b3d0f66c10f149
Reviewed-on: https://skia-review.googlesource.com/46741
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2017-09-15 17:15:54 +00:00
Cary Clark
a4083c97d4 make most of SkColorPriv.h private
created new file src/core/SkColorData.h for
internal consumption. Note that many of the
functions there are unused as well.

Bug: skia: 6898
R: reed@google.com
Change-Id: I25bfd5a9c21f53558c4ca65a77eb5d322d897c6d
Reviewed-on: https://skia-review.googlesource.com/46848
Commit-Queue: Cary Clark <caryclark@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2017-09-15 16:31:35 +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
Robert Phillips
f1748f5a92 Change visitProxies signature
There is a perf regression (mainly on the Nexus5) for the https://skia-review.googlesource.com/c/skia/+/46200 (Add method to iterate over a GrOp's GrSurfaceProxies)

This is one candidate.

Change-Id: I995d3a88bad2a914f24b49512abbf01aeaf579c8
Reviewed-on: https://skia-review.googlesource.com/46586
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-09-14 20:39:42 +00:00
Robert Phillips
5f567c78dd Finish restoring GrOpList DAG
Change-Id: I2a674ce7442a444a78a53144279e88ba744eaf48
Reviewed-on: https://skia-review.googlesource.com/46462
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-09-14 13:02:31 +00:00
Robert Phillips
09dfc4759e Pull non-substantive changes out of explicit GPU resource allocation CL
Change-Id: Ib6a289553ecd15c722599b7dc0d347a7800801cb
Reviewed-on: https://skia-review.googlesource.com/46284
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-09-13 19:49:47 +00:00
Robert Phillips
b493eebca1 Add method to iterate over a GrOp's GrSurfaceProxies
The extra generality of having a std::function is for MDB reordering. In the current MDB reordering world there is one pass through the surfaceProxies at creation time and a second pass after flush to create the usage intervals.

Change-Id: I3f548417eddc1dad7503d919241301e404255ffe
Reviewed-on: https://skia-review.googlesource.com/46200
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-09-13 17:38:56 +00:00
Chris Dalton
db91c6e7fb Improve heuristics for when to use ccpr
Gives the convex and tessellating renderers first claim on larger
paths, and the distance field renderer first claim on complex,
non-volatile paths. This also requires plumbing the clip bounds
through GrPathRenderer::CanDrawPathArgs.

Bug: skia:
Change-Id: I16e1d35ad5ee63251e33f113b1579cbba60456da
Reviewed-on: https://skia-review.googlesource.com/42224
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2017-09-12 20:04:20 +00:00
Xianzhu Wang
0fa353c6c2 Optimize filterBounds() of SkArithmeticImageFilter/SkXfermodeImageFilter
This brings the optimization in blink's FEComposit::MapRect() [1]
into skia.

Previously for these classes we used the default SkImageFilter::
onFilterBounds() which returns the union of the bounds of input filters.
However, this was not optimized if some input filters don't contribute
to the output. When we switch blink SPv2 paint invalidation from using
blink's FilterOperations to cc/skia's filter classes, the non-
optimization caused over-raster-invalidations.

Now override SkImageFilter::onFilterBounds() in these classes to make
their filterBounds() return the same results as the blink counterparts.

Also fix a bug of SkArithmeticImageFilter when k4 is non-zero by
overriding affectsTransparentBlack() to return true in the case, so
that we will use the crop as the final bounds.

[1] https://cs.chromium.org/chromium/src/third_party/WebKit/Source/platform/graphics/filters/FEComposite.cpp?l=115

Change-Id: I91d4cadc267e6262ee3f050a0ddac90154419775
Reviewed-on: https://skia-review.googlesource.com/38921
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2017-09-12 18:01:31 +00:00
Ethan Nicholas
5b5f096a03 Revert "Revert "Switch to the new SkSL lexer.""
This reverts commit 358515491a.

Bug: skia:
Change-Id: I013fac0ed83774d8ae7c6ee6819045cab37f5e97
Reviewed-on: https://skia-review.googlesource.com/45180
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2017-09-11 21:45:20 +00:00
Brian Osman
5d034744ab Do software clip mask generation with worker threads
Also refactor the prepare callback stuff to share logic
between software path rendering and clip mask generation.

Bug: skia:
Change-Id: I0c56c6df8703eb59d2d49a4c3985bd4f5ef20f01
Reviewed-on: https://skia-review.googlesource.com/44421
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2017-09-11 17:58:00 +00:00
Ethan Nicholas
358515491a Revert "Switch to the new SkSL lexer."
This reverts commit c576e93d17.

Reason for revert: ASAN failures

Original change's description:
> Switch to the new SkSL lexer.
> 
> This completely replaces flex with a new in-house lexical analyzer generator,
> which we have done for performance and memory usage reasons. Flex requires us
> to copy strings every time we need the text of a token, whereas this new lexer
> allows us to handle strings as a (non-null-terminated) pointer and length
> everywhere, eliminating most string copies.
> 
> Bug: skia:
> Change-Id: I2add26efc9e20cb699520e82abcf713af3968aca
> Reviewed-on: https://skia-review.googlesource.com/39780
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>

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

Change-Id: If27b750a5f696d06a6bcffed12fe9f0598e084a6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/44881
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2017-09-11 16:34:02 +00:00
Ethan Nicholas
c576e93d17 Switch to the new SkSL lexer.
This completely replaces flex with a new in-house lexical analyzer generator,
which we have done for performance and memory usage reasons. Flex requires us
to copy strings every time we need the text of a token, whereas this new lexer
allows us to handle strings as a (non-null-terminated) pointer and length
everywhere, eliminating most string copies.

Bug: skia:
Change-Id: I2add26efc9e20cb699520e82abcf713af3968aca
Reviewed-on: https://skia-review.googlesource.com/39780
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2017-09-11 16:17:00 +00:00
Greg Daniel
21918231b2 Revert "Remove isMipMapped from GrSurfaceDesc" and follow up find exact scratch CL
This reverts commit 52cb5fe23b.
This reverts commit e1fbf17058.

TBR:bsalomon@googole.com

Bug: chromium:763333
Change-Id: Ie94e00c3c7231e32f009b9dc7bb51ebb53baf7b1
Reviewed-on: https://skia-review.googlesource.com/44400
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2017-09-08 19:58:18 +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
Brian Salomon
2bbdcc44c6 Rework GrSamplerParams to be more compact and use its own wrap mode enum.
The main change is to make GrSamplerParams smaller by making its enums have byte-sized underlying types. The rest is cosmetic.

Change-Id: Ib71ea50612d24619a85e463826c6b8dfb9b445e3
Reviewed-on: https://skia-review.googlesource.com/43200
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2017-09-07 16:58:31 +00:00
Brian Salomon
4df0092eac Revert "Remove "content" rect from GrTextureAdjuster."
This reverts commit 6e4bbbefe1.

Reason for revert: assertion failure

Original change's description:
> Remove "content" rect from GrTextureAdjuster.
> 
> Since we got rid of texture-backed bitmaps this is no longer required.
> 
> Change-Id: Id15c745994a3d6a1489e193b5d29916fa0931264
> Reviewed-on: https://skia-review.googlesource.com/36340
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

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

Change-Id: I2229ec05079368ff196ff351107f88062080e5ec
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/43720
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-09-07 16:34:22 +00:00
Brian Salomon
6e4bbbefe1 Remove "content" rect from GrTextureAdjuster.
Since we got rid of texture-backed bitmaps this is no longer required.

Change-Id: Id15c745994a3d6a1489e193b5d29916fa0931264
Reviewed-on: https://skia-review.googlesource.com/36340
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2017-09-07 16:02:51 +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
Greg Daniel
52cb5fe23b Remove isMipMapped from GrSurfaceDesc
Bug: skia:
Change-Id: Id3864aad7ff9636362c9c54ef411a02af9c83fbf
Reviewed-on: https://skia-review.googlesource.com/42083
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2017-09-06 14:41:18 +00:00
Cary Clark
38702ab43b possible fix for pathops timeout
fuzzer causes pathops to loop
somewhere finding complex
intersections, but does not
have a reproducible test case.

Somewhat grasping at straws,
the failing condition in this
CL was triggered by the fuzzer
tests, but may or may not be
related to the hang.

TBR=reed@google.com
Bug: 754434
Change-Id: Ia8edc0709cec559b277ed83a5ad6feb67d8088c6
Reviewed-on: https://skia-review.googlesource.com/42780
Reviewed-by: Cary Clark <caryclark@skia.org>
Commit-Queue: Cary Clark <caryclark@skia.org>
2017-09-06 14:40:18 +00:00
Mike Klein
022cfa258d Add FIFO thread pool, use it for most things.
We like a LIFO default thread pool in tools like DM for better
memory/time locality... the bots use less memory this way, and
generally run faster.

But most use cases want a FIFO queue, so that they can get going
on the next parts of early work while later work is still running.

This splits the implementation into one using SkTArray and pop_back
for LIFO, and a new one using std::deque and pop_front for FIFO.

Change-Id: Ief203b6869a00f1f8084019431a781d15fc63750
Reviewed-on: https://skia-review.googlesource.com/41849
Commit-Queue: Mike Klein <mtklein@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Yuqian Li <liyuqian@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2017-09-01 16:19:47 +00:00
Brian Salomon
4f40caf33e Add methods for converting GrShape to filled style
Bug: skia:
Change-Id: I6726428d1358909972adec8d63686b637ef5bb5e
Reviewed-on: https://skia-review.googlesource.com/40222
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-09-01 15:31:37 +00:00
Brian Salomon
085c0862f6 Revert "Revert "Add a GrShape::Type value for an inverted empty path""
This reverts commit 07f5b71f99.

Bug: skia:
Change-Id: I14cc34ab563028a4a24de2112575ab4516f1c7c7
Reviewed-on: https://skia-review.googlesource.com/41441
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-08-31 20:02:40 +00:00
Brian Salomon
07f5b71f99 Revert "Add a GrShape::Type value for an inverted empty path"
This reverts commit d5a3f7f967.

Reason for revert: GMs changed

Original change's description:
> Add a GrShape::Type value for an inverted empty path
> 
> Change-Id: Ib34a608db07a2ff1d7bdfbd96867fa5ff0ac9782
> Reviewed-on: https://skia-review.googlesource.com/41540
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

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

Change-Id: I320dcda62bdb08163fe274325a38f59dd51b3927
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/41640
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-08-31 19:24:20 +00:00
Brian Salomon
d5a3f7f967 Add a GrShape::Type value for an inverted empty path
Change-Id: Ib34a608db07a2ff1d7bdfbd96867fa5ff0ac9782
Reviewed-on: https://skia-review.googlesource.com/41540
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-08-31 18:14:21 +00:00
Robert Phillips
f95b175246 Retract Gr*Priv.h includes a bit
Change-Id: Ic2bfd83b6e6bcc5ea1591427683085637eb5a6cc
Reviewed-on: https://skia-review.googlesource.com/41360
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-08-31 14:13:03 +00:00
Brian Salomon
f3b46e5193 Rename methods and enum on SkClipStack::Element to indicate "device space"
Change-Id: I83056843b530f76590f755f97e3d0a5a58f371fa
Reviewed-on: https://skia-review.googlesource.com/39402
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2017-08-30 15:58:12 +00:00
Brian Osman
f9810666bd Threaded generation of software paths
Re-land of: https://skia-review.googlesource.com/36560

All information needed by the thread is captured by the prepare
callback object, the lambda captures a pointer to that, and does the
mask render. Once it's done, it signals the semaphore (also owned by the
callback). The callback defers the semaphore wait even longer (into the
ASAP upload), so the odds of waiting for the thread are REALLY low.

Also did a bunch of cleanup along the way, and put in some trace markers
so we can monitor how well this is working.

Traces of a GM that includes GPU and SW path rendering (path-reverse):

Original:
    https://screenshot.googleplex.com/f5BG3901tQg.png
Threaded, with wait in the callback (notice pre flush callback blocking):
    https://screenshot.googleplex.com/htOSZFE2s04.png
Current version, with wait deferred to ASAP upload function:
    https://screenshot.googleplex.com/GHjD0U3C34q.png
Bug: skia:
Change-Id: Idb92f385590749f41328a9aec65b2a93f4775079
Reviewed-on: https://skia-review.googlesource.com/40775
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-08-30 15:27:42 +00:00
Robert Phillips
fb4a20c7f5 Remove kDefault_GrSurfaceOrigin
Change-Id: Ic55d488287add32e5a32b5a77415e16cebf4c1ee
Reviewed-on: https://skia-review.googlesource.com/29120
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-08-30 11:30:32 +00:00
Robert Phillips
b0e93a22bb Remove origin field from GrSurface (take 2)
This mainly consists of rm origin from GrSurface and the wrapBackEnd*
methods and then re-adding an explicit origin parameter to all the
GrGpu methods that need it.

TBR=bsalomon@google.com

Change-Id: I4248b2a4749ef844da4233ce53b0dc504bc9eb74
Reviewed-on: https://skia-review.googlesource.com/30280
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-08-29 17:36:31 +00:00
Chris Dalton
7732f4f8f2 Add missing methods to neon/sse SkNx implementations
Adds negate, abs, sqrt to Sk2f and/or Sk4f.

Bug: skia:
Change-Id: I0688dae45b32ff94abcc0525ef1f09d666f9c6e9
Reviewed-on: https://skia-review.googlesource.com/39642
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2017-08-28 21:21:36 +00:00
Mike Reed
3c2d09f89a change SkRect::growToInclude to take a point instead of x,y
This avoids the dangerous overload problem of

growToInclude(0, 0)

matching to (const SkPoint[], count) rather than growToInclude(x, y)

Bug: skia:
Change-Id: Iaba8b1a579638ff363fde62e4e3004052dd2b2ac
Reviewed-on: https://skia-review.googlesource.com/39501
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-08-28 17:54:06 +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
Greg Daniel
6888c0d40c Add support for vkCmdCopyBuffer
This is then used when need to update GPU only buffers with data of size
greater than 65536. We create a temporary transfer buffer and then copy
that buffer into our GPU buffer.

Bug: skia:
Change-Id: I4bb9cb660f2ac1ccbbd1b508bb4ca6876342136f
Reviewed-on: https://skia-review.googlesource.com/38725
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2017-08-25 17:03:07 +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
Brian Salomon
87ae989569 Revert "Threaded generation of software paths"
This reverts commit 76323bc061.

Reason for revert: Breaking NUC bots in threaded gm comparison:

https://chromium-swarm.appspot.com/task?id=382e589753187f10&refresh=10



Original change's description:
> Threaded generation of software paths
> 
> All information needed by the thread is captured by the prepare
> callback object, the lambda captures a pointer to that, and does the
> mask render. Once it's done, it signals the semaphore (also owned by the
> callback). The callback defers the semaphore wait even longer (into the
> ASAP upload), so the odds of waiting for the thread are REALLY low.
> 
> Also did a bunch of cleanup along the way, and put in some trace markers
> so we can monitor how well this is working.
> 
> Traces of a GM that includes GPU and SW path rendering (path-reverse):
> 
> Original:
>     https://screenshot.googleplex.com/f5BG3901tQg.png
> Threaded, with wait in the callback (notice pre flush callback blocking):
>     https://screenshot.googleplex.com/htOSZFE2s04.png
> Current version, with wait deferred to ASAP upload function:
>     https://screenshot.googleplex.com/GHjD0U3C34q.png
> 
> Bug: skia:
> Change-Id: I3d5a230bbd68eb35e1f0574b308485c691435790
> Reviewed-on: https://skia-review.googlesource.com/36560
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

TBR=egdaniel@google.com,mtklein@google.com,bsalomon@google.com,robertphillips@google.com,brianosman@google.com

Change-Id: Icac0918a3771859f671b69ae07ae0fedd3ebb3db
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/38560
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-08-24 21:34:38 +00:00
Greg Daniel
500d58b2a6 Make Copy Ops to go through GpuCommandBuffer instead of straigt to GPU.
Bug: skia:
Change-Id: I4eae4507e07278997e26419e94586eef0780c423
Reviewed-on: https://skia-review.googlesource.com/38361
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2017-08-24 20:18:27 +00:00
Brian Osman
76323bc061 Threaded generation of software paths
All information needed by the thread is captured by the prepare
callback object, the lambda captures a pointer to that, and does the
mask render. Once it's done, it signals the semaphore (also owned by the
callback). The callback defers the semaphore wait even longer (into the
ASAP upload), so the odds of waiting for the thread are REALLY low.

Also did a bunch of cleanup along the way, and put in some trace markers
so we can monitor how well this is working.

Traces of a GM that includes GPU and SW path rendering (path-reverse):

Original:
    https://screenshot.googleplex.com/f5BG3901tQg.png
Threaded, with wait in the callback (notice pre flush callback blocking):
    https://screenshot.googleplex.com/htOSZFE2s04.png
Current version, with wait deferred to ASAP upload function:
    https://screenshot.googleplex.com/GHjD0U3C34q.png

Bug: skia:
Change-Id: I3d5a230bbd68eb35e1f0574b308485c691435790
Reviewed-on: https://skia-review.googlesource.com/36560
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-08-24 15:22:57 +00:00
Stephen White
73e7f80aa1 GrTessellator: when sanitizing contours, remove non-finite points.
NaNs can't be correctly sorted.

Don't run the unit test on VK backend, since it requires large (>64K bytes) vertex buffer uploads.

Bug: 757650
Change-Id: I667693f135a090a5d9076bb7a2ec6879fc06d645
Reviewed-on: https://skia-review.googlesource.com/37484
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2017-08-23 18:19:46 +00:00
Brian Osman
5127998795 Add an (optional) SkTaskGroup to GrContext
GrContextOptions has an SkExecutor field, allowing clients to supply a
thread pool. If present, the GrContext will create an SkTaskGroup that
can be used for internal threading work.

Bug: skia:
Change-Id: I8b01245515a21a83f9fe838caf0a01c9a26c0003
Reviewed-on: https://skia-review.googlesource.com/37580
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-08-23 14:33:25 +00:00
Robert Phillips
9d9022477f Revert "GrTessellator: when sanitizing contours, remove non-finite points."
This reverts commit 620cc24851.

Reason for revert: Breaking the Vulkan bots

Original change's description:
> GrTessellator: when sanitizing contours, remove non-finite points.
> 
> NaNs can't be correctly sorted.
> 
> Bug: 757650
> Change-Id: Id1ca2fe1d1de7884da2a64ceef9491b1da7e8e77
> Reviewed-on: https://skia-review.googlesource.com/37220
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Stephen White <senorblanco@chromium.org>

TBR=bsalomon@google.com,senorblanco@chromium.org

Change-Id: I64d5c35801f844b31745a9c7ff60812d96af5e55
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 757650
Reviewed-on: https://skia-review.googlesource.com/37540
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-08-23 13:03:17 +00:00
Stephen White
620cc24851 GrTessellator: when sanitizing contours, remove non-finite points.
NaNs can't be correctly sorted.

Bug: 757650
Change-Id: Id1ca2fe1d1de7884da2a64ceef9491b1da7e8e77
Reviewed-on: https://skia-review.googlesource.com/37220
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2017-08-22 18:38:37 +00:00
Leon Scroggins III
ae79f32e79 Call initializeColorXform inside SkCodec
Make initializeColorXform private, and only call in the base class.
Add virtual method to skip initializeColorXform, for classes that do
not need one.

Change SkCodec::FrameInfo's SkAlphaType to an SkEncodedInfo::Alpha.
This allows proper checking internally whether SkCodec needs to do a
color correct premultiply.

Depends on https://chromium-review.googlesource.com/c/620947, for this
API change.

(Separated from review.skia.org/25746)

Bug: skia:5609
Bug: skia:6839
Change-Id: Icb0d46659c546060c34d32eaf792c86708726c7a
Reviewed-on: https://skia-review.googlesource.com/35880
Reviewed-by: Chris Blume <cblume@chromium.org>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2017-08-18 19:46:59 +00:00
Leon Scroggins III
04be2b54ba Reland "skia: add heif decoding support"
This reverts commit db68a426b6.

Fixes errors in Android and Google3

Bug: b/64077740
Change-Id: I3d2bb1223e4d8ba912ea2b88144aeecc487fce1a
Reviewed-on: https://skia-review.googlesource.com/35701
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Chong Zhang <chz@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
2017-08-18 14:40:29 +00:00
Leon Scroggins III
0741818e7a Move calls to conversion_possible to SkCodec
Move common code into the base class, so subclasses need not call
conversion_possible.

Use SkEncodedInfo rather than SkImageInfo, and use the proper frame.

API Changes:
- SkAndroidCodec:
  - Add getEncodedInfo(), for SkBitmapRegionCodec
- SkEncodedInfo:
  - Add opaque() helper
- SkBitmapRegionDecoder:
  - Remove unused conversionSupported

(Split off from skia-review.googlesource.com/c/25746)

Bug: skia:5601
Change-Id: If4a40d4b98a3dd0afde2b6058f92315a393a5baf
Reviewed-on: https://skia-review.googlesource.com/34361
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2017-08-17 16:09:31 +00:00
Brian Salomon
1d816b92bb Revert "Switched highp float to highfloat and mediump float to half."
This reverts commit 88d99c6387.

Reason for revert: Believed to be causing unit test failures in Chrome roll:

https://build.chromium.org/p/tryserver.chromium.android/builders/linux_android_rel_ng/builds/364433
https://luci-logdog.appspot.com/v/?s=chromium%2Fbb%2Ftryserver.chromium.android%2Flinux_android_rel_ng%2F364433%2F%2B%2Frecipes%2Fsteps%2Fcontent_browsertests__with_patch__on_Android%2F0%2Flogs%2FWebRtcCaptureFromElementBrowserTest.VerifyCanvasWebGLCaptureColor%2F0

Original change's description:
> Switched highp float to highfloat and mediump float to half.
> 
> The ultimate goal is to end up with "float" and "half", but this
> intermediate step uses "highfloat" so that it is clear if I missed a
> "float" somewhere. Once this lands, a subsequent CL will switch all
> "highfloats" back to "floats".
> 
> Bug: skia:
> Change-Id: Ia13225c7a0a0a2901e07665891c473d2500ddcca
> Reviewed-on: https://skia-review.googlesource.com/31000
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

TBR=bsalomon@google.com,csmartdalton@google.com,ethannicholas@google.com

Change-Id: I8bfa97547ac3920d433665f161d27df3f15c83aa
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/35705
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-08-17 15:08:17 +00:00
Brian Salomon
23f92277b9 Revert "fixed constant vector swizzling"
This reverts commit 8ac36a577f.

Reason for revert: Need to revert 88d99c6387

Original change's description:
> fixed constant vector swizzling
> 
> Bug: skia:
> Change-Id: I2d205bf7242d2223c4939c3e7897db9aba02c705
> Reviewed-on: https://skia-review.googlesource.com/35640
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>

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

Change-Id: I0b0ee62b9173beed9513947244e37d5a528f85a3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/35704
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-08-17 14:58:48 +00:00
Mike Klein
db68a426b6 Revert "skia: add heif decoding support"
This reverts commit c2a954290d.

Reason for revert: both Android and Google3 rolls cannot compile.  Android cannot cast std::unique_ptr<T> to T*, Google3 cannot find HeifDecoderAPI.h.

Original change's description:
> skia: add heif decoding support
> 
> Bug: b/64077740
> Change-Id: I11e0243bcc4c21c0aa5aa29a719dd0fcba7ae6f7
> Reviewed-on: https://skia-review.googlesource.com/35123
> Reviewed-by: Chong Zhang <chz@google.com>
> Reviewed-by: Leon Scroggins <scroggo@google.com>
> Commit-Queue: Chong Zhang <chz@google.com>
> Commit-Queue: Leon Scroggins <scroggo@google.com>

TBR=scroggo@google.com,chz@google.com

Change-Id: Id98f025e63daec50408186000453d1695170f7a8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: b/64077740
Reviewed-on: https://skia-review.googlesource.com/35741
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2017-08-17 13:34:07 +00:00
Ethan Nicholas
8ac36a577f fixed constant vector swizzling
Bug: skia:
Change-Id: I2d205bf7242d2223c4939c3e7897db9aba02c705
Reviewed-on: https://skia-review.googlesource.com/35640
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2017-08-17 02:23:35 +00:00
Ethan Nicholas
88d99c6387 Switched highp float to highfloat and mediump float to half.
The ultimate goal is to end up with "float" and "half", but this
intermediate step uses "highfloat" so that it is clear if I missed a
"float" somewhere. Once this lands, a subsequent CL will switch all
"highfloats" back to "floats".

Bug: skia:
Change-Id: Ia13225c7a0a0a2901e07665891c473d2500ddcca
Reviewed-on: https://skia-review.googlesource.com/31000
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-08-16 23:05:15 +00:00
Chong Zhang
c2a954290d skia: add heif decoding support
Bug: b/64077740
Change-Id: I11e0243bcc4c21c0aa5aa29a719dd0fcba7ae6f7
Reviewed-on: https://skia-review.googlesource.com/35123
Reviewed-by: Chong Zhang <chz@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Chong Zhang <chz@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2017-08-16 20:22:55 +00:00
Mike Klein
43344289fc cut down GrShapeTest stack usage
- use make_TestCase() to put the temporaries on the heap
 - scope temporary SkPaths tighter
 - spin off a couple of the low-hanging independent tests
   into their own DEF_TESTs

Looks like these together are enough to stay in Google3
stack frames even after enabling exceptions.

Change-Id: I614fdd11357449ac1668b8dfaa4f0d88828d07a2
Reviewed-on: https://skia-review.googlesource.com/35420
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2017-08-16 17:28:26 +00:00
Ben Wagner
b4aab9ae6d Replace SkFAIL with SK_ABORT.
SkFAIL is a legacy macro which is just SK_ABORT. This CL mechanically
changes uses of SkFAIL to SK_ABORT in preparation for its removal. The
related sk_throw macro will be changed independently, due to needing to
actually clean up its users.

Change-Id: Id70b5c111a02d2458dc60c8933f444df27d9cebb
Reviewed-on: https://skia-review.googlesource.com/35284
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2017-08-16 15:37:54 +00:00
Brian Salomon
7f23543d1d Minor geometry processor clarification.
Some renames, comments, and override->final

Change-Id: Iebc7aeee9a64021e958f76bf4278ffff56884a56
Reviewed-on: https://skia-review.googlesource.com/35165
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-08-16 14:32:28 +00:00
Stephen White
3f5301b284 GrTessellator: fix for collinear out-of-range intersections.
Change 3b5a3fa8b1 introduced support
for out-of-range intersections, which is necessary when the top and
bottom vertices of an edge differ by only one ULP in the primary sort
order and can't be split in-order.

However, some out-of-range intersections produce edges which cancel
each other out on splitting, in particular when the intersection is
collinear with the newly-computed edge. This undoes the effect of the
split.  The tessellator then rewinds, re-detects the intersection, resplits,
an infinite loop.

The fix is to check for out-of-range intersections which are also
collinear, and ignore them. This is ok, because these are not
the cases we care about it change 3b5a3f above, which are
never collinear.

Bug: 753867
Change-Id: I590231e0e6f19c98f1ccf46cb7acc8a63ba35a9d
Reviewed-on: https://skia-review.googlesource.com/34925
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2017-08-16 13:52:48 +00:00
Mike Klein
228276dabf Revert "Turn on exceptions in test tools."
This reverts commit c667dff58d.

Reason for revert: temporary while I fix Android, Google3.

Original change's description:
> Turn on exceptions in test tools.
> 
> This allows us to test things that, e.g., throw std::bad_alloc.
> 
> Change-Id: I6409159b89f1d93d403b1a1f40539cf2531a8b68
> Reviewed-on: https://skia-review.googlesource.com/34982
> Reviewed-by: Herb Derby <herb@google.com>
> Commit-Queue: Mike Klein <mtklein@chromium.org>

TBR=mtklein@chromium.org,herb@google.com

Change-Id: Iafdc34c5f70f99f7df3cd0bbad65eed0828453a1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/35081
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2017-08-16 13:20:29 +00:00
Mike Klein
c667dff58d Turn on exceptions in test tools.
This allows us to test things that, e.g., throw std::bad_alloc.

Change-Id: I6409159b89f1d93d403b1a1f40539cf2531a8b68
Reviewed-on: https://skia-review.googlesource.com/34982
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-08-16 01:49:07 +00:00
Florin Malita
32491566da Revert "Fix bogus math in object allocation."
This reverts commit 0bc4d60fe0.

Reason for revert: https://chromium-swarm.appspot.com/task?id=38007b6df51fef10&refresh=10

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
Caught signal 6 [Aborted], was running:
	8888 image scanline_kNonNative_premul interlaced3.png
	unit test  ArenaAllocReallyBigAlloc
	unit test  ClampRange
	565 image scaled_codec_premul_0.200 interlaced3.png_0.200
	unit test  ClipStack
Likely culprit:
	unit test  ArenaAllocReallyBigAlloc
Stack trace:
    /mnt/pd0/s/w/ir/out/Debug/dm(+0x2381c1) [0x567aa1c1]
    linux-gate.so.1(__kernel_sigreturn+0) [0xf770cca0]
    linux-gate.so.1(__kernel_vsyscall+0x9) [0xf770cc89]
    /lib/i386-linux-gnu/libc.so.6(gsignal+0xb0) [0xf7027dc0]
    /lib/i386-linux-gnu/libc.so.6(abort+0x157) [0xf7029287]
    /usr/lib/i386-linux-gnu/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x16f) [0xf729d2ff]
    /usr/lib/i386-linux-gnu/libstdc++.so.6(+0x71ea4) [0xf729aea4]
    /usr/lib/i386-linux-gnu/libstdc++.so.6(+0x71f1d) [0xf729af1d]
    /usr/lib/i386-linux-gnu/libstdc++.so.6(__cxa_rethrow+0) [0xf729b1d0]
    /usr/lib/i386-linux-gnu/libstdc++.so.6(+0x727ff) [0xf729b7ff]
    /usr/lib/i386-linux-gnu/libstdc++.so.6(_Znaj+0x18) [0xf729b898]
    /mnt/pd0/s/w/ir/out/Debug/dm(_ZN12SkArenaAlloc11ensureSpaceEjj+0xa0) [0x56f113a6]
    /mnt/pd0/s/w/ir/out/Debug/dm(+0x3c2462) [0x56934462]
    /mnt/pd0/s/w/ir/out/Debug/dm(+0x239acb) [0x567abacb]
    /mnt/pd0/s/w/ir/out/Debug/dm(+0x239bdc) [0x567abbdc]
    /mnt/pd0/s/w/ir/out/Debug/dm(+0xa6417b) [0x56fd617b]
    /mnt/pd0/s/w/ir/out/Debug/dm(_ZNKSt8functionIFvvEEclEv+0x20) [0x56f10504]
    /mnt/pd0/s/w/ir/out/Debug/dm(_ZN12SkThreadPool4LoopEPv+0x298) [0x56f10bdb]
    /mnt/pd0/s/w/ir/out/Debug/dm(+0xb39700) [0x570ab700]
    /lib/i386-linux-gnu/libpthread.so.0(+0x627a) [0xf76df27a]
    /lib/i386-linux-gnu/libc.so.6(clone+0x66) [0xf70e3b56]
Aborted
Command exited with code 134

Original change's description:
> Fix bogus math in object allocation.
> 
> When a size_t is convert from a very large number to ptrdiff_t, it
> becomes negative causing the existing block to be used instead of
> allocating a new block.
> 
> BUG=chromium:744109
> 
> Change-Id: I0bf98e3fb924851c162f6eca43d29a3f40dc9eaa
> Reviewed-on: https://skia-review.googlesource.com/34541
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Commit-Queue: Herb Derby <herb@google.com>

TBR=bungeman@google.com,herb@google.com

Change-Id: I8ce2b45d13178395247dabd7af6853354399721c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:744109
Reviewed-on: https://skia-review.googlesource.com/35000
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-08-15 21:07:19 +00:00
Herb Derby
0bc4d60fe0 Fix bogus math in object allocation.
When a size_t is convert from a very large number to ptrdiff_t, it
becomes negative causing the existing block to be used instead of
allocating a new block.

BUG=chromium:744109

Change-Id: I0bf98e3fb924851c162f6eca43d29a3f40dc9eaa
Reviewed-on: https://skia-review.googlesource.com/34541
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2017-08-15 20:40:27 +00:00
Brian Osman
72a37bed66 Fix string typing in generated code
Bug: skia:
Change-Id: Ifbccc6d6880522177ac7a0ae2183be64a3ebfe50
Reviewed-on: https://skia-review.googlesource.com/34681
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2017-08-15 13:41:26 +00:00
Brian Osman
93ba0a4fc8 Switch SkSL to std::string
On desktop, this saves just over 5% of the time in the SkSL compiler.

As written, the code will now build either way, so it's much easier to
switch back (or even have some platforms use SkString, if that's ever
required).

Bug: skia:
Change-Id: I634f26a4f6fcb404e59bda6a5c6a21a9c6d73c0b
Reviewed-on: https://skia-review.googlesource.com/34381
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-08-14 21:24:55 +00:00
Ben Wagner
aee878d767 Move lang to list in Android font manager.
Change-Id: Ia4af2769f4761e6b444ed0c232c48199872f3acc
Reviewed-on: https://skia-review.googlesource.com/33480
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2017-08-14 19:29:05 +00:00
Mike Klein
7cc49d65fc Record SkCanvas::flush().
We can record multiple frames in an .skp by recording SkCanvas::flush().
This should make SkPictures, SkLiteDL, and .skp files all record flush().

Change-Id: I6cf6e0e4ef993530d9f92fa168a53702ffce7d5e
Reviewed-on: https://skia-review.googlesource.com/34081
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-08-14 15:29:05 +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
Herb Derby
35ae65d5d0 SkSafeMath for tracking size_t overflow
Do multiply (mul) and add while tracking that the
calculation does not overflow, which can be checked with
ok().

The new unit test shows a couple examples.

Author:  Herb Derby <herb@google.com>
Change-Id: I7e67671d2488d67f21d47d9618736a6bae8f23c3
Reviewed-on: https://skia-review.googlesource.com/33721
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Herb Derby <herb@google.com>
2017-08-11 19:23:06 +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
aff329b8e9 Make GrFragmentProcessor be non-refcounted and use std::unique_ptr.
Change-Id: I985e54a071338e99292a5aa2f42c92bc115b4008
Reviewed-on: https://skia-review.googlesource.com/32760
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2017-08-11 14:13:26 +00:00
Brian Salomon
b74ef035a4 Hide GrPaint copy constructor and add GrPaint::Clone and remove MoveOrNew and MoveOrCopy.
Also makes paint clones use cloned fragment processors.

Change-Id: I60efcfc6a46a4f8430a72f4d1ec79c7d99fbe593
Reviewed-on: https://skia-review.googlesource.com/33084
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-08-10 17:56:45 +00:00
Brian Osman
71a1889a14 Revert "Revert "GrContext::dump that produces JSON formatted output""
This reverts commit 0f450acd76.

Bug: skia:
Change-Id: I97428fbbc6d82bf8b186ec5fdbf1a939c00e4126
Reviewed-on: https://skia-review.googlesource.com/32726
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-08-10 15:42:25 +00:00
Brian Salomon
bfd18cdd54 Move GrAppliedClip into GrPipeline
Change-Id: I522c2fd52bea9813baba7cdb3f11b63e7ab96b50
Reviewed-on: https://skia-review.googlesource.com/28861
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2017-08-10 12:54:05 +00:00
Brian Osman
0f450acd76 Revert "GrContext::dump that produces JSON formatted output"
This reverts commit 175af0d011.

Reason for revert: Chrome doesn't know about portable format specifiers. Sigh.

Original change's description:
> GrContext::dump that produces JSON formatted output
> 
> Includes caps, GL strings, and extensions
> 
> Bug: skia:
> Change-Id: I1e8b3dd50fb68357f9de8ca6149cf65443d027ef
> Reviewed-on: https://skia-review.googlesource.com/32340
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

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

Change-Id: Ie280b25275725f0661da7541f54ed62897abb82f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/32861
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-08-09 20:47:49 +00:00
Brian Salomon
91326c34ee Move GrProcessorSet into GrPipeline
Change-Id: Ibfa5e1adda3c32140590aa62a31d35654cef79dd
Reviewed-on: https://skia-review.googlesource.com/28187
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2017-08-09 20:42:45 +00:00
Brian Osman
175af0d011 GrContext::dump that produces JSON formatted output
Includes caps, GL strings, and extensions

Bug: skia:
Change-Id: I1e8b3dd50fb68357f9de8ca6149cf65443d027ef
Reviewed-on: https://skia-review.googlesource.com/32340
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-08-09 18:52:05 +00:00
Mike Reed
828f1d5195 handle overflows in float->int
rects are already auto-vectorized, so no need to explicitly write a 4f version of SkRect::round()

Bug: skia:
Change-Id: I098945767bfcaa7093d770c376bd17ff3bdc9983
Reviewed-on: https://skia-review.googlesource.com/32060
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2017-08-09 16:07:24 +00:00
Mike Reed
3404207e24 use rasterpipeline for images if matrix is >= scale+translate
Bug: skia:
Change-Id: I36112fe54c6f2d0965d0b88f0291d7ffe0902715
Reviewed-on: https://skia-review.googlesource.com/30480
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2017-08-08 21:32:42 +00:00
Florin Malita
3b30c4f188 Relocate gradient negative fract() workaround to GLSLCodeGenerator
Change-Id: If5aba5b266f86f677b6e63b0f79792f1d3213336
Reviewed-on: https://skia-review.googlesource.com/32202
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-08-08 20:18:33 +00:00
Mike Reed
5a625e08f0 add tool_util to compare images
Bug: skia:
Change-Id: I826190aa15cf42a3ca7f3c7d5271ead5b514c116
Reviewed-on: https://skia-review.googlesource.com/32220
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2017-08-08 20:07:32 +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
Robert Phillips
6dd8cf144e Remove SkLightingShader and associated classes
Change-Id: I8050414c30dfdb5df23ca79955adc5ba3a29d3f5
Reviewed-on: https://skia-review.googlesource.com/31140
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-08-07 13:33:49 +00:00
Mike Reed
8addae8b53 just use math.h for converting from float to int
Bug: skia:
Change-Id: I40cce503cd4cef09c671511a705192efc5d67d71
Reviewed-on: https://skia-review.googlesource.com/31002
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-08-04 21:25:07 +00:00
Brian Osman
b6705c2536 Add support for object creation/snapshot/deletion events
- Bring back some previously deleted macros and helper types.
- Automatically inject base_type information into snapshot events,
  to allow simpler tracking of polymorphic object types.
- Fix JSON formatting of pointer values (they were serializing as bool).

Bug: skia:
Change-Id: Iac7803f72ce5396ffd2fbcb5a36d76745c5e3f3e
Reviewed-on: https://skia-review.googlesource.com/28220
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-08-03 17:10:08 +00:00
Mike Klein
16776dfb4b funnel all constant colors through append_constant_color()
My next step is to change the uniform_color context to

    struct {
       float r,g,b,a;
       uint32_t rgba;
    };

so that it's trivial to load in both float and 8-bit pipelines.

Change-Id: If9bdde353ced3bf9eb0c63204b4770ed614ad16b
Reviewed-on: https://skia-review.googlesource.com/30481
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-08-03 15:37:37 +00:00
Ethan Nicholas
dcba08e891 Revert "Revert "support for 'half' types in sksl, plus general numeric type improvements""
This reverts commit 0e96055424.

Bug: skia:
Change-Id: Id45d091c1950887316c901ed9c9281181f346bcf
Reviewed-on: https://skia-review.googlesource.com/29602
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2017-08-02 18:47:00 +00:00
Robert Phillips
d9971c0c20 Fix DeferredTextureImage test on Mac
Change-Id: I34cf12b2aa16b2441b9e57162cbaee1444f42c52
Reviewed-on: https://skia-review.googlesource.com/29607
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-08-02 18:20:07 +00:00
Greg Daniel
5131678123 Revert "Revert "Revert "Revert "Add support for semaphores to be inserted on GrContext flush""""
This reverts commit cc8eb60c48.

Reason for revert: Chrome change landed that should fix chrome roll

Original change's description:
> Revert "Revert "Revert "Add support for semaphores to be inserted on GrContext flush"""
> 
> This reverts commit 876aed8758.
> 
> Reason for revert: the bots seem to be unhappily red with this CL
> 
> Original change's description:
> > Revert "Revert "Add support for semaphores to be inserted on GrContext flush""
> > 
> > This reverts commit 8724b46099.
> > 
> > Reason for revert: Creating a test CL to see what happens on the bots
> > 
> > Original change's description:
> > > Revert "Add support for semaphores to be inserted on GrContext flush"
> > > 
> > > This reverts commit cd1416efbc.
> > > 
> > > Reason for revert: speculative, to try to fix roll see gpu_tests.pixel_integration_test.PixelIntegrationTest.Pixel_GpuRasterization_ConcavePaths
> > > 
> > > Original change's description:
> > > > Add support for semaphores to be inserted on GrContext flush
> > > > 
> > > > This also moves the logic of inserting semaphores down into GrDrawingManager
> > > > and finishFlush on GrGpu. With it being on finishFlush, there should be no
> > > > issues when the DrawingManager starts respecting the proxy passed in assuming
> > > > it always calls finishFlush at the end (which it should).
> > > > 
> > > > Bug: skia:
> > > > Change-Id: I925c2a289dcbbb9159b9120878af1d34f21a2dc7
> > > > Reviewed-on: https://skia-review.googlesource.com/25641
> > > > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > > > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > > 
> > > TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
> > > 
> > > Change-Id: I9c5b9cf8c060193e1861dbb8f0c10fb11dfb5249
> > > No-Presubmit: true
> > > No-Tree-Checks: true
> > > No-Try: true
> > > Bug: skia:
> > > Reviewed-on: https://skia-review.googlesource.com/25980
> > > Reviewed-by: Mike Reed <reed@google.com>
> > > Commit-Queue: Mike Reed <reed@google.com>
> > 
> > TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,reed@google.com
> > 
> > # Not skipping CQ checks because original CL landed > 1 day ago.
> > 
> > Bug: skia:
> > Change-Id: I5edbeaa0769670ee58f362f0ccaa78319410aa6c
> > Reviewed-on: https://skia-review.googlesource.com/26160
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
> 
> TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,reed@google.com
> 
> Change-Id: I22fd6febafe70489a5fdb695c6f4263368eb423d
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:
> Reviewed-on: https://skia-review.googlesource.com/29422
> Reviewed-by: Yuqian Li <liyuqian@google.com>
> Commit-Queue: Yuqian Li <liyuqian@google.com>

TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,liyuqian@google.com,reed@google.com

Change-Id: Ie3eae818b02599a70f714ef6b6635ce7d171bde6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/30000
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2017-08-02 15:10:18 +00:00
Brian Salomon
ce06e261e6 Make ProcessorCloneTest more robust, fix matrix conv. onIsEqual
Change-Id: Iddf860b462dcac36f6a7f5b90d4ce4dceed0dd31
Reviewed-on: https://skia-review.googlesource.com/29604
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-08-01 21:02:18 +00:00
Ethan Nicholas
0e96055424 Revert "support for 'half' types in sksl, plus general numeric type improvements"
This reverts commit 93061b5344.

Reason for revert: bot failures

Original change's description:
> support for 'half' types in sksl, plus general numeric type improvements
> 
> Bug: skia:
> Change-Id: Id285262fda8291847f11343d499b5df62ddb4b09
> Reviewed-on: https://skia-review.googlesource.com/28980
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>

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

Change-Id: Ie8672271d35b9fcdf567f8bc3674084748be66ad
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/29600
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2017-08-01 19:30:04 +00:00
Mike Klein
249ee1f985 clamp to 0 in repeat and mirror image tilers
If we were doing this math with real numbers or even just doubles, these
clamps wouldn't be necessary.  But we're favoring speed over accuracy
here when we emulate fmod() and some of those inaccuracies end up with
values outside the [0,tile) range, negative!

To keep the spirit of fast over 100% accurate, I've just added a safety
clamp to 0.  The case in the unit test now returns 0 where it should
really return something like 7 or 8, but at least we won't try to read
_way_ outside the image buffer.

BUG=chromium:749260

Change-Id: Ifc5cfe69798beccbb2a16547510158576e06eb3a
Reviewed-on: https://skia-review.googlesource.com/29580
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-08-01 19:15:33 +00:00
Ethan Nicholas
93061b5344 support for 'half' types in sksl, plus general numeric type improvements
Bug: skia:
Change-Id: Id285262fda8291847f11343d499b5df62ddb4b09
Reviewed-on: https://skia-review.googlesource.com/28980
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2017-08-01 18:59:15 +00:00
Yuqian Li
cc8eb60c48 Revert "Revert "Revert "Add support for semaphores to be inserted on GrContext flush"""
This reverts commit 876aed8758.

Reason for revert: the bots seem to be unhappily red with this CL

Original change's description:
> Revert "Revert "Add support for semaphores to be inserted on GrContext flush""
> 
> This reverts commit 8724b46099.
> 
> Reason for revert: Creating a test CL to see what happens on the bots
> 
> Original change's description:
> > Revert "Add support for semaphores to be inserted on GrContext flush"
> > 
> > This reverts commit cd1416efbc.
> > 
> > Reason for revert: speculative, to try to fix roll see gpu_tests.pixel_integration_test.PixelIntegrationTest.Pixel_GpuRasterization_ConcavePaths
> > 
> > Original change's description:
> > > Add support for semaphores to be inserted on GrContext flush
> > > 
> > > This also moves the logic of inserting semaphores down into GrDrawingManager
> > > and finishFlush on GrGpu. With it being on finishFlush, there should be no
> > > issues when the DrawingManager starts respecting the proxy passed in assuming
> > > it always calls finishFlush at the end (which it should).
> > > 
> > > Bug: skia:
> > > Change-Id: I925c2a289dcbbb9159b9120878af1d34f21a2dc7
> > > Reviewed-on: https://skia-review.googlesource.com/25641
> > > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > 
> > TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
> > 
> > Change-Id: I9c5b9cf8c060193e1861dbb8f0c10fb11dfb5249
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Bug: skia:
> > Reviewed-on: https://skia-review.googlesource.com/25980
> > Reviewed-by: Mike Reed <reed@google.com>
> > Commit-Queue: Mike Reed <reed@google.com>
> 
> TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,reed@google.com
> 
> # Not skipping CQ checks because original CL landed > 1 day ago.
> 
> Bug: skia:
> Change-Id: I5edbeaa0769670ee58f362f0ccaa78319410aa6c
> Reviewed-on: https://skia-review.googlesource.com/26160
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>

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

Change-Id: I22fd6febafe70489a5fdb695c6f4263368eb423d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/29422
Reviewed-by: Yuqian Li <liyuqian@google.com>
Commit-Queue: Yuqian Li <liyuqian@google.com>
2017-08-01 17:43:41 +00:00
Greg Daniel
876aed8758 Revert "Revert "Add support for semaphores to be inserted on GrContext flush""
This reverts commit 8724b46099.

Reason for revert: Creating a test CL to see what happens on the bots

Original change's description:
> Revert "Add support for semaphores to be inserted on GrContext flush"
> 
> This reverts commit cd1416efbc.
> 
> Reason for revert: speculative, to try to fix roll see gpu_tests.pixel_integration_test.PixelIntegrationTest.Pixel_GpuRasterization_ConcavePaths
> 
> Original change's description:
> > Add support for semaphores to be inserted on GrContext flush
> > 
> > This also moves the logic of inserting semaphores down into GrDrawingManager
> > and finishFlush on GrGpu. With it being on finishFlush, there should be no
> > issues when the DrawingManager starts respecting the proxy passed in assuming
> > it always calls finishFlush at the end (which it should).
> > 
> > Bug: skia:
> > Change-Id: I925c2a289dcbbb9159b9120878af1d34f21a2dc7
> > Reviewed-on: https://skia-review.googlesource.com/25641
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
> 
> TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
> 
> Change-Id: I9c5b9cf8c060193e1861dbb8f0c10fb11dfb5249
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:
> Reviewed-on: https://skia-review.googlesource.com/25980
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Mike Reed <reed@google.com>

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

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

Bug: skia:
Change-Id: I5edbeaa0769670ee58f362f0ccaa78319410aa6c
Reviewed-on: https://skia-review.googlesource.com/26160
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2017-08-01 17:07:53 +00:00
Robert Phillips
7294b851d2 Revert "Remove origin field from GrSurface"
This reverts commit df0e09feac.

Reason for revert: Experimental revert to see if this is blocking the roll


Original change's description:
> Remove origin field from GrSurface
> 
> This mainly consists of rm origin from GrSurface and the wrapBackEnd*
> methods and then re-adding an explicit origin parameter to all the 
> GrGpu methods that need it.
> 
> Change-Id: Iabd79ae98b227b5b9409f3ab5bbcc48af9613c18
> Reviewed-on: https://skia-review.googlesource.com/26363
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

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

Change-Id: Id606aa01e84e2b83be71d833eefca477c1ad0d01
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/29220
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-08-01 13:51:54 +00:00
Brian Salomon
96271cd180 Require clone() be implemented by GrFragmentProcessor subclasses
Change-Id: I66ba0978e5748806d563ff4f26000e4e0095ed24
Reviewed-on: https://skia-review.googlesource.com/29042
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-07-31 20:51:42 +00:00
Cary Clark
66e393c689 longer is better
R=robertphillips@google.com
Bug: 749315
Change-Id: Id8091a077771553b313aaf3aff20b7b37765cc53
Reviewed-on: https://skia-review.googlesource.com/28787
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Cary Clark <caryclark@skia.org>
2017-07-31 17:48:38 +00:00
Robert Phillips
df0e09feac Remove origin field from GrSurface
This mainly consists of rm origin from GrSurface and the wrapBackEnd*
methods and then re-adding an explicit origin parameter to all the 
GrGpu methods that need it.

Change-Id: Iabd79ae98b227b5b9409f3ab5bbcc48af9613c18
Reviewed-on: https://skia-review.googlesource.com/26363
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-07-31 16:02:42 +00:00
Ethan Nicholas
f57c0d6761 automatically generate clone() methods for SkSL fragment processors
Bug: skia:
Change-Id: Ib7b90f20d2b1558aad14f38f95c7c884e654c96d
Reviewed-on: https://skia-review.googlesource.com/28620
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-07-31 15:44:32 +00:00
Jim Van Verth
1af03d4396 Compute correct bounds for DrawShadowRec.
Bug: skia:6880
Change-Id: Ia8b94e52eec3feb5104d2351bf7a7e6f99101deb
Reviewed-on: https://skia-review.googlesource.com/26370
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-07-31 13:55:32 +00:00
Ethan Nicholas
5af9ea399d renamed SkSL types in preparation for killing precision modifiers
Bug: skia:
Change-Id: Iff0289e25355a89cdc289a0892ed755dd1b1c900
Reviewed-on: https://skia-review.googlesource.com/27703
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-07-28 20:43:03 +00:00
Brian Salomon
b17e63938f Add clone methods to unit test GrFragmentProcessor classes
Also adds testing of copying ImageStorageAccess and ref counts of proxies held by cloned FPs.

Change-Id: Ia23220bf65b4df83d1c874b46d8525cc3540f716
Reviewed-on: https://skia-review.googlesource.com/28004
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2017-07-28 18:02:52 +00:00
Brian Salomon
71603cca8e Remove the now unused GR_PROXY_MOVE macro
Change-Id: I9655a3032aea9c40e87742c76ad9a9ab42a159dc
Reviewed-on: https://skia-review.googlesource.com/27841
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-07-28 11:31:27 +00:00
Robert Phillips
16d8ec66cd Pull non-substantive changes out of omnibus GrSurface CL
https://skia-review.googlesource.com/c/26363 (Remove origin field from GrSurface) is
already too large. This pulls some of the cosmetic changes out for separate review.
Change-Id: I1d8b95522144b2f4cbd916ef38faa3dde6f78087
Reviewed-on: https://skia-review.googlesource.com/27840
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-07-27 22:16:06 +00:00
Ben Wagner
713195071d Remove internal use of SkTypeface::Style.
Change-Id: I71cf04b12be95a54b7fb47d048ba1f8672ed9a8f
Reviewed-on: https://skia-review.googlesource.com/27760
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
2017-07-27 21:30:45 +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
Robert Phillips
2890fbfe14 Make GrPipeline hold a GrRenderTargetProxy (instead of a GrRenderTarget)
In a future world where GrSurface no longer has an origin it will be
useful for the GrPipeline to be holding the GrRenderTargetProxy (which will
still have an origin).

Change-Id: I743a8cc07b6b92f8116227fb77b7c37da43cde8a
Reviewed-on: https://skia-review.googlesource.com/26804
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-07-26 20:59:00 +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
Mike Reed
847068ce83 add Make factory to SkMemoryStream (simplify call-sites)
Bug: skia:6888
Change-Id: Ia4e432673ed089a91229697c8dde0489f220000d
Reviewed-on: https://skia-review.googlesource.com/26884
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-07-26 15:59:49 +00:00
Brian Osman
a9340ba980 Tracing macro cleanup continued
- Remove one especially chatty event, and one pointless test
- Use TRACE_FUNC everywhere, rather than manual strings

Bug: skia:
Change-Id: Icb795294009150ca9a260436738d79546a733337
Reviewed-on: https://skia-review.googlesource.com/26701
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-07-26 12:58:59 +00:00
Mike Klein
7a0ba1c132 guard SkTableColorFilter against out-of-range inputs
I was going to be clever here and only clamp when we
know the inputs are out of range, but this filter is
rare and slow enough that I think I'd rather it just
be super paranoid safe.

The test crashes without this fix and passes with it.

Change-Id: I4e17aad2b5c1e96180ce8d73b97bee746cf985c2
Reviewed-on: https://skia-review.googlesource.com/26702
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2017-07-26 12:55:09 +00:00
Greg Daniel
3f475d9482 Update CrossContext Image test to fix memory leak
Bug: skia:
Change-Id: I8c0abf16d5eb366cdc5296f8df9f33cc0e8f4cc4
Reviewed-on: https://skia-review.googlesource.com/26662
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2017-07-25 20:52:59 +00:00
Stan Iliev
4ed9ae4b23 Improve GrGLNonlinearColorSpaceXformEffect to support scRGB
Improve GrGLNonlinearColorSpaceXformEffect to correctly implement
scRGB transfer function and allow for negative colors.
Relax SkSurface_Gpu::Valid to allow kRGBA_half_GrPixelConfig
render target without a color space needed for legacy blending on
Android.

Bug: b/62347704
Change-Id: Ibc6144e69c26cdbdcbf29348c4f612fb6b639e01
Reviewed-on: https://skia-review.googlesource.com/26143
Commit-Queue: Stan Iliev <stani@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2017-07-25 18:34:01 +00:00
Robert Phillips
066f020bb6 Reduce dependence on GrSurface's origin field (take 3)
TBR=bsalomon@google.com

Change-Id: I8c95c6774897dbd87e3c5c87d92f75c5b64d4e76
Reviewed-on: https://skia-review.googlesource.com/26424
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2017-07-25 17:34:29 +00:00
Ben Wagner
8c79194b8a Use unique_ptr[] for new[].
Correction for
https://skia.googlesource.com/skia.git/+/0e05a823f6ff6e9d799172f002e77ab9f2015f0f
"Add GrFragmentProcessor::clone(), implementation for ColorTableEffect,
and unit test." Found by ASAN.

Change-Id: Ic734e52bc61b0d9eb305631cc23ebad80b0be8b7
Reviewed-on: https://skia-review.googlesource.com/26561
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2017-07-25 15:56:18 +00:00
Mike Reed
ede7bac43f use unique_ptr for codec factories
Will need guards for android (at least)

Bug: skia:
Change-Id: I2bb8e656997984489ef1f2e41cd3d301c4e7b947
Reviewed-on: https://skia-review.googlesource.com/26040
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2017-07-25 15:35:23 +00:00
Greg Daniel
02611d9afd Add Make[backend] calls for creating GrContexts
Docs-Preview: https://skia.org/?cl=26369
Bug: skia:
Change-Id: I460ee63e466f85b05918479f068a2e5ca2d70550
Reviewed-on: https://skia-review.googlesource.com/26369
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-07-25 14:33:03 +00:00
Robert Phillips
6af2a668f4 Revert "Reduce dependence on GrSurface's origin field (take 2)"
This reverts commit 22115b4fc6.

Reason for revert: GrAHardwareBufferImageGenerator.cpp

Original change's description:
> Reduce dependence on GrSurface's origin field (take 2)
> 
> TBR=bsalomon@google.com
> Change-Id: Ia238fc66b0fe10a3626c7967b2ac1f1a4bf4cd71
> Reviewed-on: https://skia-review.googlesource.com/25800
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

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

Change-Id: I6dc77f02eed3073317128c48f0b426b81926787f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/26480
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-07-25 14:11:45 +00:00
Brian Salomon
0e05a823f6 Add GrFragmentProcessor::clone(), implementation for ColorTableEffect, and unit test.
We occasionally make copies of GrPaints. clone() fill facilitate this case when GrFragmentProcessors are non-shareable.. 

Change-Id: I004e34f6ce8c293f9e0664d26532e44bd6b9fdff
Reviewed-on: https://skia-review.googlesource.com/26360
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2017-07-25 14:00:53 +00:00
Robert Phillips
22115b4fc6 Reduce dependence on GrSurface's origin field (take 2)
TBR=bsalomon@google.com
Change-Id: Ia238fc66b0fe10a3626c7967b2ac1f1a4bf4cd71
Reviewed-on: https://skia-review.googlesource.com/25800
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-07-25 14:00:43 +00:00
Mike Klein
b323a5ed1f sprinkle more tracing in GM, tests, and ok, and add TRACE_FUNC
Change-Id: I562d438bd65e9fd900cfc6831f971b4af25c8ae6
Reviewed-on: https://skia-review.googlesource.com/26361
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-07-24 20:02:07 +00:00
Brian Salomon
1c053644a8 Make GrProcessorTestFactory be templated on smart ptr class rather than processor class.
This is part of setting the stage for moving GrFragmentProcessor to unique_ptr ownership.

Change-Id: I2dfb4977319605d56c4debe05ff0b3dc970bb4c5
Reviewed-on: https://skia-review.googlesource.com/26141
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-07-24 15:43:09 +00:00
Robert Phillips
e44ef10ebb Second small fragment from "Reduce dependence on GrSurface's origin field"
TBR=bsalomon@google.com
Change-Id: Ifcfe56b1117b64821b2bfc34ba36d120227d15fa
Reviewed-on: https://skia-review.googlesource.com/25802
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-07-24 13:05:29 +00:00
Mike Reed
71f867c229 have resources return unique_ptr for stream
Bug: skia:
Change-Id: I649f4435d06704a5a581a481fe3c46b6ec677baf
Reviewed-on: https://skia-review.googlesource.com/26041
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-07-23 18:24:24 +00:00
Mike Reed
54518ac1c2 remove unused SkPoint3 from SkColor.h
Bug: skia:
Change-Id: Iba327a5604dc11525c4d8d0a535a7c417a1b8185
Reviewed-on: https://skia-review.googlesource.com/25961
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-07-22 19:30:37 +00:00
Mike Reed
8724b46099 Revert "Add support for semaphores to be inserted on GrContext flush"
This reverts commit cd1416efbc.

Reason for revert: speculative, to try to fix roll see gpu_tests.pixel_integration_test.PixelIntegrationTest.Pixel_GpuRasterization_ConcavePaths

Original change's description:
> Add support for semaphores to be inserted on GrContext flush
> 
> This also moves the logic of inserting semaphores down into GrDrawingManager
> and finishFlush on GrGpu. With it being on finishFlush, there should be no
> issues when the DrawingManager starts respecting the proxy passed in assuming
> it always calls finishFlush at the end (which it should).
> 
> Bug: skia:
> Change-Id: I925c2a289dcbbb9159b9120878af1d34f21a2dc7
> Reviewed-on: https://skia-review.googlesource.com/25641
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>

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

Change-Id: I9c5b9cf8c060193e1861dbb8f0c10fb11dfb5249
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/25980
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-07-22 17:34:00 +00:00
Greg Daniel
cd1416efbc Add support for semaphores to be inserted on GrContext flush
This also moves the logic of inserting semaphores down into GrDrawingManager
and finishFlush on GrGpu. With it being on finishFlush, there should be no
issues when the DrawingManager starts respecting the proxy passed in assuming
it always calls finishFlush at the end (which it should).

Bug: skia:
Change-Id: I925c2a289dcbbb9159b9120878af1d34f21a2dc7
Reviewed-on: https://skia-review.googlesource.com/25641
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2017-07-22 01:03:06 +00:00