platform/upstream/libSkiaSharp.git
7 years agoRemove SkMovie and giflib
scroggo [Thu, 27 Oct 2016 19:24:43 +0000 (12:24 -0700)]
Remove SkMovie and giflib

SkMovie is not used in any of our tests or by Chromium. It is also not
supported by GN. It is being moved into Android, its only client, so we
can delete it here.

giflib is only used by SkMovie, so stop pulling/building it.

TBR=reed@google.com

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

Change-Id: I28a8155fd59e139bb21ec2295cc22fdced034284
Review-Url: https://codereview.chromium.org/2449213004

7 years agoRename GrDrawContext to GrRenderTargetContext
Brian Osman [Thu, 27 Oct 2016 18:47:55 +0000 (14:47 -0400)]
Rename GrDrawContext to GrRenderTargetContext

This is in preparation for GrTextureContext and GrSurfaceContext

BUG=skia:

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

Change-Id: Ie58c93052e68f3f1f5fe8d15d63760de274a6fbd
Reviewed-on: https://skia-review.googlesource.com/4030
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
7 years agoCreate .gni files for samples, tests, gms, and benches.
Mike Klein [Thu, 27 Oct 2016 16:21:40 +0000 (12:21 -0400)]
Create .gni files for samples, tests, gms, and benches.

Calling Python to find all these files is convenient, but error-prone.  It's easy to forget to call GN again when adding a file.  Each of these calls to Python also adds ~50ms to the run time of gn gen, which is small but adds up.

On my desktop, gn gen drops from 600ms to 150ms, noticeably faster.

This leaves one call to find.py for generating skia.h for fiddle.  We're not quite sure how to automate that process to happen entirely inside the :skia.h action while maintaining correct dependencies, so I'm leaving it for now.

BUG=skia:

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

Change-Id: Ib9d355b97900f29afebc65311ceef50537e46dda
Reviewed-on: https://skia-review.googlesource.com/4036
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>

7 years agoImprove comments describing common sRGB curves
Matt Sarett [Thu, 27 Oct 2016 16:44:18 +0000 (12:44 -0400)]
Improve comments describing common sRGB curves

BUG=skia:5897

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

Change-Id: Id1253cc9b960aad47bc0f9b7e40f10830d46d98d
Reviewed-on: https://skia-review.googlesource.com/4037
Reviewed-by: Heather Miller <hcm@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>

7 years agoRestore the ability to not build vulkan when VULKAN_SDK is set
Brian Salomon [Thu, 27 Oct 2016 17:31:37 +0000 (13:31 -0400)]
Restore the ability to not build vulkan when VULKAN_SDK is set

After https://skia.googlesource.com/skia/+/686bb21f3ed19218a85e94798fe50e240e3fac08 skia_use_vulkan=false stopped working when VULKAN_SDK is set in the environment.

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

Change-Id: I3707c930d041556d1727f43c48eba2cad73349eb
Reviewed-on: https://skia-review.googlesource.com/4038
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Mike Klein <mtklein@chromium.org>
7 years agoAdded skslc parse recursion limit
ethannicholas [Thu, 27 Oct 2016 17:54:02 +0000 (10:54 -0700)]
Added skslc parse recursion limit

The fuzzer discovered that a long chain of left-parentheses would cause a stack overflow due to excessive recursion. While it is not in general possible to guarantee that we do not exceed stack limits (because the system can be configured with an arbitrarily small stack), setting a reasonable recursion limit will at least keep the fuzzer from continually finding more "bugs" like this.

BUG=skia:5899
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2459573003

Review-Url: https://codereview.chromium.org/2459573003

7 years agochmod -x *.cpp *.h
Hal Canary [Thu, 27 Oct 2016 15:44:20 +0000 (11:44 -0400)]
chmod -x *.cpp *.h

Change-Id: I5b37499505e26e0837921292c1aea0056e4d5ecd
Reviewed-on: https://skia-review.googlesource.com/4035
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>

7 years agoRemove SkAutoTUnref and SkAutoTDelete from public includes.
bungeman [Thu, 27 Oct 2016 16:30:08 +0000 (09:30 -0700)]
Remove SkAutoTUnref and SkAutoTDelete from public includes.

This also makes the required changed to src, tests, and tools. The few
public APIs modified by this change appear to be unused outside of Skia.

Removing these from the public API makes it easier to ensure users are
no longer using them.

This also updates GrGpu::wrapBackendXXX and the
::onWrapBackendXXX methods to clarify ownership.

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

Review-Url: https://codereview.chromium.org/2448593002

7 years agoRevert of Reduced skslc memory consumption (patchset #3 id:50001 of https://coderevie...
benjaminwagner [Thu, 27 Oct 2016 16:08:06 +0000 (09:08 -0700)]
Revert of Reduced skslc memory consumption (patchset #3 id:50001 of https://codereview.chromium.org/2442063002/ )

Reason for revert:
texelFetch removed, but is used in some shaders.

Original issue's description:
> Reduced skslc memory consumption
>
> The big change here is smarter generic type handling which allows us to
> keep far fewer entries in the core symboltable. This also comments out
> a number of OpenGL builtin functions which Skia does not use and is
> unlikely to in the future.
> BUG=655673
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2442063002
>
> Committed: https://skia.googlesource.com/skia/+/cffaa70896fa5bc6c7bf98abbaafb1a755b49762

TBR=reed@google.com,ethannicholas@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=655673

Review-Url: https://codereview.chromium.org/2458723002

7 years agoDo not skip fractional y for SkAAClip
liyuqian [Thu, 27 Oct 2016 15:45:32 +0000 (08:45 -0700)]
Do not skip fractional y for SkAAClip

This should fix the following bugs:
https://bugs.chromium.org/p/chromium/issues/detail?id=659883
https://bugs.chromium.org/p/chromium/issues/detail?id=659972

BUG=chromium:659883,chromium:659972
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2452393002

Review-Url: https://codereview.chromium.org/2452393002

7 years agoRevert "Always use a color table with 256 colors"
Leon Scroggins III [Thu, 27 Oct 2016 15:16:11 +0000 (11:16 -0400)]
Revert "Always use a color table with 256 colors"

This reverts commit 0057ac11fccc82bc5b0c1bb0aefe838cc04efd13.

This was a speculative fix. Now that a proper fix has been introduced
(crrev.com/2450943002) we shouldn't need this one.

BUG=skia:5883

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

Change-Id: Ie7aae4fd18dac21b240085c3b5c4f3d46511cd75
Reviewed-on: https://skia-review.googlesource.com/4033
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
7 years agoDefault vulkan sdk to VULKAN_SDK env var in GN
Greg Daniel [Thu, 27 Oct 2016 14:48:48 +0000 (10:48 -0400)]
Default vulkan sdk to VULKAN_SDK env var in GN

BUG=skia:

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

Change-Id: I48767cbbe7e0cd306e448bdc983c853f66121e1b
Reviewed-on: https://skia-review.googlesource.com/4032
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Greg Daniel <egdaniel@google.com>

7 years agoFix decoding GIF to 565
scroggo [Thu, 27 Oct 2016 15:29:13 +0000 (08:29 -0700)]
Fix decoding GIF to 565

565 cannot take the !writeTransparentPixels path, so disable it for
cases where we might have to take that path.

This only affects frames beyond the first. If the first frame has
a transparent pixel, it will be marked as non-opaque, so we cannot
decode to 565 anyway.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2441833002

Review-Url: https://codereview.chromium.org/2441833002

7 years agoReduced skslc memory consumption
ethannicholas [Thu, 27 Oct 2016 15:15:50 +0000 (08:15 -0700)]
Reduced skslc memory consumption

The big change here is smarter generic type handling which allows us to
keep far fewer entries in the core symboltable. This also comments out
a number of OpenGL builtin functions which Skia does not use and is
unlikely to in the future.
BUG=655673
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2442063002

Review-Url: https://codereview.chromium.org/2442063002

7 years agoAvoid separate allocation of SkImageCacherator
fmalita [Thu, 27 Oct 2016 15:15:44 +0000 (08:15 -0700)]
Avoid separate allocation of SkImageCacherator

Embed directly in SkImage_Generator, and add a helper to handle param
validation.

R=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2453473004

Review-Url: https://codereview.chromium.org/2453473004

7 years agorecipes: Fix missing patch_set property
borenet [Thu, 27 Oct 2016 15:00:14 +0000 (08:00 -0700)]
recipes: Fix missing patch_set property

NOTREECHECKS=true
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2450403005

Review-Url: https://codereview.chromium.org/2450403005

7 years agoFix recipes for Gerrit property rename
borenet [Thu, 27 Oct 2016 13:35:51 +0000 (06:35 -0700)]
Fix recipes for Gerrit property rename

NOTREECHECKS=true
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2455523004

Review-Url: https://codereview.chromium.org/2455523004

7 years agoopts.gypi -> opts.gni
Mike Klein [Wed, 26 Oct 2016 22:37:24 +0000 (18:37 -0400)]
opts.gypi -> opts.gni

BUG=skia:

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

Change-Id: Ib687bd7ce87ddbbc60f95e7a30e20575971e5c59
Reviewed-on: https://skia-review.googlesource.com/4026
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>

7 years agoSkTInsertionSort tweak.
Ben Wagner [Wed, 26 Oct 2016 21:48:51 +0000 (17:48 -0400)]
SkTInsertionSort tweak.

'Unoptomized' insertion sort swaps the 'insert' value multiple times
inside the main loop before it finds its place. However, this has the
advantage that if the 'insert' element is already not less than any
element in the sorted partition no moves are made at all.

The 'optimized' insertion sort present before this CL moves the 'insert'
value into a temporary (creating a 'hole') and then moves already sorted
elements until the 'insert' element finds its place. This has the
disadvantage of always moving the 'insert' element out of the list and
then re-inserting it, even if this was unnecessary.

This CL further optimizes the insertion sort by moving the first test of
the main loop to before moving the 'insert' element into the temporary.
This is expected to increase the code size by a few instructions but
avoids the useless non-moves. There will actually be one fewer
comparison per element comsidered (the initial 'left < hole' predicate
is always true when entering the inner loop).

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

Change-Id: I33158b7781e4dbec1f1b76c0bf43ebe169075733
Reviewed-on: https://skia-review.googlesource.com/4022
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>

7 years agogpu.gypi -> gpu.gni
Mike Klein [Wed, 26 Oct 2016 21:54:36 +0000 (17:54 -0400)]
gpu.gypi -> gpu.gni

BUG=skia:

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

Change-Id: I55a6d58458500ccfb009382eab4c90a6e4217b2c
Reviewed-on: https://skia-review.googlesource.com/4025
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
7 years agoSpeculative fix for flaky webp encode/decode on Nexus 5
Matt Sarett [Wed, 26 Oct 2016 21:39:54 +0000 (17:39 -0400)]
Speculative fix for flaky webp encode/decode on Nexus 5

I'm not really expecting this to work anymore...

The docs don't say anything about the rgb pointer needing
to stay valid, and it looks like we are done with it
after the call to import.

Still, worth a try I think.

BUG=skia:5876

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

Change-Id: I6e65ef96a2b661b01eb92bedab0acd73ed4f6218
Reviewed-on: https://skia-review.googlesource.com/4024
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Matt Sarett <msarett@google.com>

7 years agogypi -> gni: core, effects, android framework defines
Mike Klein [Wed, 26 Oct 2016 21:19:03 +0000 (17:19 -0400)]
gypi -> gni: core, effects, android framework defines

BUG=skia:

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

Change-Id: I29a26c1716a319156a34a64999756ed7dba1e603
Reviewed-on: https://skia-review.googlesource.com/4023
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>

7 years agoSkRasterPipelineBlitter simplifications
Mike Klein [Wed, 26 Oct 2016 19:32:26 +0000 (15:32 -0400)]
SkRasterPipelineBlitter simplifications

The main idea here is to simplify, mainly to reduce the number of SkRasterPipeline objects the blitter holds.

  - Use SkBlendMode instead of SkXfermode, just store SkBlendMode.
  - Fuse the shader and color filter together into one SkRasterPipeline
    during blitter creation.
  - I noticed all calls to append_load_d() and append_store() now have the same ctx argument, so I folded that through.

I'll be following up with more of this sort of refactoring... I think I can fold everything into a single SkRasterPipeline during blitter creation now, but I'll want to make sure I've got my ducks in a row for how that works with pipeline strength reduction (like skipping dst loads when drawing in Src mode).

BUG=skia:

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

Change-Id: I88252ab8ad16f102c71bad871f8b6aec2fc1f226
Reviewed-on: https://skia-review.googlesource.com/4021
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>

7 years agoWrite transparent pixels more often (SkGifCodec)
scroggo [Wed, 26 Oct 2016 20:48:03 +0000 (13:48 -0700)]
Write transparent pixels more often (SkGifCodec)

Writing transparent pixels is faster than the alternative, and we can
skip clearing the frame to transparent. We'll still clear if the image
is incomplete.

I ran

  ./out/Release/nanobench --images <images> --samples 100 --sourceType image --simpleCodec -v

over the GIFs we have on our bots, and found an average ~13% speedup.
Raw data is on sheet 2 of
https://docs.google.com/spreadsheets/d/19V-t9BfbFw5eiwBTKA1qOBkZbchjlTC5EIz6HFy-6RI/
(the sheet is named WriteTransparentPixels).
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2436183002

Review-Url: https://codereview.chromium.org/2436183002

7 years agoTest CL
Ravi Mistry [Wed, 26 Oct 2016 20:30:45 +0000 (16:30 -0400)]
Test CL

NOTRY=true
BUG=skia:

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

Change-Id: I06c5b71415c1f08d0c20c6bacca4708847393443
Reviewed-on: https://skia-review.googlesource.com/3960
Reviewed-by: Ravi Mistry <rmistry@google.com>
Commit-Queue: Ravi Mistry <rmistry@google.com>

7 years agoMove when swapping, if possible.
bungeman [Wed, 26 Oct 2016 19:11:28 +0000 (12:11 -0700)]
Move when swapping, if possible.

This change was avoided in the past because vc++ 2013 (12.0)
did not properly create default move constructors and
move assignment operators.

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

TBR=reed
Verbal lgtm

Review-Url: https://codereview.chromium.org/2454763002

7 years agoSplit SkSL and utils apart again into .gni files.
Mike Klein [Wed, 26 Oct 2016 18:17:04 +0000 (14:17 -0400)]
Split SkSL and utils apart again into .gni files.

Also extend GN format presubmit check to .gni files.

BUG=skia:

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

Change-Id: I292f3136437101e3e2c3271e260536ab7a24b192
Reviewed-on: https://skia-review.googlesource.com/3976
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>

7 years agoRemove pdf.gni from source lists. Android translator barfs.
Mike Klein [Wed, 26 Oct 2016 18:09:27 +0000 (14:09 -0400)]
Remove pdf.gni from source lists.  Android translator barfs.

TBR=djsollen@google.com

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

Change-Id: Id3769fc5f0a3b97aa39a664d62095bde1599df6e
Reviewed-on: https://skia-review.googlesource.com/3974
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Mike Klein <mtklein@chromium.org>
7 years agoConvert SkRasterPipeline loads and stores to indirect.
Mike Klein [Tue, 25 Oct 2016 19:43:46 +0000 (15:43 -0400)]
Convert SkRasterPipeline loads and stores to indirect.

This allows us to change the underlying pointer without rebuilding the pipeline, e.g. when moving the blitter from scanline to scanline.

The extra overhead when not needed is measurable but small, <2%.  We can always add back direct stages later for cases where we know the context pointer will not change.

BUG=skia:

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

Change-Id: I827d7e6e4e67d02dd2802610f898f98c5f36f8cb
Reviewed-on: https://skia-review.googlesource.com/3943
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>

7 years agoAdd recipe support for Pixel and Pixel XL.
Ben Wagner [Wed, 26 Oct 2016 17:18:58 +0000 (13:18 -0400)]
Add recipe support for Pixel and Pixel XL.

BUG=skia:

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

Change-Id: I782ef741838860bfeace13c335f9a82403047220
Reviewed-on: https://skia-review.googlesource.com/3964
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
Commit-Queue: Ben Wagner <benjaminwagner@google.com>

7 years agoStart inverting GN reading .gypis to GYP reading .gnis.
Mike Klein [Wed, 26 Oct 2016 17:32:07 +0000 (13:32 -0400)]
Start inverting GN reading .gypis to GYP reading .gnis.

This canaries the idea by converting gyp/pdf.gypi to gn/pdf.gni.
If this lands and rolls quietly, I'll flesh out the rest.

BUG=skia:

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

Change-Id: Iecaf1ccce7891679904c585946272bfb25eea299
Reviewed-on: https://skia-review.googlesource.com/3972
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>

7 years agoCreate GrTextureOpList to support deferred copy batches for textures
Brian Osman [Wed, 26 Oct 2016 16:02:18 +0000 (12:02 -0400)]
Create GrTextureOpList to support deferred copy batches for textures

BUG=skia:

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

Change-Id: I63b926f63294795f999a130c0ceead87fbaf978d
Reviewed-on: https://skia-review.googlesource.com/3967
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>

7 years agoAdd disableStencil method to GrGLGpu
csmartdalton [Wed, 26 Oct 2016 17:13:46 +0000 (10:13 -0700)]
Add disableStencil method to GrGLGpu

Most the calls to flushStencil were just trying to disable it. This
change cleans up that code so it can just call "disableStencil"
instead of having to muck with GrStencilSettings. It should also make
those calls slightly faster.

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

Review-Url: https://codereview.chromium.org/2453793002

7 years agoGN: spin off :no_exceptions as its own config.
Mike Klein [Wed, 26 Oct 2016 15:41:47 +0000 (11:41 -0400)]
GN: spin off :no_exceptions as its own config.

BUG=skia:

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

Change-Id: Ibaa10b9b6f566958b7e6622eedbc30a7010260b3
Reviewed-on: https://skia-review.googlesource.com/4001
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>

7 years agoTurn on -Wrange-loop-analysis.
Mike Klein [Wed, 26 Oct 2016 14:35:22 +0000 (10:35 -0400)]
Turn on -Wrange-loop-analysis.

-Wrange-loop-analysis triggers when we use a new-style for loop in a way that appears to unintentionally call a copy constructor on each non-trivial loop element instead of operating on them by reference.

BUG=skia:

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

Change-Id: If9e1b7fcc1f2789ae03c41c17abb17e60d564a8b
Reviewed-on: https://skia-review.googlesource.com/4000
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>

7 years agoRevert of Generate Signed Distance Field directly from vector path (patchset #19...
bsalomon [Wed, 26 Oct 2016 15:00:00 +0000 (08:00 -0700)]
Revert of Generate Signed Distance Field directly from vector path (patchset #19 id:360001 of https://codereview.chromium.org/1643143002/ )

Reason for revert:
Chrome crash

Original issue's description:
> Generate Signed Distance Field directly from vector path
>
> Add SkGenerateDistanceFieldFromPath API to generate signed distance field directly from SkPath.
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1643143002
>
> Committed: https://skia.googlesource.com/skia/+/4de97a64e8829323a7070b623411d9f9ddb0cd0f
> Committed: https://skia.googlesource.com/skia/+/e8f0a7b986f1e5583c9bc162efcdd92fd6430549
> Committed: https://skia.googlesource.com/skia/+/67c7c81a82b6351e9fbbf235084d7120162d9268

TBR=jvanverth@google.com,mtklein@google.com,wasim.abbas@arm.com,caryclark@google.com,reed@google.com,joel.liang@arm.com
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=skia:

Review-Url: https://codereview.chromium.org/2447403002

7 years agoRemove skia.conf from .gitignore
Brian Osman [Wed, 26 Oct 2016 13:32:52 +0000 (09:32 -0400)]
Remove skia.conf from .gitignore

BUG=skia:

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

Change-Id: I2b4d9afda4a5cb393a52f34070ede03da170ee74
Reviewed-on: https://skia-review.googlesource.com/3962
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>

7 years agoBuild for Android from Windows, work in progress.
Mike Klein [Mon, 24 Oct 2016 20:49:15 +0000 (16:49 -0400)]
Build for Android from Windows, work in progress.

Pretty vanilla stuff here, mostly just making the gcc-like toolchain Windows friendly.

I was having trouble getting rm -r {{output}} && $ar rcs {{output}} @$rspfile to work without deleting my ar.exe, so I chickened out the usual way by adding gn/ar.py.

I've also updated bin/droid to work with Git Bash on Windows.

BUG=skia:

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

Change-Id: I04c34ccc91e6a291c11ac4e7a7a0ffe41d879fe6
Reviewed-on: https://skia-review.googlesource.com/3751
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>

7 years agoFix some Windows warnings
Jim Van Verth [Wed, 26 Oct 2016 13:45:23 +0000 (09:45 -0400)]
Fix some Windows warnings

BUG=skia:

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

Change-Id: Icfc5dfb985b966c625d9bc81f61719ac5549085e
Reviewed-on: https://skia-review.googlesource.com/3980
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>

7 years agoAdd GrOpList and rename GrDrawTarget to GrRenderTargetOpList
Robert Phillips [Tue, 25 Oct 2016 18:20:06 +0000 (14:20 -0400)]
Add GrOpList and rename GrDrawTarget to GrRenderTargetOpList

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

Change-Id: I026aa26ecc61a0d002e98892dca728536259e8b1
Reviewed-on: https://skia-review.googlesource.com/3910
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>

7 years agoGrConstColorProcessor uses 4f colors in the destination space
Brian Osman [Tue, 25 Oct 2016 14:51:28 +0000 (10:51 -0400)]
GrConstColorProcessor uses 4f colors in the destination space

Many places that construct one are explicitly specifying opaque white or
transparent black, which we can assume (based on the semantics of the
operation) should remain (0,0,0,0) or (1,1,1,1), so that's simple.

In other cases, we convert our source color to destination space.

One wrinkle is tht SkColorFilter now needs to know the destination color
space, due to SkModeColorFilter.

BUG=skia:

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

Change-Id: I4969c0260588f4021300733f601b47dc606adf79
Reviewed-on: https://skia-review.googlesource.com/3903
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>

7 years agoRemove SK_IGNORE_GL_TEXTURE_TARGET.
Ben Wagner [Tue, 25 Oct 2016 14:44:02 +0000 (10:44 -0400)]
Remove SK_IGNORE_GL_TEXTURE_TARGET.

This code was added with "Use a struct for client GL texture handles"
https://codereview.chromium.org/1429863009. This define no longer
appears to be set anywhere, so it and the code it guards can be removed.

Change-Id: I80bb2a77b1f076143851c1d112937221eff2111a
Reviewed-on: https://skia-review.googlesource.com/3902
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>

7 years agoSkGifCodec: do not write off the end of memory when repeatCount > 1
Matt Sarett [Tue, 25 Oct 2016 18:24:50 +0000 (14:24 -0400)]
SkGifCodec: do not write off the end of memory when repeatCount > 1

BUG=skia:5887

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

Change-Id: I9e3ed6153a73277896ac067ef73918a41a0546b8
Reviewed-on: https://skia-review.googlesource.com/3940
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>

7 years agoGIF: Fill the frame if we have a dummy color table
scroggo [Tue, 25 Oct 2016 20:08:40 +0000 (13:08 -0700)]
GIF: Fill the frame if we have a dummy color table

Since we will not draw anything later, we need to fill the frame with
the fill color.

NOTREECHECKS=true

BUG=skia:5883
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2450943002

Review-Url: https://codereview.chromium.org/2450943002

7 years agoSK_FIX_BUILD
scroggo [Tue, 25 Oct 2016 19:53:59 +0000 (12:53 -0700)]
SK_FIX_BUILD

NOTRY=true
NOTREECHECKS=true
TBR=mtklein@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2447223002

Review-Url: https://codereview.chromium.org/2447223002

7 years agoAlways use a color table with 256 colors
scroggo [Tue, 25 Oct 2016 19:48:25 +0000 (12:48 -0700)]
Always use a color table with 256 colors

Speculative fix for skbug.com/5883

We are hitting an assert (which I have not been able to repro - still
need to get the skp that triggers it) because we are trying to read
beyond the end of the color table. We use 8-bit indices, so 256 should
be enough to prevent going beyond the end. There is only one case when
we use a smaller color table - when it is a dummy. Make the dummy full
size.

NOTREECHECKS=true

BUG=skia:5883
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2452673002

Review-Url: https://codereview.chromium.org/2452673002

7 years agoDo not exclude Gif on iOS
scroggo [Tue, 25 Oct 2016 19:43:50 +0000 (12:43 -0700)]
Do not exclude Gif on iOS

We no longer depend on an external library, so there is no reason to
exclude it.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2447973004

NOTREECHECKS=true

Review-Url: https://codereview.chromium.org/2447973004

7 years agoFix more namespace conflicts in SkGifImageReader
scroggo [Tue, 25 Oct 2016 19:43:21 +0000 (12:43 -0700)]
Fix more namespace conflicts in SkGifImageReader

To fix Google3
TBR=benjaminwagner@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2450753003

NOTREECHECKS=true

Review-Url: https://codereview.chromium.org/2450753003

7 years agoSkRasterPipeline::compile().
Mike Klein [Tue, 25 Oct 2016 17:31:21 +0000 (13:31 -0400)]
SkRasterPipeline::compile().

I'm not yet caching these in the blitter, and speed is essentially unchanged in the bench where I am now building and compiling the pipeline only once.  This may not be able to stay a simple std::function after I figure out caching, but for now it's a nice fit.

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

Change-Id: I9545af589f73baf9f17cb4e6ace9a814c2478fe9
Reviewed-on: https://skia-review.googlesource.com/3911
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>

7 years agoMove SkRasterPipeline further into SkOpts.
Mike Klein [Tue, 25 Oct 2016 14:27:33 +0000 (10:27 -0400)]
Move SkRasterPipeline further into SkOpts.

The portable code now becomes entirely focused on enum+ptr descriptions, leaving the concrete implementation of the pipeline to SkOpts::run_pipeline().

As implemented, the concrete implementation is basically the same, with a little more type safety.

Speed is essentially unchanged on my laptop, and that's having run_pipeline() rebuild its concrete state every call.  There's room for improvement there if we split this into a compile_pipeline() / run_pipeline() sort of thing, which is my next planned CL.

BUG=skia:

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3920
CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot

Change-Id: Ie4c554f51040426de7c5c144afa5d9d9d8938012
Reviewed-on: https://skia-review.googlesource.com/3920
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>

7 years agoFix dimensions and color-spin in color4shader GM
Brian Osman [Tue, 25 Oct 2016 15:45:14 +0000 (11:45 -0400)]
Fix dimensions and color-spin in color4shader GM

BUG=skia:

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

Change-Id: I0f263d98f942eda07eec4dabfec484461f77f83d
Reviewed-on: https://skia-review.googlesource.com/3907
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>

7 years agoMac GN doc.
Mike Klein [Tue, 25 Oct 2016 15:39:12 +0000 (11:39 -0400)]
Mac GN doc.

BUG=skia:

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3906
NOTRY=true
DOCS_PREVIEW= https://skia.org/?cl=3906

Change-Id: I1ad13dd5b7df3d76f99f11e02f04169c5b37ce95
Reviewed-on: https://skia-review.googlesource.com/3906
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>

7 years agobin/sync: call fetch-gn when DEPS changes
Hal Canary [Tue, 25 Oct 2016 15:04:57 +0000 (11:04 -0400)]
bin/sync: call fetch-gn when DEPS changes

Change-Id: Ifb2a364df1a8817152a2c1e79748d14534a9e523
Reviewed-on: https://skia-review.googlesource.com/3904
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Hal Canary <halcanary@google.com>

7 years agofix fuzz
caryclark [Tue, 25 Oct 2016 15:58:26 +0000 (08:58 -0700)]
fix fuzz

Abort early if fuzz data
breaks intersection.

R=kjlubick@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2444333002

Review-Url: https://codereview.chromium.org/2444333002

7 years agoFix GPU sRGB mode in viewer
Brian Osman [Tue, 25 Oct 2016 15:10:45 +0000 (11:10 -0400)]
Fix GPU sRGB mode in viewer

Need to attach the sRGB color space to the surface to get past validation.

BUG=skia:

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

Change-Id: Icce1c8cf35c31023c116cbcddf8848c4c92cd212
Reviewed-on: https://skia-review.googlesource.com/3905
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>

7 years agoDM: JSON Debug Sink
Hal Canary [Tue, 25 Oct 2016 14:33:27 +0000 (10:33 -0400)]
DM: JSON Debug Sink

Currently, the following GMs crash the debug canvas:
    ~dont_clip_to_layer
    ~imageblur
    ~imagefilterscropped
    ~pictureimagefilter
    ~savelayer_lcdtext
    ~textfilter_image
// TODO(halcanary): fix this.

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

Change-Id: Ieed3502119cd639fe345f3a41d436d5e39f3bdf1
Reviewed-on: https://skia-review.googlesource.com/3742
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Hal Canary <halcanary@google.com>

7 years agoremove discardablepixelref
Mike Reed [Tue, 25 Oct 2016 13:57:13 +0000 (09:57 -0400)]
remove discardablepixelref

BUG=skia:

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

Change-Id: Ica284be78563a4ccd6e0cb07404064fb5511ba57
Reviewed-on: https://skia-review.googlesource.com/3883
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
7 years agoGenerate Signed Distance Field directly from vector path
joel.liang [Tue, 25 Oct 2016 14:09:29 +0000 (07:09 -0700)]
Generate Signed Distance Field directly from vector path

Add SkGenerateDistanceFieldFromPath API to generate signed distance field directly from SkPath.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1643143002

Committed: https://skia.googlesource.com/skia/+/4de97a64e8829323a7070b623411d9f9ddb0cd0f
Committed: https://skia.googlesource.com/skia/+/e8f0a7b986f1e5583c9bc162efcdd92fd6430549
Review-Url: https://codereview.chromium.org/1643143002

7 years agoFix memory leak in FuzzGradients
kjlubick [Tue, 25 Oct 2016 13:11:05 +0000 (06:11 -0700)]
Fix memory leak in FuzzGradients

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

Review-Url: https://codereview.chromium.org/2446643003

7 years agoDM: Draw image frames in a grid
scroggo [Tue, 25 Oct 2016 13:11:01 +0000 (06:11 -0700)]
DM: Draw image frames in a grid

Instead of drawing a large vertical strip for CodecSrc::kAnimated_Mode,
draw a grid of images. Compute the grid based on the square root of the
frame count, so the grid will be roughly square.

BUG=skia:5881

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

Review-Url: https://codereview.chromium.org/2445863002

7 years agoChange recipes to use bot_update
borenet [Tue, 25 Oct 2016 12:26:14 +0000 (05:26 -0700)]
Change recipes to use bot_update

NOTREECHECKS=true
BUG=skia:5588
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2448973002

Review-Url: https://codereview.chromium.org/2448973002

7 years agoHelp msvs compile SkColorSpaceXform faster
Matt Sarett [Mon, 24 Oct 2016 20:51:45 +0000 (16:51 -0400)]
Help msvs compile SkColorSpaceXform faster

Allowing MSVS to choose to not inline color_xform_RGBA
will prevent the complexity from exploding.

BUG=skia:

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

Change-Id: I31ab0754c6cc375d6d0e71ceb16afef1927bb4e3
Reviewed-on: https://skia-review.googlesource.com/3884
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Matt Sarett <msarett@google.com>

7 years agoMove third_party/gif's license into its own file
scroggo [Mon, 24 Oct 2016 20:58:28 +0000 (13:58 -0700)]
Move third_party/gif's license into its own file
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2448573002

Review-Url: https://codereview.chromium.org/2448573002

7 years agoDifferentiate animated image results
scroggo [Mon, 24 Oct 2016 20:48:49 +0000 (13:48 -0700)]
Differentiate animated image results

Prior to this CL, a kAnimated_Mode CodecSrc (which draws a strip of
all frames in an image) has the same name as a non-animated one. This
means that Gold compares the two. Someone triaging will see two very
different images (a strip versus a single image) and think one of them
is wrong.

With this change, the two will have different names so they will not
be compared with one another.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2446543003

Review-Url: https://codereview.chromium.org/2446543003

7 years agoPopulate ALL copies of a command line flag during parsing
Brian Osman [Mon, 24 Oct 2016 18:53:08 +0000 (14:53 -0400)]
Populate ALL copies of a command line flag during parsing

Now that we're declaring flags statically per-tool, we were only
setting the value on one of them (randomly) in the linked list.

BUG=skia:

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

Change-Id: I448cb7f42ee01a16daa65986b14aee9f1a2a3588
Reviewed-on: https://skia-review.googlesource.com/3881
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>

7 years agoRename GIFImageReader to SkGifImageReader
scroggo [Mon, 24 Oct 2016 19:28:30 +0000 (12:28 -0700)]
Rename GIFImageReader to SkGifImageReader

The former could violate One Definition Rule in Google3, since other
projects that are based on Chrome/webkit also have GIFImageReader.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2445653004

Review-Url: https://codereview.chromium.org/2445653004

7 years agoAdd gif sources to public.bzl.
Ben Wagner [Mon, 24 Oct 2016 18:11:12 +0000 (14:11 -0400)]
Add gif sources to public.bzl.

This also removes SK_HAS_GIF_LIBRARY since it does not appear in the
code.

Change-Id: I6e4d6ed560eb2877e6db61edf15f6be832166b44
Reviewed-on: https://skia-review.googlesource.com/3752
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>

7 years agoFix fuzzer's bools to be 0 or 1 only
kjlubick [Mon, 24 Oct 2016 18:53:35 +0000 (11:53 -0700)]
Fix fuzzer's bools to be 0 or 1 only

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

Review-Url: https://codereview.chromium.org/2447823002

7 years agoUse SK_ALWAYS_INLINE in SkColorSpaceXform
Matt Sarett [Mon, 24 Oct 2016 15:38:08 +0000 (11:38 -0400)]
Use SK_ALWAYS_INLINE in SkColorSpaceXform

Two reasons for this:
(1) We care about the performance of this code, and Windows isn't
very good at inlining.  Let's make sure we isntruct the compiler
to inline.
(2) Since landing uses of this in Chrome, we're seeing flaky
LayoutTests that appear to be timing related.  I'm (very
optimistically) hoping that this will help.

BUG=skia:

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

Change-Id: Ibb6d9c4252c0b8ce62203fe65c7dd296248982c8
Reviewed-on: https://skia-review.googlesource.com/3744
Commit-Queue: Matt Sarett <msarett@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
7 years agoClear background to white in animatedGif GM
scroggo [Mon, 24 Oct 2016 16:59:53 +0000 (09:59 -0700)]
Clear background to white in animatedGif GM

White looks the same in 565, reducing the number of differences in gold
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2447793002

Review-Url: https://codereview.chromium.org/2447793002

7 years agoInclude "SkBitmap.h" in CodecAnimTest.cpp
scroggo [Mon, 24 Oct 2016 16:56:40 +0000 (09:56 -0700)]
Include "SkBitmap.h" in CodecAnimTest.cpp

Fixes build
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2449513002

Review-Url: https://codereview.chromium.org/2449513002

7 years agoRefactored SkColorSpace_A2B to allow arbitrary ordering of elements
raftias [Mon, 24 Oct 2016 16:52:26 +0000 (09:52 -0700)]
Refactored SkColorSpace_A2B to allow arbitrary ordering of elements

This is essential for representing non-lutAtoBType A2B tags such as
lut16Type, lut8Type, mpet. Parsing of A2B0 tags was also moved ahead
of the TRC/XYZ-matrix parsing, as profiles examined with both tags
either had the TRC/XYZ tags as a fall-back or were incorrectly displayed
if only the TRC/XYZ tags were used.

This was submitted alone to reduce CL size. Tests that will use these changes will be introduced in the subsequent CLs that add on lut8/16Type A2B0 parsing. We already have lut16Type test images and these have been tested locally, but require additional code not submitted yet for lut16Type ICC profile parsing and A2B colorspace xforms.

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

Review-Url: https://codereview.chromium.org/2444553002

7 years agoPrint what crashed DM on Android too.
Mike Klein [Mon, 24 Oct 2016 15:39:43 +0000 (11:39 -0400)]
Print what crashed DM on Android too.

This doesn't print a backtrace, but it's better than nothing.
By preserving the original signal handler and calling into that, we keep the Android system stack trace, visible in logcat, the "dump log" step on bots.

Tested locally on Mac and Android by making an arbitrary GM segfault.

BUG=skia:5876

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

Change-Id: Ia7a962ca50e09d370423a6106033e34c47d7643d
Reviewed-on: https://skia-review.googlesource.com/3860
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>

7 years agoSkShader* refAs... to sk_sp<SkShader> makeAs...
Ben Wagner [Mon, 24 Oct 2016 15:36:21 +0000 (11:36 -0400)]
SkShader* refAs... to sk_sp<SkShader> makeAs...

There appear to be no existing overriders of the refAs.. method outside
Skia.

Change-Id: Iab174e83023093b4d7fc0bd8907666b66ddb1eea
Reviewed-on: https://skia-review.googlesource.com/3746
Reviewed-by: Ben Wagner <benjaminwagner@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>

7 years agoUpdate trooper doc with chrome-infra chat.
Ben Wagner [Mon, 24 Oct 2016 15:27:30 +0000 (11:27 -0400)]
Update trooper doc with chrome-infra chat.

BUG=skia:

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3745
NOTRY=true
DOCS_PREVIEW= https://skia.org/?cl=3745

Change-Id: Icc9b52a7b4bc90f4ef8d8b952d49663f74104ba9
Reviewed-on: https://skia-review.googlesource.com/3745
Reviewed-by: Ravi Mistry <rmistry@google.com>
Commit-Queue: Ben Wagner <benjaminwagner@google.com>

7 years agoAdd support for multiple frames in SkCodec
scroggo [Mon, 24 Oct 2016 16:03:26 +0000 (09:03 -0700)]
Add support for multiple frames in SkCodec

Add an interface to decode frames beyond the first in SkCodec, and
add an implementation for SkGifCodec.

Add getFrameData to SkCodec. This method reads ahead in the stream
to return a vector containing meta data about each frame in the image.
This is not required in order to decode frames beyond the first, but
it allows a client to learn extra information:
- how long the frame should be displayed
- whether a frame should be blended with a prior frame, allowing the
  client to provide the prior frame to speed up decoding

Add a new fields to SkCodec::Options:
- fFrameIndex
- fHasPriorFrame

The API is designed so that SkCodec never caches frames. If a
client wants a frame beyond the first, they specify the frame in
Options.fFrameIndex. If the client does not have the
frame's required frame (the frame that this frame must be blended on
top of) cached, they pass false for
Options.fHasPriorFrame. Unless the frame is
independent, the codec will then recursively decode all frames
necessary to decode fFrameIndex. If the client has the required frame
cached, they can put it in the dst they pass to the codec, and the
codec will only draw fFrameIndex onto it.

Replace SkGifCodec's scanline decoding support with progressive
decoding, and update the tests accordingly.

Implement new APIs in SkGifCodec. Instead of using gif_lib, use
GIFImageReader, imported from Chromium (along with its copyright
headers) with the following changes:
- SkGifCodec is now the client
- Replace blink types
- Combine GIFColorMap::buildTable and ::getTable into a method that
  creates and returns an SkColorTable
- Input comes from an SkStream, instead of a SegmentReader. Add
  SkStreamBuffer, which buffers the (potentially partial) stream in
  order to decode progressively.
  (FIXME: This requires copying data that previously was read directly
  from the SegmentReader. Does this hurt performance? If so, can we
  fix it?)
- Remove UMA code
- Instead of reporting screen width and height to the client, allow the
  client to query for it
- Fail earlier if the first frame AND screen have size of zero
- Compute required previous frame when adding a new one
- Move GIFParseQuery from GIFImageDecoder to GIFImageReader
- Allow parsing up to a specific frame (to skip parsing the rest of the
  stream if a client only wants the first frame)
- Compute whether the first frame has alpha and supports index 8, to
  create the SkImageInfo. This happens before reporting that the size
  has been decoded.

Add GIFImageDecoder::haveDecodedRow to SkGifCodec, imported from
Chromium (along with its copyright header), with the following changes:
- Add support for sampling
- Use the swizzler
- Keep track of the rows decoded
- Do *not* keep track of whether we've seen alpha

Remove SkCodec::kOutOfOrder_SkScanlineOrder, which was only used by GIF
scanline decoding.

Call onRewind even if there is no stream (SkGifCodec needs to clear its
decoded state so it will decode from the beginning).

Add a method to SkSwizzler to access the offset into the dst, taking
subsetting into account.

Add a GM that animates a GIF.
Add tests for the new APIs.

*** Behavior changes:
* Previously, we reported that an image with a subset frame and no transparent
index was opaque and used the background index (if present) to fill the
background. This is necessary in order to support index 8, but it does not
match viewers/browsers I have seen. Examples:
- Chromium and Gimp render the background transparent
- Firefox, Safari, Linux Image Viewer, Safari Preview clip to the frame (for
  a single frame image)
This CL matches Chromium's behavior and renders the background transparent.
This allows us to have consistent behavior across products and simplifies
the code (relative to what we would have to do to continue the old behavior
on Android). It also means that we will no longer support index 8 for some
GIFs.
* Stop checking for GIFSTAMP - all GIFs should be either 89a or 87a.
This matches Chromium. I suspect that bugs would have been reported if valid
GIFs started with "GIFVER" instead of "GIF89a" or "GIF87a" (but did not decode
in Chromium).

*** Future work not included in this CL:
* Move some checks out of haveDecodedRow, since they are the same for the
  entire frame e.g.
- intersecting the frameRect with the full image size
- whether there is a color table
* Change when we write transparent pixels
- In some cases, Chromium deemed this unnecessary, but I suspect it is slower
  than the fallback case. There will continue to be cases where we should
  *not* write them, but for e.g. the first pass where we have already
  cleared to transparent (which we may also be able to skip) writing the
  transparent pixels will not make anything incorrect.
* Report color type and alpha type per frame
- Depending on alpha values, disposal methods, frame rects, etc, subsequent
  frames may have different properties than the first.
* Skip copies of the encoded data
- We copy the encoded data in case the stream is one that cannot be rewound,
  so we can parse and then decode (possibly not immediately). For some input
  streams, this is unnecessary.
  - I was concerned this cause a performance regression, but on average the
    new code is faster than the old for the images I tested [1].
  - It may cause a performance regression for Chromium, though, where we can
    always move back in the stream, so this should be addressed.

Design doc:
https://docs.google.com/a/google.com/document/d/12Qhf9T92MWfdWujQwCIjhCO3sw6pTJB5pJBwDM1T7Kc/

[1] https://docs.google.com/a/google.com/spreadsheets/d/19V-t9BfbFw5eiwBTKA1qOBkZbchjlTC5EIz6HFy-6RI/

GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=2045293002

Review-Url: https://codereview.chromium.org/2045293002

7 years agofix a few more fuzzes
caryclark [Mon, 24 Oct 2016 15:41:45 +0000 (08:41 -0700)]
fix a few more fuzzes

Minor changes to fix some fuzz conditions.
A couple of ignored asserts when the data
is fuzzy, and one fail condition when the
underlying data has already been deleted.

TBR=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2443243002

Review-Url: https://codereview.chromium.org/2443243002

7 years agoFix RecreateSKPs recipe to correctly fail when the upload fails
borenet [Mon, 24 Oct 2016 15:40:26 +0000 (08:40 -0700)]
Fix RecreateSKPs recipe to correctly fail when the upload fails

BUG=skia:5879
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2446633002

Review-Url: https://codereview.chromium.org/2446633002

7 years agonc seal breaks simplify
caryclark [Mon, 24 Oct 2016 15:19:06 +0000 (08:19 -0700)]
nc seal breaks simplify

This test has nearly coincident lines that are missorted.
The underlying bug is caused when a pair of curves
are coincident when reduced to line segments, but the
end points aren't detected.

The error was generated by running nanobench over all svg
sample data with the distance field patch installed.

TBR=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2440043003

Review-Url: https://codereview.chromium.org/2440043003

7 years agoRename all color space factories from New* to Make*
Brian Osman [Mon, 24 Oct 2016 13:24:02 +0000 (09:24 -0400)]
Rename all color space factories from New* to Make*

Matches our naming convention for all other types - factories that
return sk_sp (or any type that intelligently manages its own
lifetime) are named Make.

Previous factories are still around, assuming
SK_SUPPORT_LEGACY_COLOR_SPACE_FACTORIES is defined. Enable that
define for Android, etc.

See also: https://codereview.chromium.org/2442053002/

BUG=skia:

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

Change-Id: Iaea9376490736b494e8ffc820831f052bbe1478d
Reviewed-on: https://skia-review.googlesource.com/3822
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
7 years agoAdd infra recipe module, use for updating Go DEPS
borenet [Mon, 24 Oct 2016 13:36:30 +0000 (06:36 -0700)]
Add infra recipe module, use for updating Go DEPS

BUG=skia:5879
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2444883002

Review-Url: https://codereview.chromium.org/2444883002

7 years agoformalize host debugging
caryclark [Mon, 24 Oct 2016 12:10:14 +0000 (05:10 -0700)]
formalize host debugging

Pathops writes files, anticipating upcoming crashes,
and verifies the results against regions.

Formalize these debugging methods so that they
are more easily triggered by hosts outside of
skia unit tests.

TBR=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2441763003

Review-Url: https://codereview.chromium.org/2441763003

7 years agofix one more fuzzer
caryclark [Mon, 24 Oct 2016 11:53:22 +0000 (04:53 -0700)]
fix one more fuzzer

TBR=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2438333002

Review-Url: https://codereview.chromium.org/2438333002

7 years agoRoll recipe DEPS
borenet [Mon, 24 Oct 2016 11:46:57 +0000 (04:46 -0700)]
Roll recipe DEPS

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

Review-Url: https://codereview.chromium.org/2443133002

7 years agoFall back from analytic to sampling earlier
liyuqian [Fri, 21 Oct 2016 20:38:10 +0000 (13:38 -0700)]
Fall back from analytic to sampling earlier

This magically fixes some strange js unit tests in Chrome. Those tests
only fail in virtual/gpu which somehow interacts with my cpu rasterizer?

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

Review-Url: https://chromiumcodereview.appspot.com/2439973004

7 years agouse conservative-clip-bit in pipecanvas
Mike Reed [Fri, 21 Oct 2016 17:51:49 +0000 (13:51 -0400)]
use conservative-clip-bit in pipecanvas

BUG=skia:

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

Change-Id: I18bbcf0fa715c8136355812997766b0f7d8412b6
Reviewed-on: https://skia-review.googlesource.com/3821
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>

7 years agoRoll common DEPS
borenet [Fri, 21 Oct 2016 19:01:12 +0000 (12:01 -0700)]
Roll common DEPS

BUG=skia:
NOTRY=true
NOTREECHECKS=true
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2435333002

Review-Url: https://chromiumcodereview.appspot.com/2435333002

7 years agoNew helpers for converting SkColor to GrColor4f
Brian Osman [Thu, 20 Oct 2016 20:53:45 +0000 (16:53 -0400)]
New helpers for converting SkColor to GrColor4f

These versions will eliminate lots of copy-pasting in various fragment
processor creation code.

BUG=skia:

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

Change-Id: I3ada2d4866e92cfc0507beeea11e05790d73757d
Reviewed-on: https://skia-review.googlesource.com/3787
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>

7 years agoAnother forgotten forceRLE
liyuqian [Fri, 21 Oct 2016 16:07:41 +0000 (09:07 -0700)]
Another forgotten forceRLE

BUG=skia:
TBR=reed@google.com,caryclark@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2438163003

Review-Url: https://chromiumcodereview.appspot.com/2438163003

7 years agoAdd Android viewer to GN
Jim Van Verth [Fri, 21 Oct 2016 14:58:52 +0000 (10:58 -0400)]
Add Android viewer to GN

BUG=skia:

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

Change-Id: If971e275ed377cd733d01f62622d408479632465
Reviewed-on: https://skia-review.googlesource.com/3761
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
7 years agoadd pipe to nanobench
Mike Reed [Fri, 21 Oct 2016 14:43:36 +0000 (10:43 -0400)]
add pipe to nanobench

BUG=skia:

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

Change-Id: Ia0b90b1e2947a7b9ae7cb340ef5cd5b3251bbd23
Reviewed-on: https://skia-review.googlesource.com/3801
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>

7 years agoFix for Chrome MSAN
Matt Sarett [Fri, 21 Oct 2016 13:25:54 +0000 (09:25 -0400)]
Fix for Chrome MSAN

I believe that the complaints are occurring because the |a| vector
might be uninitialized where it is used here.  It doesn't actually
matter because we won't use or store that value - it's just a
placeholder.

But we need to make the bot happy.

BUG=skia:

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

Change-Id: I1891da9d1d2708008e4606daebf9bb6f96e92fc0
Reviewed-on: https://skia-review.googlesource.com/3800
Commit-Queue: Matt Sarett <msarett@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
7 years agoRemove SkRRectsGaussianEdgeShader
Robert Phillips [Thu, 20 Oct 2016 17:20:45 +0000 (13:20 -0400)]
Remove SkRRectsGaussianEdgeShader

This class is no longer used.

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

Change-Id: I16634760df6b31c7e97c893b7e2b982cd7b1d1fd
Reviewed-on: https://skia-review.googlesource.com/3734
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>

7 years ago[Sk4fGradient] Use infinity floats for clamp-mode extreme positions
fmalita [Fri, 21 Oct 2016 13:02:22 +0000 (06:02 -0700)]
[Sk4fGradient] Use infinity floats for clamp-mode extreme positions

In clamp mode, we use a couple of synthetic edges that are supposed to
extend to +/- infinity (-inf .. P0 and Pn .. inf).  Currently we use
SK_ScalarMin/Max, but these can be overrun with large/malicious inputs.

Use SK_ScalarInfinity/SK_ScalarNegativeInfinity instead, and tweak
compute_interval_props() to handle inf values gracefully.

BUG=skia:5835
R=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2441733002

Review-Url: https://chromiumcodereview.appspot.com/2441733002

7 years agoZero tail stack buffers.
Mike Klein [Thu, 20 Oct 2016 22:30:11 +0000 (18:30 -0400)]
Zero tail stack buffers.

MSAN and the no-SIMD bots have noticed the top lanes of the tail vectors are  not initialized.

As they were written it was faster to leave them unintialized, but as re-written here it's equal speed and now safe.

CQ_INCLUDE_TRYBOTS=master.client.skia:Perf-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-MSAN-Trybot,Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot

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

Change-Id: Icd41ba14ae6baf9947eb361a366f1ce19ad8aa67
Reviewed-on: https://skia-review.googlesource.com/3790
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>

7 years agoSkRasterPipeline_opts: split next() into next_body() and next_tail().
Mike Klein [Thu, 20 Oct 2016 22:05:23 +0000 (18:05 -0400)]
SkRasterPipeline_opts: split next() into next_body() and next_tail().

This may work around an Chrome/MSVC/PGO compiler crasher.
Even if not, it's harmless for performance, and arguably more readable.

BUG=skia:

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

Change-Id: I0bf23f65d7832b9f43e275f85e7985fcd6b13b9f
Reviewed-on: https://skia-review.googlesource.com/3789
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Mike Klein <mtklein@chromium.org>
7 years agoSkScalerContext to use smart pointers.
bungeman [Thu, 20 Oct 2016 20:06:52 +0000 (16:06 -0400)]
SkScalerContext to use smart pointers.

CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-ASAN-Trybot;master.client.skia:Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-MSAN-Trybot

Change-Id: I27a714388b8ded7dfc968e322b0a587205f575f1
Reviewed-on: https://skia-review.googlesource.com/3731
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>

7 years agoSkRasterPipeline: memcpy-free tail code.
Mike Klein [Thu, 20 Oct 2016 20:20:46 +0000 (16:20 -0400)]
SkRasterPipeline: memcpy-free tail code.

We don't call the tail code nearly as often as the body code, but when we do and call memcpy(), we first have to vzeroupper back into the non-AVX world.  That does seem to slow things down considerably.  You wouldn't think it, but this gives a nice speed up (tested on Windows).

BUG=skia:

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

Change-Id: I40cbe1e529f2431825edec7638265601b64e7ec5
Reviewed-on: https://skia-review.googlesource.com/3783
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>

7 years agoremove 4 legacy flags (clients already updated)
Mike Reed [Thu, 20 Oct 2016 20:40:26 +0000 (16:40 -0400)]
remove 4 legacy flags (clients already updated)

BUG=skia:

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

Change-Id: I187e50e09ed7a3316719fae51af770259928fdf9
Reviewed-on: https://skia-review.googlesource.com/3785
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>

7 years agoQuickly fix the forgotten forceRLE
liyuqian [Thu, 20 Oct 2016 21:01:52 +0000 (14:01 -0700)]
Quickly fix the forgotten forceRLE

BUG=skia:
TBR=reed@google.com,caryclark@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2436593004

Review-Url: https://chromiumcodereview.appspot.com/2436593004