Re-land; layout tests are suppressed and gm differences are understood.
A merge conflict prevented a automatic reland.
If the endcap is not butt, draw the endcaps even when the line
has zero length.
If the dash length is zero, generate a zero length line segment.
Treat a move followed by a close as a move followed by a zero-length
line.
TBR=reed@google.com
BUG=422974
Review URL: https://codereview.chromium.org/1314213002
Unfortunately, immintrin.h (which is also included by SkTypes)
includes xmmintrin.h which includes mm_malloc.h which includes
stdlib.h for malloc even though, from the implementation, it is
difficult to see why.
Fortunately, arm_neon.h does not seem to be involved in such
shenanigans, so building for Android will keep things sane.
TBR=reed@google.com
Doesn't change Skia API, just moves an include.
Review URL: https://codereview.chromium.org/1313203003
The motivation for this was to remove SK_OFFSETOF from SkTypes, but
this CL is mostly about cleaning up our use of offsetof generally.
SK_OFFSETOF is removed to SkTypes and added to the two places it is
actually used (for the non standard behavior of finding the offset of
fields in types which are not standard layout).
Older versions of gcc required POD for offsetof to be used without
warning. Newer versions require the more relaxed standard layout.
Now that we no longer build on older versions of gcc, remove the
old warning suppressions.
PODMatrix is renamed to AggregateMatrix. SkMatrix is already POD
(trivial and standard layout). The PODMatrix name implies that the
POD-ness is needed for the offsetof, but it is actually the aggregate
attribute which is needed for compile time constant initialization.
This makes it more obvious that this can be revisited after we can
rely on constexpr constructors.
This also adds skstd::declval since this allows removal of existing
awkward code which casts a constant to a pointer to find the size of
a field.
TBR=reed@google.com
No API change, only removes unused macro.
Review URL: https://codereview.chromium.org/1309523003
Looks like the -Wmicrosoft warnings in the bug are coming up specificically
because many the effects in SkLightingImageFilter are defined inside an
anonymous namespace (spanning, I think, lines 33-702 today).
BUG=skia:4091
No public API changes.
TBR=reed@google.com
Review URL: https://codereview.chromium.org/1311783004
CL (1 of 3) adds empty lists in our .gypi,
and builds the files in those empty lists with the appropriate flags.
CL (2 of 3) will have Chrome's GYP and GN files read these lists,
and build them with the appropriate flags.
CL (3 of 3) will add runtime detection and stub files to the lists
with empty Init_sse42(), Init_avx(), Init_avx2() methods.
After that, we should be able to use SSE 4.2, AVX, and AVX2 if desired.
Some motivation:
- SSE 4.2 adds some sweet string-oriented methods that
can help us write fast high quality 32-bit hashes.
- AVX is SSE doubled, e.g. 8 floats or two SkPMFloat at a time.
- AVX2 is SSE2 doubled, e.g. 8 pixels at a time.
BUG=skia:4117
Review URL: https://codereview.chromium.org/1290423007
Reason for revert:
More GMs changed than I expected. Will probably affect layout tests as well; reverting until I can verify that the changes are correct.
Original issue's description:
> experiment with zero-length round capped line segments
>
> If the endcap is not butt, draw the endcaps even when the line
> has zero length.
>
> If the dash length is zero, generate a zero length line segment.
>
> Treat a move followed by a close as a move followed by a zero-length
> line.
>
> R=reed@google.com,schenney@google.com
> BUG=422974
>
> Committed: https://skia.googlesource.com/skia/+/dd3c165828fffb369d0f4b13b48381169a0249a9TBR=reed@google.com,schenney@google.com,schenney@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=422974
Review URL: https://codereview.chromium.org/1304163008
If the endcap is not butt, draw the endcaps even when the line
has zero length.
If the dash length is zero, generate a zero length line segment.
Treat a move followed by a close as a move followed by a zero-length
line.
R=reed@google.com,schenney@google.com
BUG=422974
Review URL: https://codereview.chromium.org/1309753002
Reason for revert:
This causes a syntax error.
http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_compile_dbg_ng/builds/87819/steps/compile%20%28with%20patch%29/logs/stdio
Original issue's description:
> Implement canComputeFastBounds() for image filters.
>
> Image filters have never implemented this check, which means that
> filters which affect transparent black falsely claim they can compute
> their bounds.
>
> Implemented an affectsTransparentBlack() virtual for image
> filters, and a similar helper function for color filters.
>
> This will affect the following GMs: imagefiltersscaled
> (lighting, perlin noise now filter to clip),
> colorfilterimagefilter (new test case), imagefiltersclipped
> (perlin noise now filters to clip).
>
> Note: I de-inlined SkPaint::canComputeFastBounds() to avoid adding
> a dependency from SkPaint.h to SkImageFilter.h.h. Skia benches show
> no impact from this change, but will watch the perf bots carefully.
>
> BUG=4212
>
> Committed: https://skia.googlesource.com/skia/+/915881fe743f9a789037695f543bc6ea189cd0cbTBR=reed@google.com,senorblanco@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=4212
Review URL: https://codereview.chromium.org/1300403003
Image filters have never implemented this check, which means that
filters which affect transparent black falsely claim they can compute
their bounds.
Implemented an affectsTransparentBlack() virtual for image
filters, and a similar helper function for color filters.
This will affect the following GMs: imagefiltersscaled
(lighting, perlin noise now filter to clip),
colorfilterimagefilter (new test case), imagefiltersclipped
(perlin noise now filters to clip).
Note: I de-inlined SkPaint::canComputeFastBounds() to avoid adding
a dependency from SkPaint.h to SkImageFilter.h.h. Skia benches show
no impact from this change, but will watch the perf bots carefully.
BUG=4212
Review URL: https://codereview.chromium.org/1296943002
SkTemplates.h contains a number of Skia specific utilities which are
not designed for external use. In addition to reducing the external
support burden, this will allow Skia to freely refactor this file.
Review URL: https://codereview.chromium.org/1272293004
By adding a cast to SK_ARRAY_COUNT, the compiler treats the
compile-time value as if it were a const int, and like regular
numbers, permits it to be compared to signed and unsigned
numbers freely.
R=reed@google.com
Review URL: https://codereview.chromium.org/1299943002
Old flow to serialize a picture:
1) serialize picture ops
2) serialize all sub pictures recursively
3) flatten the rest of this picture into a buffer, deduping flattenable factories and typefaces as we go
4) serialize the factories and typefaces
5) serialize the bytes from 3)
This allows the data in step 5) to refer to the deduplicated factories and typefaces from step 4). But, each sub picture in step 2) is completely siloed, so they can't dedup with the parent picture or each other.
New flow:
1) serialize picture ops
2) flatten the rest of this picture into a buffer, deduping flattenable factories and typefaces as we go
3) dummy-serialize sub pictures into /dev/null, with the effect of adding any new typefaces to our dedup set
4) serialize the factories and typefaces
5) serialize the bytes from 2)
6) serialize all sub pictures recursively, with perfect deduplication because of step 3).
Now all typefaces in the top-level picture and all sub pictures recursively should end up deduplicated in the top-level typeface set.
Decoding changes are similar: we just thread through the top-level typefaces to the sub pictures. What's convenient / surprising is that this new code correctly reads old pictures if we just have each picture prefer its local typeface set over the top-level one: old pictures always just use their own typefaces, and new pictures always use the top-level ones.
BUG=skia:4092
Review URL: https://codereview.chromium.org/1233953004
To do this, create SkImageCacherator, which wraps a generator and provides an
interface to get a cached answer for either the raster or texture output of
the generator.
BUG=skia:
Review URL: https://codereview.chromium.org/1291803002
This allows removal the difficult to use (and so currently unused)
placement new and related macros to allow any constructor of T to
be used to initilize the storage of SkTLazy. This also properly
aligns the SkTLazy storage.
Review URL: https://codereview.chromium.org/1283183003