Commit Graph

868 Commits

Author SHA1 Message Date
Michael Ludwig
747c31e296 Hide SkImageFilter::CropRect
Moves the (SkRect + flags) struct into SkImageFilter_Base with protected
access only. Base constructor and all src/effects/imagefilters Make
functions now take a "const SkRect*" instead. CropRect is still what's
stored and used by filter implementations during filterImage(), but it's
no longer publicly available.

The SkImageFilters factory implementations now can go straight to the
Make functions in src/effects/imagefilters instead of wrapping its
"const SkRect*" in an SkImageFilter::CropRect.

Bug: skia:9296, skia:11230
Change-Id: I2c62f42031910ec405623d4519c8a434cd2b3bdd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361496
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
2021-01-30 16:10:29 +00:00
Michael Ludwig
ed552f8702 Move deprecated image filter headers out of include/ and into src/
Bug: skia:9310
Change-Id: I387f0251f05a2b6f2bc5a759f608d5766ed11ce2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/357285
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2021-01-28 00:41:21 +00:00
Brian Salomon
04aef10c64 Add SkRuntimeEffect::makeImage()
Allows creation of an image directly from a RTE. Caller provides the
effect input bindings, image info for the image, and optional local
matrix.

The info's alpha type and colorspace are tags for the output image. No
alpha type or color space conversions are applied to the output of RTE.

CPU does not yet support making kUnpremul images.

Bug: chromium:1151490

Change-Id: I69babc9dbbce4431d756cd7a3eef4753e727d6fe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/357284
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-01-23 17:40:23 +00:00
Derek Sollenberger
9e1cedda63 Add generic uniform setter function to SkRuntimeShaderBuilder
Change-Id: Idab539a4b39fe5ceab54948c99c0dcd6d19fd345
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/352743
Commit-Queue: Derek Sollenberger <djsollen@google.com>
Auto-Submit: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2021-01-14 14:38:18 +00:00
Brian Salomon
4878b3e33c Remove Improved Perlin Noise
Is not used by a major client and can be implemented using runtime
effects for users who want this noise.

Bug: skia:10536
Change-Id: Iaa06e6e1406b808c7f8dc0f76621fecf2becabf5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/352057
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-01-11 15:27:26 +00:00
Brian Osman
0a442b71b0 New SkSL code generator that emits directly to skvm
Still TODO:
- Function calls. Can do these by inlining everything (recursively).
- Additional flow control: ES2 for loops can be supported (via
  unrolling), and switch() can be implemented. (Was never done in
  ByteCode).
- Uniforms and params have been set up to work very generically (caller
  just supplies IDs, the generator collates everything into a master
  working list). Builtins should work the same way (caller supplies a
  map of builtin ID -> skvm::Val[]?), so that we don't need a special
  case for device coord.
- Figure out integer type policy. Today, it's a mix of only supporting
  signed integers, and just treating all integers as signed, even if
  they're not.
- Now that defining intrinsics is *much* simpler, stop defining so many
  of them in sksl_public.sksl, and just implement them here.

Change-Id: Id9771444ce54ccf8e6e408c44ebb3780c1170435
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/341980
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-12-17 19:16:25 +00:00
Michael Ludwig
a2c40206c6 Preserve dithering for SkImageFilters::Shader
Migrating chromium code to use SkImageFilters::Shader over
SkPaintImageFilter requires dithering to be preserved for its gradient
fills.

I debated always forcing it to true, but dithering was never turned on
for the turbulence filter and it's not necessary for const color shaders
Given that, I opted to just make it a parameter to the filter factory,
which seems okay since we're unlikely to embed dithering into SkShader
itself, it's a shading-related parameter of SkPaint, and if we migrate
to always dithering, then we can remove it.

Bug: skia:9310
Change-Id: I86f14969e2446f3a84e71e687cb263bcd44cf9d9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/338156
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-11-25 19:41:37 +00:00
Michael Ludwig
4757a60871 Accept SkFilterQuality in SkImageFilters::Shader
This is needed to help ease the migration from SkImageFilters::Paint,
until image shaders always force you to embed sampling options.

Change-Id: Id8dc8c3196a7935073677a5fbb8d35c3bd22f9ba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/333757
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-11-13 22:46:20 +00:00
Brian Osman
d7e7659cad Move GrShaderCaps from Program::Settings to Compiler
This ties the caps to the compiler instance, paving the way for
pre-optimizing the shared code. Most of the time, the compiler is
created and owned the GPU instance, so this is fine. For runtime
effects, we now use the shared (device-agnostic) compiler instance
for the first compile, even on GPU. It's configured with caps that
apply no workarounds. We pass the user's SkSL to the backend as
cleanly as possible, and then apply any workarounds once it's part
of the full program.

Bug: skia:10905
Bug: skia:10868
Change-Id: Ifcf8d7ebda5d43ad8e180f06700a261811da83de
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331493
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-11-04 19:38:33 +00:00
Michael Ludwig
01b93eabe2 Add SkImageFilters::Blend rename for Xfermode filter
This better matches SkShaders::Blend and SkColorFilters::Blend factories.

Bug: skia:9310
Change-Id: I02a3fe488a446b803df96518caacff1fdf536e9f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324623
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-10-13 14:28:26 +00:00
Michael Ludwig
c98d5b6250 Expand image filter factories to accept more types for crop rects
The original SkIRect* crop rect argument was a little too onerous.
First, as a pointer, it required you to declare your crop rect separately
just to take a pointer to it. Now, you can pass an SkIRect or SkRect in
directly when you are explicitly constructing a cropped filter.

Second, the crop rect is transformed by the same matrix as the other
filter parameters, so it can be scaled and translated. Allowing SkRect
instead of just SkIRect gives more precision and flexibility for local
coordinate systems. Now a crop rect could be defined to be from [-.5, .5]
and still map to real pixels after transformation (this was a request
from the skia-discuss mailing list, and also better matches the SVG spec).

The crop rect argument was always meant to be a convenience, since I
plan to refactor cropping into an indenendent image filter that will
give more explicit control over when the crop is applied in the DAG.
To maintain the convenience for the factories, the constructors of
the new CropRect type are not explicit so that callers don't ever need
to concern themselves with it.

Bug: skia:9296
Change-Id: I29a684cb925f1fca4dabc803114ab2b125660aaa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324622
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-10-12 20:25:43 +00:00
Michael Ludwig
7d0f853158 Add SkImageFilters::Shader in place of Paint factory
SkImageFilters::Paint did not use every slot of the SkPaint, with only
its color, alpha, color filter, and shader having a meaningful effect on
the image filter result. It was always blended into a transparent dst,
so blend mode wasn't very relevant, and it was always filled to whatever
required geometry, so stroke style, path effect, and mask filters were
ignored or not well specified.

Color, alpha, and color filter can all be combined into an SkShader, so
a more constrained SkImageFilters::Shader provides the same useful
capabilities without as many surprises.

SkImageFilters::Paint still exists, but is deprecated to be removed
once I've confirmed clients aren't depending on it.

Bug: skia:9310
Change-Id: I11a82bda1a5d440726cf4e2b5bfaae4929568679
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323680
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-10-08 22:51:13 +00:00
John Stiles
7571f9e490 Replace 'typedef xxxxx INHERITED' with 'using INHERITED = xxxx;'.
Mechanically updated via Xcode "Replace Regular Expression":

  typedef (.*) INHERITED;
    -->
  using INHERITED = $1;

The ClangTidy approach generated an even larger CL which would have
required a significant amount of hand-tweaking to be usable.

Change-Id: I671dc9d9efdf6d60151325c8d4d13fad7e10a15b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314999
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-03 03:41:26 +00:00
Brian Osman
a73c9d7606 Make some internal runtime effect API private
No public user needs these.

Change-Id: Ieeb519a0778b01697c9bbb3b91ce8423eaa94e57
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314316
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-09-01 14:51:29 +00:00
Brian Osman
b6bd0d2094 Make SkRuntimeShaderBuilder safe for reuse
Previously, if you snapped off a shader and then changed uniforms
(without drawing & flushing), we'd trigger the SkData assert about
calling writeable_data when not-uniquely-owned. Now we lazily copy the
SkData when necessary.

Includes unit test that previously failed.

Bug: skia:10667
Change-Id: If8d9dd8106d41e66560d760cb36ed83371791fc7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313678
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-08-27 16:09:37 +00:00
Brian Osman
a4b9169fb6 Remove 'in' variables from SkRuntimeEffect
Runtime effects previously allowed two kinds of global input variables:
'in' variables could be bool, int, or float. 'uniform' could be float,
vector, or matrix. Uniform variables worked like you'd expect, but 'in'
variables were baked into the program statically. There was a large
amount of machinery to make this work, and it meant that 'in' variables
needed to have values before we could make decisions about program
caching, and before we could catch some errors. It was also essentially
syntactic sugar over the client just inserting the value into their SkSL
as a string. Finally: No one was using the feature.

To simplify the mental model, and make the API much more predictable,
this CL removes 'in' variables entirely. We no longer need to
"specialize" runtime effect programs, which means we can catch more
errors up front (those not detected until optimization). All of the API
that referred to "inputs" (the previous term that unified 'in' and
'uniform') now just refers to "uniforms".

Bug: skia:10593
Change-Id: I971f620d868b259e652b3114f0b497c2620f4b0c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309050
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-08-10 22:00:44 +00:00
Brian Osman
871aa74797 Add support for children to runtime color filters
Like shaders, sampling a null child will return the input color (in
this case, the output of the skia shader stage). This gives us a path
to removing the implicit input color passed to main, which is the real
goal. Using this to create more interesting color filters is also
possible, although we need to add the versions of sample() that take a
color to really unlock the potential.

Change-Id: I6a7506055120756497d7583f14d6f928180825fc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308515
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2020-08-07 14:50:36 +00:00
John Stiles
a6841be235 Enable ClangTidy check llvm-namespace-comment.
This fixes a large number of SkSL namespaces which were labeled as if
they were anonymous, and also a handful of other mislabeled namespaces.
Missing namespace-end comments have been added throughout.
A number of diffs are just indentation-related (adjusting 1- or 3-
space indents to 2-space).

Change-Id: I6c62052a0d3aea4ae12ca07e0c2a8587b2fce4ec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308503
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-08-06 19:07:52 +00:00
Brian Osman
92aac1e1b3 Disallow runtime effect color filters that depend on position
Some of these checks are currently redundant (we don't allow color
filters to have children right now). But the next CL will re-add that
capability, and the unit tests here will ensure we don't re-break things
by allowing child-sampling to violate the color filter invariant.

Change-Id: I54c10d8b1d1e376c13347296765185d42b9f644a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308285
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-08-06 16:06:47 +00:00
Brian Salomon
d007281c9a Fix clang 12 Wsuggest-override and Wsuggest-destructor-override
Change-Id: Ic44e24057b95bb014504f02a736fb4341afc8971
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304856
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-07-22 01:11:36 +00:00
Brian Osman
48a643daac SkRuntimeEffect: Always include GrTypesPriv, clean up variable type code
GrTypesPriv seems safe to include even without the GPU backend, which
lets us remove the condition from the struct layout. Hoisting and
reformatting the type conversion code just to make the core of the
factory easier to read. (More of this is coming).

Change-Id: I6e36b92789debc7b2630117c285c592ca7cbc37b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304001
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-07-20 16:33:03 +00:00
Brian Osman
1298bc46ac Change SampleMatrix to SampleUsage
It now tracks all sample calls of a child (matrix, explicit coords,
pass through). There is now just one registerChild() call, and the
sampling pattern of that child is fully determined by the SampleUsage
parameter.

Change-Id: Iaadcd325fca64a59f24192aadd06923c66362181
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299875
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-07-01 16:37:43 +00:00
Brian Osman
be1b837505 Support sample(matrix) with runtime effects
Added sksl_sample_chaining, which draws identically to
fp_sample_chaining, but uses runtime effects that implement each
strategy.

Change-Id: Ib54fbe4fc6d98b4a8e91cf0e3ae6b7e19283ad37
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299076
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2020-06-26 16:27:50 +00:00
Michael Ludwig
e88320baec Update how sample(matrix) calls are invoked in SkSL
This removes the kMixed type of SkSL::SampleMatrix. All analysis of FP
sampling due to parent-child relationships is tracked in flags on
GrFragmentProcessor now.

The sample strategy is tracked as follows:
- An FP marks itself as using the local coordinate builtin directly (automatically done for .fp code based on reference to sk_TransformedCoords2D[0]).
- This state propagates up the parent towards the root, marking FPs as using coordinates indirectly. We stop the propagation when we hit a parent FP that explicitly samples the child because it becomes the source of the child's coordinates.
   - If that parent references its local coordinates directly, that kicks off its own upwards propagation.
- Being sampled explicitly propagates down to all children, and effectively disables vertex-shader evaluation of transforms.
   - A variable matrix automatically marks this flag as well, since it's essentially a shortcut to (matrix expression) * coords.
- The matrix type also propagates down, but right now that's only for whether or not there's perspective.
   - This doesn't affect FS coord evaluation since each FP applies its action independently.
   - But for VS-promoted transforms, the child's varying may inherit perspective (or other more general matrix types) from the parent and switch from a float2 to a float3.
- A SampleMatrix no longer tracks a base or owner, GrFragmentProcessor exposes its parent FP. An FP's sample matrix is always owned by its immediate parent.
   - This means that you can have a hierarchy from root to leaf like: [uniform, none, none, uses local coords], and that leaf will have a SampleMatrix of kNone type. However, because of parent tracking, the coordinate generation can walk up to the root and detect the proper transform expression it needs to produce, and automatically de-duplicate across children.

Currently, all FP's that are explicitly sampled have a signature of (color, float2 coord). FP's that don't use local coords, or whose coords are promoted to a varying have a signature of (color).
   - In this case, the shader builder either updates args.fLocalCoords to point to the varying directly, or adds a float2 local to the function body that includes the perspective divide.

GrFragmentProcessor automatically pretends it has an identity coord transform if the FP is marked as referencing the local coord builtin. This allows these FPs to still be processed as part of GrGLSLGeometryProcessor::collectTransforms, but removes the need for FP implementations to declare an identity GrCoordTransform.
   - To test this theory, GrTextureEffect and GrSkSLFP no longer have coord transforms explicitly.
   - Later CLs can trivially remove them from a lot of the other effects.
   - The coord generation should not change because it detects in both cases that the coord transform matrices were identity.

GrGLSLGeometryProcessor's collectTransforms and emitTransformCode has been completely overhauled to recurse up an FP's parent pointers and collect the expressions that affect the result. It de-duplicates expressions between siblings, and is able to produce a single varying for the base local coord (either when there are no intervening transforms, or the root FP needs an explicit coordinate to start off with).


This also adds the fp_sample_chaining GM from Brian, with a few more configurations to fill out the cells.

Bug: skia:10396
Change-Id: I86acc0c34c9f29d6371b34370bee9a18c2acf1c1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297868
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-06-25 14:48:34 +00:00
Mike Reed
b11e627644 Move impl into SkColorFilterBase
No expected changes to results (or public call-sites)

Change-Id: Ia0c5cfe2dc3beda82d91454527eda2e68287afb6
Bug: skia:10426
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298559
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2020-06-25 00:26:11 +00:00
Ethan Nicholas
77968f0d32 Revert "fixed sample(..., matrix) with runtime effects"
This reverts commit fb5ede576d.

Reason for revert: major performance regression due to constant shader recompilation

Original change's description:
> fixed sample(..., matrix) with runtime effects
> 
> Change-Id: Id5b7f1b5e992c587be000e112706bedfe00c90fd
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294697
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

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

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

Change-Id: Ica8322e0eab8f00bfc1d4f6d33778eb6493b278f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295835
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2020-06-11 22:25:53 +00:00
Ethan Nicholas
fb5ede576d fixed sample(..., matrix) with runtime effects
Change-Id: Id5b7f1b5e992c587be000e112706bedfe00c90fd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294697
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-06-10 13:59:15 +00:00
Mike Reed
fd9745eee9 SkDrawLooper has not been supported by Skia for a while. Update dox and remove examples
Change-Id: I7ff5d06f85b5100947089c4376d98a2ab144a016
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292076
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2020-05-27 01:22:06 +00:00
Mike Reed
3e84312c0f add new patheffect for stroke-and-fill
Change-Id: I2212e547d3d15c65c20f2f8e10fda5f2ef832187
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291041
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2020-05-20 15:01:26 +00:00
Brian Osman
28590d54f5 Add 'shader' as an alias for 'fragmentProcessor'
Change-Id: I2d95c63de18125e6258709b48b03abd7904b7537
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/278596
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-05-15 13:52:15 +00:00
Brian Osman
b32d66b296 Add layout(srgb_unpremul) to SkSL
For 3 and 4 channel float uniforms, this states that the data supplied
is unpremul sRGB, and transforms that data to the destination color
space (still unpremul) automatically.

Change-Id: I1b420d2fd10640963fa8e6736af3747cfc6e7d5b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/286656
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-05-01 20:12:43 +00:00
Brian Osman
d9bde07f1e Add SkRuntimeShaderBuilder, clean up SkRuntimeEffect API a bit
Utility class for getting named access to uniforms and children of an
SkRuntimeEffect (also functions as an example of using the
SkRuntimeEffect public API).

Moved several internal SkRuntimeEffect functions to private, and added
findInput/findChild helpers.

Change-Id: I8c2e7745ea81670a49b7ab2f51ce44a8d8169278
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/286516
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-05-01 20:02:35 +00:00
Brian Osman
f59a961dc9 Add layout(marker) to SkSL
Allows for uniforms to be automatically populated with
marked canvas matrices:

SkSL:
  layout (marker=localToWorld) uniform float4x4 localToWorldMatrix;

C++:
  canvas->concat(...);
  canvas->markCTM("localToWorld");
  canvas->concat(...);
  canvas->drawFoo(...);

Any runtime effects created with that SkSL will have their
localToWorldMatrix uniform filled in with the CTM, ignoring
any transformation that happened before/above the markCTM
call. The marker needs to be a sequence of alphanumeric or
underscore characters, and match the string used in markCTM.

The marker can also be of the form "normals(<string>)", in
which case the uniform will be filled in with the transpose
of the inverse of the upper-left 3x3 portion of the CTM
identified by <string>. This is helpful for transforming
normal vectors, as is often done in lighting.

Change-Id: I7d1ca4dc3f8fabbe91b9bd2c8632013f26d2321a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/285376
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-04-30 13:44:40 +00:00
Mike Reed
b6af407d67 change Overdraw colorfilter to be pure sksl
About same speed on CPU as pipeline-callback

Change-Id: If8769bebb3c51b5ea61fc34d76dde0cfc16b8473
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/283871
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-04-16 19:15:01 +00:00
Ben Wagner
cc81e202b4 Take MorphologyImageFilter radii as SkScalar.
The morphology image filters work on pixels, so took the radii as
integers. However, these radii will be mapped through the CTM, so any
rounding should happen as late as possible or the effect will be overly
discretized.

Bug: skia:10110
Change-Id: I62ab6c37d0b4612690addc48c9bc473099ac36b9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/282636
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2020-04-09 18:27:17 +00:00
Florin Malita
0022f5cf1b [SkTrimPathEffect] Preserve wrap-around continuity
In inverted mode (Mode::kInverted), the trim result represents the
logical segment [stop..start] (wrapping around at the path's end).

We currently emit two segments [0..start] and [stop..1], in that
exact order.  This behavior breaks continuity for single closed
contour paths.

Update SkTrimPath to

1) emit the segments in the correct order ([stop..1],[0..start])

2) skip the connecting moveTo for closed paths

Bug: skia:10107
Change-Id: Icd280554ba7291c985f504793feff104df2a4a99
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281882
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-04-07 14:40:17 +00:00
Mike Klein
a9741ee25a first sksl on skvm
Exactly enough implemented to run

    fm --skvm -b cpu -s runtime_shader -w foo

This shader

     0: 0077 load2 0
    10: 00a2 pushimmediate 998277249(0.0039215688593685627)
    22: 0070 dup
    31: 0094 multiplyf2
    40: 0080 loaduniform 2
    50: 00a2 pushimmediate 1065353216(1.0)
    62: 00c1 store4 2
    71: 00b4 return 0

becomes this blitter, including matrix, blending, asserts, etc:

    17 registers, 57 instructions:
    0	r0 = uniform32 arg(0) 4
    1	r0 = to_f32 r0
    2	r1 = splat 3F000000 (0.5)
    3	r0 = add_f32 r0 r1
    4	r2 = uniform32 arg(0) 2C
    5	r3 = uniform32 arg(0) 28
    6	r2 = fma_f32 r0 r3 r2
    7	r3 = uniform32 arg(0) 0
    8	r4 = uniform32 arg(0) 24
    9	r5 = splat 3F800000 (1)
    10	r6 = uniform32 arg(0) 38
    11	r6 = min_f32 r6 r5
    12	r7 = splat 0 (0)
    13	r6 = max_f32 r7 r6
    14	r8 = splat 437F0000 (255)
    15	r9 = mul_f32 r6 r8
    16	r9 = round r9
    17	r10 = splat FF (3.5733111e-43)
    18	r10 = pack r9 r10 8
    19	r9 = splat 3B808081 (0.0039215689)
    20	r11 = uniform32 arg(0) 20
    21	r12 = uniform32 arg(0) 1C
    22	r11 = fma_f32 r0 r12 r11
    23	r12 = uniform32 arg(0) 18
    24	r0 = splat 3F800001 (1.0000001)
    25	r13 = min_f32 r6 r0
    26	r14 = splat B4000000 (-1.1920929e-07)
    27	r13 = max_f32 r14 r13
    28	r13 = eq_f32 r6 r13
    29	assert_true r13 r6
    loop:
    30	    r6 = index
    31	    r6 = sub_i32 r3 r6
    32	    r6 = to_f32 r6
    33	    r6 = add_f32 r6 r1
    34	    r13 = fma_f32 r6 r4 r2
    35	    r13 = mul_f32 r9 r13
    36	    r6 = fma_f32 r6 r12 r11
    37	    r13 = min_f32 r13 r5
    38	    r13 = max_f32 r7 r13
    39	    r15 = mul_f32 r13 r8
    40	    r15 = round r15
    41	    r6 = mul_f32 r9 r6
    42	    r6 = min_f32 r6 r5
    43	    r6 = max_f32 r7 r6
    44	    r16 = mul_f32 r6 r8
    45	    r16 = round r16
    46	    r15 = pack r16 r15 8
    47	    r15 = pack r15 r10 16
    48	    store32 arg(1) r15
    49	    r15 = min_f32 r13 r0
    50	    r15 = max_f32 r14 r15
    51	    r15 = eq_f32 r13 r15
    52	    assert_true r15 r13
    53	    r13 = min_f32 r6 r0
    54	    r13 = max_f32 r14 r13
    55	    r13 = eq_f32 r6 r13
    56	    assert_true r13 r6

And that JITs using 11 ymm registers.

Change-Id: Ib45b5fa6aee427f290b77d8900f10d433ad81133
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281746
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-04-06 17:32:28 +00:00
Brian Osman
ffd11f4ab3 Adding attribute types to SkVertices
Adds structure to the per-vertex (now custom) data.
Attributes currently just have a type, but the next
step is to augment that with semantic flags to handle
transformation logic in the vertex shader.

Added unit tests and GMs that exercise attributes of
varying float counts, as well as normalized bytes.

Bug: skia:9984
Change-Id: I02402d40b66a6e15b39f71125004efb98bc06295
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/280338
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-04-01 23:23:26 +00:00
Mike Reed
ea1d105648 onProgram for overdraw-colorfilter
+ add Builder: min(I32), max(I32), gatherF()

Incidental bench timings (iMac Pro):
- RP:          350
- gatherF:     210
- unpack_8888: 187

Change-Id: I1d09f76206e89cd595a9e42c4b96bbf2f53ab86c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/279736
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-03-27 17:02:26 +00:00
Brian Osman
3c358420df Support for custom vertex data in SkSL and drawVertices
Adds a 'varying' modifier to the SkSL frontend. Only valid
for pipeline stage (runtime effect) SkSL programs, and only
on variables that are float, or float[2-4].

Runtime effect SkSL can declare varyings. The effect gathers
and reflects them. The GPU backend uses SkShader_Base's new
asRuntimeEffect() to get this data.

GrDrawVerticesOp and its GP get the shader's effect, if any.
They use this to add vertex attributes, varyings, and global
variables (in the fragment shader) of the appropriate width.
The globals have procedurally generated names, based on
their index in the list ("_vtx_attr_%d"). The GP's fragment
code copies the varyings to the globals.

When PipelineStageCodeGenerator sees a varying reference,
it just replaces that with the procedurally generated name
that matches the logic in the op.

Change-Id: I0effbc4f3425d452cb7d62e51e268f3b48fa3c74
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275962
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-03-23 19:52:53 +00:00
Kevin Lubick
4765da43c5 Add fiddle example for MakeLinear
See live at https://fiddle.skia.org/c/4dbc499d0c9fdf7e732e512d90039acd

Change-Id: I06920e61b902c37c9c00ce3addd3e7cbf1c880bf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277602
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-03-18 17:53:11 +00:00
Mike Klein
276a78573e rearrange to emphasize most salient params
Move (x,y) up front for shaders, Color for color filters.

I did think about wrapping the other params in a struct, but
for now I still find it less error prone (while admittedly
more tedious) to have all those params in my face when adding,
removing, or refactoring parameters or effects.

Change-Id: I5e124f1ecea3eff9366872d5e77ddfbadc0302e3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277111
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-03-15 20:14:58 +00:00
Mike Reed
9a4ac6e865 add programs to compose, lerp and luma colorfilters
Small diffs in affected gms, but doesn't seem wrong.

Change-Id: I6577943f924d682e9ad4ff195ab98ca2168fd527
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277064
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-03-15 19:29:40 +00:00
Brian Osman
bd4f872d69 Handle runtime effect shader errors better
- Expose shader error handler on GrBaseContextPriv
- Use that to report errors that happen during (late) SkSL conversion
- Remove various asserts. We expect these functions not to fail, but
  they absolutely can for any kind of error that gets past the first
  compile in SkRuntimeEffect::Make. We'll still make a GLSLFP, but it
  won't inject any code, so the resulting shader will *also* fail to
  compile. Injecting our own errors first gives the user a better idea
  what's actually broken.
- SkSLSlide also reports errors via the error handler now, too.

Change-Id: I4b871cdaa5e3217b042ebf000bb7474afaeab04c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275679
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-03-06 21:32:31 +00:00
Brian Osman
6fa47769cb In SkRuntimeEffect, use a single shared Compiler instance
I've been increasingly concerned about the CPU and memory costs of
creating and holding on to many Compiler instances. Given that they're
use infrequently, having a shared (guarded) instance seems fine.

We can still look at reducing the startup cost of a single instance, but
this removes a large blocker to wider usage of SkRuntimeEffect.

Change-Id: Ia6dc721c73fdf8c9c4c7a8c1af5f350d2c028b22
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272466
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-02-21 20:25:04 +00:00
Brian Osman
d3b3bf3567 Reland "Move runtime shader/colorfilter into SkRuntimeEffect.cpp"
This reverts commit 7281a86237.

Change-Id: I1759358ede39e2466362cc4d3f0b9530eff08c9e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/271656
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-02-19 15:29:09 +00:00
Brian Osman
7281a86237 Revert "Move runtime shader/colorfilter into SkRuntimeEffect.cpp"
This reverts commit 8980acd623.

Reason for revert: Win-Shared

Original change's description:
> Move runtime shader/colorfilter into SkRuntimeEffect.cpp
> 
> Better organization that lets us share a bunch of code between these
> (very similar) objects.
> 
> Change-Id: Ie559d6e144d8588b98a95d4170e2e6c19d9623bd
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270736
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

TBR=brianosman@google.com,ethannicholas@google.com,reed@google.com

Change-Id: Ic13d85b7c4f2d593a6c15dde067f118ea5753eb6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/271600
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-02-18 19:31:14 +00:00
Brian Osman
8980acd623 Move runtime shader/colorfilter into SkRuntimeEffect.cpp
Better organization that lets us share a bunch of code between these
(very similar) objects.

Change-Id: Ie559d6e144d8588b98a95d4170e2e6c19d9623bd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270736
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-02-18 19:15:05 +00:00
Mike Reed
2c5ee18724 remove legacy factory for overdrawcolorfilter
Change-Id: I19453c51bf275050d6426b82a1ad717348a3ea56
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/271136
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-02-15 16:53:39 +00:00
Mike Reed
528998dfd5 Fix impl for OverdrawColorFilter to not rely on details of pmcolor,
esp. during serialization. We now store/serialize SkColor, which is
stable.

Change-Id: Ib453920a9a06647f44b33c9ae8af33936d6ead33
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270997
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-02-14 18:38:18 +00:00
Brian Osman
f989aeaa01 Support children in SkRuntimeEffect::makeColorFilter
Change-Id: Icf8c69464a44341a08df16dce53aebedc2826bfd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270064
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-02-11 16:20:07 +00:00
Mike Reed
dc2782c380 Update OverdrawColorFilter to clarify how it interprets its input array.
1. Document that Make() takes RGBA_premul
2. Change impl so that CPU matches this behavior/definition
3. Offer a clearer factory that takes SkColor
   (perhaps migrate clients to this one in the future)

Bug: skia:9896
Change-Id: I0a81dda45834a2fbf2b28b711ba7e6b83f360aff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269906
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-02-11 10:58:36 +00:00
Brian Osman
194dfdea3a Add comment explaining memset in ArithmeticFPInputs
Change-Id: I1541e3f4629a117eee3f244c0209e442b705b67b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268844
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-02-05 20:03:28 +00:00
Brian Osman
0a3c57f1ad Ensure that ArithmeticFPInputs is fully initialized
Change-Id: Ia5e94704955aba33e07592711656fbeefef15912
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268840
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-02-05 18:52:17 +00:00
Brian Osman
3225306f82 In SkRuntimeEffect, just use hash of SkSL as the ID
Change-Id: I2ce210889452756d5d100fbb15f578bb72e2af2a
Bug: skia:9813
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268687
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-02-05 17:52:48 +00:00
Brian Osman
9bfd5956de In GrSkSLFP, store inputs as SkData. Tighten size checks.
Simplifies interaction with users who already have inputs in this form,
and doesn't really add any overhead to other clients.

Change-Id: I6e137e02a65e007621adf481ffb994665117caf4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268836
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-02-05 16:19:08 +00:00
Brian Osman
504032e575 SkRuntimeEffect: Fix 'in' variables in CPU backend
We were never calling specialize() to bake in the values of ins,
so do that. Add uniformSize() to get the size of just the uniform
values. (The interpreter asserts that the size of the uniforms
being passed in matches the expected size from the ByteCode,
so these need to match up).

Added a unit test that uses both 'in' and 'uniform'.

Change-Id: I595822171211d35a17d5977fa790de0d1bbd6c78
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263519
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-10 15:46:22 +00:00
Brian Osman
f72deddb89 Expose the Input variable and Child name collections in SkRuntimeEffect
Add framework for unit tests that draw (CPU and GPU) with a runtime
shader, as well as couple example tests.

Change-Id: I43b3b39e86634ec55521a2689a4c55c21939dce5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262809
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-08 19:23:13 +00:00
Brian Osman
ee426f223f Move SkRuntimeEffect.h to include/effects
Change-Id: I0b11d4210c6e663cfb4854fc33e1396fd79fe9a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261780
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-02 17:37:46 +00:00
Brian Osman
d927bd246d Runtime SkSL: Reflect inputs in SkRuntimeEffect
Adds a new structure to describe the inputs, including type,
shape, name, etc. This removes any references to the type
variables in the compiler's context, and centralizes the
logic for parsing those type variables.

Also normalizes the rules for what types are supported.
(This was inconsistent among the various functions before).

Now:
  - bool and int must be 'in'
  - float may be 'in' or 'uniform'
  - float[2-4] and matrices must be 'uniform'

Includes a new Slide that allows for interactive editing
of a runtime shader.

Change-Id: Ic2af68a80c8bb645ba96417c430da24de0a9c2d8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260497
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-12-18 17:37:55 +00:00
Brian Osman
e36d030016 SkColorMatrix cleanup
Remove the RGB/YUV helpers (use SkYUVMath instead), along with the
unused get20/set20.

Change-Id: Id83467a1b7f33657869e0a933af75387a4e36a88
Bug: skia:9543
Change-Id: Id83467a1b7f33657869e0a933af75387a4e36a88
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252188
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-11-04 15:20:15 +00:00
Brian Salomon
4bc0c1fc4b Rename GrColorSpaceInfo -> GrColorInfo
Add version SkImageInfo::Make() that takes SkISize instead of separate
width and height.

Change-Id: I42aa79d23b19e22f5405631728c245b04bce0559
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245172
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-09-30 21:53:24 +00:00
Michael Ludwig
bf8439d7e2 Fix GMs broken during API porting
Bugs:
morphology GM: Had swapped Erode and Dilate
imagefilterscropexpand GM: Was applying the filter to the wrong rectangle
imagefilterstransformed, filterfastbounds, et al GMs: The new
SkImageFilters::Image() factory had defaulted to using kNone for quality,
since it appeared to keep a 1-to-1 scale. However, it actually draws the
image from srcRect into the dstRect, mapped by the CTM, so if there's a
scaling factor in the CTM the filter no longer is 1-to-1 and kNone leads
to weird scaling artifacts. So switched back to the original kHigh default.
Change-Id: I30ee455008720048fb27eaed1c2c42915d222c97
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/232396
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-08-05 14:53:45 +00:00
Michael Ludwig
06eacf44d5 Add new SkImageFilters factory API
In preparation for moving the filter-specific headers from include/effects and into src/effects/imagefilters, this exposes a more convenient API where all filters provided by Skia are accessible from the same factory.

It also only exposes the factories that take the shared enums (SkColorChannel, SkTileMode), so the per-filter enums can be phased out (SkBlurImageFilter::TileMode, etc.). It also accepts an SkIRect* instead of an SkImageFilter::CropRect* since all uses seem to be for integer rectangles and flags are either always on or always off. This will allow us to later remove the CropRect type.

Bug: skia:9280
Change-Id: I71f77ff44b573f87b837d6523b9eb565521f0f36
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/230876
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-08-02 13:33:35 +00:00
Michael Ludwig
c711a86493 Combine erode and dilate implementations
Combine the GPU and Raster morph type and direction enums, and have the
morphology base class accept the type as an argument instead of a virtual.
Adds somewhat complex deserialization code to be backwards compatible with
the old erode and dilate create procs.

Also updates SkXfermodeImageFilter's implementation to be named with the
"Impl" suffix instead of _Base, and updates both filters to have the common
code layout for image filter implementations.

Change-Id: I5082914f9754c2be71becfceb0c7d9a8fd06f569
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/231099
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-08-01 17:24:10 +00:00
Michael Ludwig
d668f7f061 Hide SkImageFilter subclasses in CPP files
Bug: skia:9280
Change-Id: Ice3624467f5e643f9d3d81da72d77911eeac963e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/230198
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-07-30 18:39:22 +00:00
Michael Ludwig
607c057de9 Use SkTileMode for blur and matrix convolution filters
Bug: skia:9280
Change-Id: I6d40b83093d8a8e9e84bbe44d917d02dfde85877
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/230124
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-07-29 18:27:27 +00:00
Michael Ludwig
14963cef70 Use SkColorChannel in SkDisplacementMapEffect
Bug: skia:9280
Change-Id: I1a1df193ce212300b7a84d2247fa9c63601c9446
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/230119
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-07-26 19:44:08 +00:00
Mike Reed
59f2e46ab4 Return translate info from looper, rather than moding a canvas
Change-Id: Ibb4520030bc0ca455fa079d923fd4f5be86d72a1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/229837
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2019-07-25 20:39:13 +00:00
Mike Reed
c0ee21feb8 skia helper for encoding video
Change-Id: I36aef5872fc8f5938854ab18b754f3800b9879ad
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/215165
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-05-28 20:39:21 +00:00
Mike Reed
6a5f7e29a8 split RGB into YUV planes
Change-Id: Ifd1d010068691e187561a25aff45d8b67ae62c39
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/215442
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-05-23 19:57:30 +00:00
Mike Reed
68eb8c2763 remove deprecated postTranslate255
Change-Id: Id2bdf73b5111c34f0ed1f36da85548a942568dcb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/211595
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-05-02 17:28:53 +00:00
Mike Klein
c0bd9f9fe5 rewrite includes to not need so much -Ifoo
Current strategy: everything from the top

Things to look at first are the manual changes:

   - added tools/rewrite_includes.py
   - removed -Idirectives from BUILD.gn
   - various compile.sh simplifications
   - tweak tools/embed_resources.py
   - update gn/find_headers.py to write paths from the top
   - update gn/gn_to_bp.py SkUserConfig.h layout
     so that #include "include/config/SkUserConfig.h" always
     gets the header we want.

No-Presubmit: true
Change-Id: I73a4b181654e0e38d229bc456c0d0854bae3363e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209706
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-04-24 16:27:11 +00:00
Mike Reed
c092f9e3a3 rm older api from colormatrix, change to normalized translate
Bug: skia:4872
Change-Id: I0846a019dd1fd495a20d522d2d82179ad8d61aea
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209813
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-04-24 12:58:01 +00:00
Mike Reed
f07b61f05a (start to) explicitly use float for color values
Bug: skia:9012
Change-Id: I13ef8dea81a9d138b557be53b7adf19285fc9fce
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209810
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-04-23 21:06:16 +00:00
Mike Reed
50d79af7b7 hide internals of SkColorMatrix (so we can migrate to col-major)
Change-Id: If0eb6fb2efb6816b92ad7ca7d8caaace71397b7f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209409
Commit-Queue: Ravi Mistry <rmistry@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-04-22 19:10:04 +00:00
Mike Reed
bb85b8b3f3 remove dead code from old factories, enum
Change-Id: I12d46c2c60539689949a08636c3a654d2298285a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207868
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-04-12 17:11:25 +00:00
Martin Vejdarski
8842799432 add missing shared lib visibility macros
fixes linker errors when using is_component_build

Change-Id: Ie28b0e8881cb81715a959df3a87bae4fa854afda
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206140
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Auto-Submit: Martin Vejdarski <martin@mainframe.co.uk>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-04-09 14:34:55 +00:00
Mike Reed
fae8fceb4a Use SkTileMode instead of nested enum
Add guard to transition clients

Change-Id: Ia7a3e8f95722f91e84af262168dadf89a78707da
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205720
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-04-03 15:24:18 +00:00
Mike Reed
2fdbeae327 Start to unify signatures: return bool
Change-Id: If4a8e06f3a176697e3f5136dfc7ab1fbb347da70
Bug: skia:8937
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205120
Reviewed-by: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-03-30 19:02:24 +00:00
Brian Osman
f9666f5467 Remove SkColorSpaceXformCanvas, and supporting code:
- SkColorSpaceXformer
- makeColorSpace on SkShader, SkColorFilter,
  SkImageFilter, SkDrawLooper, and SkLights
- DM support and some bot configs

Bug: skia:8773
Change-Id: I16ef8f487de6c35329b3b0474c1d66d7fa0a6220
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/202430
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-03-21 17:12:33 +00:00
Mike Klein
525ff2098e update docs for SkLumaColorFilter
Well, at least we have this to show for an otherwise wasted morning...

Change-Id: I8b0c55c0ff3c4b726a7992fd493dac008c7d3cb7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/201191
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-03-14 18:41:41 +00:00
Mike Reed
1386b2d557 pass common SkStageRec to all effects using rasterpipeline
- shaders
- colorfilters
- mixers

Bug: skia:
Change-Id: Ife2fabd1171228ea9fb154efab3537fd0ddb4a6e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/200933
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-03-14 01:45:13 +00:00
Brian Osman
e938c92fe7 Remove SkToSRGBColorFilter (now unused)
This was another stop-gap color management "solution".

Bug: skia:
Change-Id: I7c0c362840dd35aad51ad8780f2dab591c42a7e2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/199720
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-03-12 13:19:28 +00:00
Robert Phillips
1efecea71f Make asFragmentProcessor entry point only take a GrRecordingContext (take 2)
This is split out of: https://skia-review.googlesource.com/c/skia/+/192032 (Switch FP creation over to GrRecordingContext)

TBR=bsalomon@google.com

Change-Id: Iebe8dce00abf09485717f59daae1bfeb8ba6d5bc
Reviewed-on: https://skia-review.googlesource.com/c/193160
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-02-16 14:07:50 +00:00
Robert Phillips
a7f0013eca Revert "Make asFragmentProcessor entry point only take a GrRecordingContext"
This reverts commit e821d21e41.

Reason for revert: enh

Original change's description:
> Make asFragmentProcessor entry point only take a GrRecordingContext
> 
> This is split out of: https://skia-review.googlesource.com/c/skia/+/192032 (Switch FP creation over to GrRecordingContext)
> 
> TBR=bsalomon@google.com
> Change-Id: I48a5667b1ca31d5648571083fcda76564fae939b
> Reviewed-on: https://skia-review.googlesource.com/c/192687
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>

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

Change-Id: I9041b3479ef5004f14eb5a97c0e25e60f8b8ba14
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/193039
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-02-15 21:54:20 +00:00
Robert Phillips
e821d21e41 Make asFragmentProcessor entry point only take a GrRecordingContext
This is split out of: https://skia-review.googlesource.com/c/skia/+/192032 (Switch FP creation over to GrRecordingContext)

TBR=bsalomon@google.com
Change-Id: I48a5667b1ca31d5648571083fcda76564fae939b
Reviewed-on: https://skia-review.googlesource.com/c/192687
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-02-15 21:39:43 +00:00
Leon Scroggins III
e548161aba Add SkBlurDrawLooper::Make(SkColor4f, SkColorSpace)
Bug: b/120904891

This will allow adding android.graphics.Paint#setShadowLayer(
    float radius, float dx, float dy, @ColorLong long shadowColor).

Change-Id: Ic9256b10c82b56847802f209cf82b4e5c07a9069
Reviewed-on: https://skia-review.googlesource.com/c/182762
Auto-Submit: Leon Scroggins <scroggo@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-01-12 08:46:04 +00:00
Mike Reed
d5cdc2cd4d paint is losing its text-related fields
Bug: skia:
Change-Id: I187c290f30259564e8ff396b54070ca305da3954
Reviewed-on: https://skia-review.googlesource.com/c/181400
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-01-04 21:54:49 +00:00
Leon Scroggins III
fd1fd279a3 Remove unused exposedInAndroidJavaAPI
This method was introduced in crrev.com/974913002 (DIFFERENT ISSUE) for
ViaAndroidSDK in DM. ViaAndroidSDK has been removed, and no one
currently calls this method.

Change-Id: Ie613e41f9bf7e2c4213f0122ff418b974d3ff2f3
Reviewed-on: https://skia-review.googlesource.com/c/170481
Auto-Submit: Leon Scroggins <scroggo@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
2018-11-12 21:27:02 +00:00
Mike Klein
024072af62 Reland "Improve degenerate 2pt conical gradient cases"
This reverts commit 95af4726bf.

Reason for revert: I think this may not have been the reason the Android roll was failing.  We've rolled, so it's a good time to try again.

Original change's description:
> Revert "Improve degenerate 2pt conical gradient cases"
> 
> This reverts commit 879dab87ab.
> 
> Reason for revert: Android roll failed.
> https://sponge.corp.google.com/target?id=93bc6b8d-9b42-4805-b204-46ae62f1b005&target=x86+CtsGraphicsTestCases&searchFor=&show=FAILED&sortBy=STATUS
> A test VectorDrawableTest.testVectorDrawableGradient fails.
> 
> Original change's description:
> > Improve degenerate 2pt conical gradient cases
> > 
> > This was originally a reland of "Fix div-by-zero loophole in gradient factory func", c34dd6c526, but:
> > 
> > The change caused blink layout tests when encountering very small or zero radii. The original patch switched the order of checking if the radii are equal and if the start radius was 0. In the case where both radii are 0, the original code created an actual radial gradient of radius 0 and the new code rejected the shader. A radial gradient with radius of 0 properly renders the last border color as a fill.
> > 
> > This made me realize that the case when the center positions and the radii are the same can be handled more correctly than just always returning an empty shader, so the fix now applies simplifications to the gradient definition depending on the tile mode and should not trigger any blink tests. I added a row to the gradient edge cases GM to make sure it degrades gracefully.
> > 
> > Original change's description:
> > > Fix div-by-zero loophole in gradient factory func
> > >
> > > Bug: oss-fuzz:10373
> > > Change-Id: I4277fb63e3186ee34feaf09ecf6aeddeb532f9c1
> > > Reviewed-on: https://skia-review.googlesource.com/c/168269
> > > Reviewed-by: Kevin Lubick <kjlubick@google.com>
> > > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> > 
> > Docs-Preview: https://skia.org/?cl=168487
> > Bug: oss-fuzz:10373
> > Change-Id: Ib0a6e7f807560a5dcf24d1c8e0146817af2d9606
> > Reviewed-on: https://skia-review.googlesource.com/c/168487
> > Reviewed-by: Mike Reed <reed@google.com>
> > Reviewed-by: Florin Malita <fmalita@chromium.org>
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> 
> TBR=caryclark@google.com,fmalita@chromium.org,fmalita@google.com,reed@google.com,michaelludwig@google.com
> 
> Change-Id: I91b896c4a438c02206679b327a01b47f40993965
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: oss-fuzz:10373
> Reviewed-on: https://skia-review.googlesource.com/c/170272
> Reviewed-by: Stan Iliev <stani@google.com>
> Commit-Queue: Stan Iliev <stani@google.com>

TBR=caryclark@google.com,fmalita@chromium.org,fmalita@google.com,reed@google.com,stani@google.com,michaelludwig@google.com

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

Bug: oss-fuzz:10373
Change-Id: I7577fcea9eb8a875e94723ab2cca2fcc990b82b2
Reviewed-on: https://skia-review.googlesource.com/c/170279
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2018-11-11 00:28:01 +00:00
Stan Iliev
95af4726bf Revert "Improve degenerate 2pt conical gradient cases"
This reverts commit 879dab87ab.

Reason for revert: Android roll failed.
https://sponge.corp.google.com/target?id=93bc6b8d-9b42-4805-b204-46ae62f1b005&target=x86+CtsGraphicsTestCases&searchFor=&show=FAILED&sortBy=STATUS
A test VectorDrawableTest.testVectorDrawableGradient fails.

Original change's description:
> Improve degenerate 2pt conical gradient cases
> 
> This was originally a reland of "Fix div-by-zero loophole in gradient factory func", c34dd6c526, but:
> 
> The change caused blink layout tests when encountering very small or zero radii. The original patch switched the order of checking if the radii are equal and if the start radius was 0. In the case where both radii are 0, the original code created an actual radial gradient of radius 0 and the new code rejected the shader. A radial gradient with radius of 0 properly renders the last border color as a fill.
> 
> This made me realize that the case when the center positions and the radii are the same can be handled more correctly than just always returning an empty shader, so the fix now applies simplifications to the gradient definition depending on the tile mode and should not trigger any blink tests. I added a row to the gradient edge cases GM to make sure it degrades gracefully.
> 
> Original change's description:
> > Fix div-by-zero loophole in gradient factory func
> >
> > Bug: oss-fuzz:10373
> > Change-Id: I4277fb63e3186ee34feaf09ecf6aeddeb532f9c1
> > Reviewed-on: https://skia-review.googlesource.com/c/168269
> > Reviewed-by: Kevin Lubick <kjlubick@google.com>
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> 
> Docs-Preview: https://skia.org/?cl=168487
> Bug: oss-fuzz:10373
> Change-Id: Ib0a6e7f807560a5dcf24d1c8e0146817af2d9606
> Reviewed-on: https://skia-review.googlesource.com/c/168487
> Reviewed-by: Mike Reed <reed@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

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

Change-Id: I91b896c4a438c02206679b327a01b47f40993965
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: oss-fuzz:10373
Reviewed-on: https://skia-review.googlesource.com/c/170272
Reviewed-by: Stan Iliev <stani@google.com>
Commit-Queue: Stan Iliev <stani@google.com>
2018-11-09 23:05:44 +00:00
Michael Ludwig
879dab87ab Improve degenerate 2pt conical gradient cases
This was originally a reland of "Fix div-by-zero loophole in gradient factory func", c34dd6c526, but:

The change caused blink layout tests when encountering very small or zero radii. The original patch switched the order of checking if the radii are equal and if the start radius was 0. In the case where both radii are 0, the original code created an actual radial gradient of radius 0 and the new code rejected the shader. A radial gradient with radius of 0 properly renders the last border color as a fill.

This made me realize that the case when the center positions and the radii are the same can be handled more correctly than just always returning an empty shader, so the fix now applies simplifications to the gradient definition depending on the tile mode and should not trigger any blink tests. I added a row to the gradient edge cases GM to make sure it degrades gracefully.

Original change's description:
> Fix div-by-zero loophole in gradient factory func
>
> Bug: oss-fuzz:10373
> Change-Id: I4277fb63e3186ee34feaf09ecf6aeddeb532f9c1
> Reviewed-on: https://skia-review.googlesource.com/c/168269
> Reviewed-by: Kevin Lubick <kjlubick@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

Docs-Preview: https://skia.org/?cl=168487
Bug: oss-fuzz:10373
Change-Id: Ib0a6e7f807560a5dcf24d1c8e0146817af2d9606
Reviewed-on: https://skia-review.googlesource.com/c/168487
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2018-11-09 16:36:05 +00:00
Kevin Lubick
b5ae3b5afc [canvaskit] Add drawVertices API
This also does some clean up to how we name enums - the caps felt a bit
obnoxious. CAPS are reserved now for constants (like colors).

Small bug fix with leaking memory on discrete path effects

This also adds a few more things from PathKit

Bug: skia:
Change-Id: Iad7e21ac36d35a36a8b255dc82b1dcc886344db1
Reviewed-on: https://skia-review.googlesource.com/c/166804
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2018-11-03 12:18:04 +00:00
Mike Klein
fa5f6ce872 rename some flattenable routines
Initialize felt a little too nebulous, and I think
the verb for "define registrar entry" is "register".

Change-Id: I52f2eb5df5acd46a8b38bb9ea9bb07f4ac8f3789
Reviewed-on: https://skia-review.googlesource.com/c/163990
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2018-10-20 14:08:32 +00:00
Mike Klein
4fee323522 override getTypeName() instead of using table
This should let getTypeName() and serialization work even
when deserialization factories haven't been registered.

I've made getTypeName() pure virtual like getFactory(),
and moved all the overrides into SK_FLATTENABLE_HOOKS,
cleaning up all the various ways we've done it before.

All the subclasses override getTypeName() and getFactory()
privately, so there should be no need to document them?

Change-Id: I723cb20099d250c2f2a10be266e3aacc6a061937
Reviewed-on: https://skia-review.googlesource.com/c/163543
Reviewed-by: Cary Clark <caryclark@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2018-10-19 18:07:04 +00:00
Ethan Nicholas
78aceb2f87 converted overdraw effect to new FP system
Bug: skia:
Change-Id: I4cff0ecdf3fc61f584012af519730f08bfd78264
Reviewed-on: https://skia-review.googlesource.com/150484
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2018-09-04 13:37:25 +00:00
Ethan Nicholas
545aa936f5 fixed uninitialized memory use in arithmetic effect
Bug: skia:
Change-Id: Ieb591db974d858566b35c1e61c1303051ed65f67
Reviewed-on: https://skia-review.googlesource.com/150907
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2018-08-31 16:01:32 +00:00
Ethan Nicholas
ce008119dc converted arithmetic FP to new FP structure
Bug: skia:
Change-Id: I5492b378fa0f2ab7b453b2b1b18e4aef898370d2
Reviewed-on: https://skia-review.googlesource.com/148910
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2018-08-30 17:41:11 +00:00
Mike Reed
6d10f8bda1 move patheffect virtuals to protected and rename
- change filterPath to safely handle if src and dst are aliases

Bug: skia:8254
Change-Id: I125d19404ca0a610f73271abb5c5455d1d50f9ed
Reviewed-on: https://skia-review.googlesource.com/147466
Commit-Queue: Mike Reed <reed@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2018-08-16 17:47:22 +00:00
Cary Clark
fa07204363 remove unimplemented headers
implementation never done

R=reed@google.com,djsollen@google.com

Bug: b:111664728
Change-Id: I2f28f8770af5260a32bb655fffc0f467086f6896
Reviewed-on: https://skia-review.googlesource.com/142688
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Cary Clark <caryclark@google.com>
2018-07-20 16:19:47 +00:00
Mike Reed
310f44d3d5 rename to Merge patheffect
Bug: skia:
Change-Id: Ieca0e71bc0ee6ce33f4f14605fe60d1fc61044ad
Reviewed-on: https://skia-review.googlesource.com/142509
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-07-19 18:15:16 +00:00
Mike Reed
0ef539af4c add new patheffects
Bug: skia:
Change-Id: Icc94eafbb26a097d5032cdb4f6e2e0f52a4e1025
Reviewed-on: https://skia-review.googlesource.com/141961
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-07-18 18:56:07 +00:00
Ben Wagner
2c312c4f58 Remove SkDrawFilter.
Change-Id: I0204a9522e828c87bb7c6c20ae34ce51161442af
Reviewed-on: https://skia-review.googlesource.com/137895
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2018-07-12 02:36:44 +00:00
Mike Reed
846bb413e1 iwyu
Bug: skia:
Change-Id: Ie061614626d1cea13a26f1974f35f931cc8eef6d
Reviewed-on: https://skia-review.googlesource.com/135962
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-06-19 22:28:18 +00:00
Cary Clark
27dddae313 rebase
This reverts commit 32a4910e57.

Reason for revert: SkMatrix::toString use has been removed from flutter
and has been picked up in fuchsia

Additionally some bookmaker changes take into account recent
additions of typedef comments and the generated header comment.

Original change's description:
> Revert "remove toString"
>
> This reverts commit 5191880cbf.
>
> Reason for revert: broke flutter
>
> Original change's description:
> > remove toString
> >
> > toString may have been used by obsolete debugger only
> > find out if that is so
> >
> > R=​brianosman@google.com,bsalomon@google.com
> >
> > Docs-Preview: https://skia.org/?cl=119894
> > Bug:830651
> > Change-Id: I737f19b7d3fbc869bea2f443fa3b5ed7c1393ffd
> > Reviewed-on: https://skia-review.googlesource.com/119894
> > Commit-Queue: Cary Clark <caryclark@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
>
> TBR=bsalomon@google.com,brianosman@google.com,caryclark@google.com,caryclark@skia.org
>
> Change-Id: I9f81de6c3615ee0608bcea9081b77239b4b8816c

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

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

Reviewed-on: https://skia-review.googlesource.com/129623
Reviewed-by: Cary Clark <caryclark@skia.org>
Commit-Queue: Cary Clark <caryclark@google.com>
Docs-Preview: https://skia.org/?cl=133583
Bug: 830651
Change-Id: If8499e796be63580ad419e150e94d43e8b89de1b
Reviewed-on: https://skia-review.googlesource.com/133583
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
2018-06-08 20:36:53 +00:00
Cary Clark
89ad31e97c Revert "Reland "remove toString""
This reverts commit 92e37b6d79.

Reason for revert: toString still used by flutter

Original change's description:
> Reland "remove toString"
> 
> This reverts commit 32a4910e57.
> 
> Reason for revert: SkMatrix::toString use has been removed from flutter and has been picked up in fuchsia
> 
> Original change's description:
> > Revert "remove toString"
> > 
> > This reverts commit 5191880cbf.
> > 
> > Reason for revert: broke flutter
> > 
> > Original change's description:
> > > remove toString
> > > 
> > > toString may have been used by obsolete debugger only
> > > find out if that is so
> > > 
> > > R=​brianosman@google.com,bsalomon@google.com
> > > 
> > > Docs-Preview: https://skia.org/?cl=119894
> > > Bug:830651
> > > Change-Id: I737f19b7d3fbc869bea2f443fa3b5ed7c1393ffd
> > > Reviewed-on: https://skia-review.googlesource.com/119894
> > > Commit-Queue: Cary Clark <caryclark@google.com>
> > > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > 
> > TBR=bsalomon@google.com,brianosman@google.com,caryclark@google.com,caryclark@skia.org
> > 
> > Change-Id: I9f81de6c3615ee0608bcea9081b77239b4b8816c
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Bug: 830651
> > Reviewed-on: https://skia-review.googlesource.com/129340
> > Reviewed-by: Cary Clark <caryclark@google.com>
> > Commit-Queue: Cary Clark <caryclark@google.com>
> 
> TBR=bsalomon@google.com,brianosman@google.com,caryclark@google.com,caryclark@skia.org
> 
> # Not skipping CQ checks because original CL landed > 1 day ago.
> 
> Bug: 830651
> Change-Id: Ida8725b6051132d8c46faf99358a8fcc1bcabf34
> Reviewed-on: https://skia-review.googlesource.com/129623
> Reviewed-by: Cary Clark <caryclark@skia.org>
> Reviewed-by: Cary Clark <caryclark@google.com>
> Commit-Queue: Cary Clark <caryclark@google.com>

TBR=bsalomon@google.com,brianosman@google.com,caryclark@google.com,caryclark@skia.org

Change-Id: Iafc59ffc1b3db67c520ba31bf12d68e1b46c0ea2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 830651
Reviewed-on: https://skia-review.googlesource.com/131082
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Cary Clark <caryclark@google.com>
2018-05-31 12:27:44 +00:00
Cary Clark
92e37b6d79 Reland "remove toString"
This reverts commit 32a4910e57.

Reason for revert: SkMatrix::toString use has been removed from flutter and has been picked up in fuchsia

Original change's description:
> Revert "remove toString"
> 
> This reverts commit 5191880cbf.
> 
> Reason for revert: broke flutter
> 
> Original change's description:
> > remove toString
> > 
> > toString may have been used by obsolete debugger only
> > find out if that is so
> > 
> > R=​brianosman@google.com,bsalomon@google.com
> > 
> > Docs-Preview: https://skia.org/?cl=119894
> > Bug:830651
> > Change-Id: I737f19b7d3fbc869bea2f443fa3b5ed7c1393ffd
> > Reviewed-on: https://skia-review.googlesource.com/119894
> > Commit-Queue: Cary Clark <caryclark@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> 
> TBR=bsalomon@google.com,brianosman@google.com,caryclark@google.com,caryclark@skia.org
> 
> Change-Id: I9f81de6c3615ee0608bcea9081b77239b4b8816c
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: 830651
> Reviewed-on: https://skia-review.googlesource.com/129340
> Reviewed-by: Cary Clark <caryclark@google.com>
> Commit-Queue: Cary Clark <caryclark@google.com>

TBR=bsalomon@google.com,brianosman@google.com,caryclark@google.com,caryclark@skia.org

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

Bug: 830651
Change-Id: Ida8725b6051132d8c46faf99358a8fcc1bcabf34
Reviewed-on: https://skia-review.googlesource.com/129623
Reviewed-by: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Cary Clark <caryclark@google.com>
2018-05-31 11:43:13 +00:00
Cary Clark
4dc5a45405 remove defines and add commas
Preparation for generating bookmaker files for all remaining
interfaces

Standardize enum and enum classes by including a comma after
the last entry.

Replace flatten-related #define in public interfaces
with their equivalent.

The motivation is to give documentation something to refer to.

An alternative would be to move part or all of this out of the
public interface; something I can work on in a follow-up CL.

R=reed@google.com,bsalomon@google.com

Bug: skia:6898
Change-Id: I4b865f6ec3d8f5d31e50448fef7d2714510302f0
Reviewed-on: https://skia-review.googlesource.com/129312
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Cary Clark <caryclark@skia.org>
2018-05-21 17:33:39 +00:00
Cary Clark
32a4910e57 Revert "remove toString"
This reverts commit 5191880cbf.

Reason for revert: broke flutter

Original change's description:
> remove toString
> 
> toString may have been used by obsolete debugger only
> find out if that is so
> 
> R=​brianosman@google.com,bsalomon@google.com
> 
> Docs-Preview: https://skia.org/?cl=119894
> Bug:830651
> Change-Id: I737f19b7d3fbc869bea2f443fa3b5ed7c1393ffd
> Reviewed-on: https://skia-review.googlesource.com/119894
> Commit-Queue: Cary Clark <caryclark@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

TBR=bsalomon@google.com,brianosman@google.com,caryclark@google.com,caryclark@skia.org

Change-Id: I9f81de6c3615ee0608bcea9081b77239b4b8816c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 830651
Reviewed-on: https://skia-review.googlesource.com/129340
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Cary Clark <caryclark@google.com>
2018-05-20 23:15:48 +00:00
Cary Clark
5191880cbf remove toString
toString may have been used by obsolete debugger only
find out if that is so

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

Docs-Preview: https://skia.org/?cl=119894
Bug:830651
Change-Id: I737f19b7d3fbc869bea2f443fa3b5ed7c1393ffd
Reviewed-on: https://skia-review.googlesource.com/119894
Commit-Queue: Cary Clark <caryclark@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2018-05-20 21:16:37 +00:00
Mike Reed
ba5b5f5171 harden line2d effect
Suggested by https://fuzzer.skia.org/category/n32_canvas/file/c3JjL2NvcmUvU2tTdHJva2UuY3Bw?

Bug: skia:
Change-Id: I8ec48f844bfa5d063f0ab1bdfe0612ec4673ada3
Reviewed-on: https://skia-review.googlesource.com/129260
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-05-18 21:03:54 +00:00
Robert Phillips
120784394c Fix srcBounds computation in SkMatrixConvolutionImageFilter
Note that this does change the behavior of the cropRect for the repeated case. The cropRect now only acts as a hard clip on the output.

BUG= skia:7766

Change-Id: I1d66678bc797cd4835701cd20c36e68b22ac880a
Reviewed-on: https://skia-review.googlesource.com/127338
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2018-05-17 17:06:24 +00:00
Kevin Lubick
6ee268de12 Fix UBSAN warnings in SkPerlinNoiseShaderImpl
Also update the docs in places.

Bug: oss-fuzz:6138, oss-fuzz:6275, oss-fuzz:6118
Change-Id: Idfef4118dd6e58f8aa528365895f7d7b8ebc50e5
Reviewed-on: https://skia-review.googlesource.com/128300
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2018-05-16 12:40:44 +00:00
Florin Malita
41dff6ef68 [skottie] Add support for round-corners geometry effects
TBR=
Change-Id: I5505561df28d5953526662d60fe2300cb112bc37
Reviewed-on: https://skia-review.googlesource.com/124769
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-05-01 14:54:14 +00:00
Robert Phillips
ab4f5bde7f rm SkRRectsGaussianEdgeMaskFilter
Neat but unused.

Change-Id: I1b2d160df274b05cfb5582a5385085cc2db89f7d
Reviewed-on: https://skia-review.googlesource.com/121960
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2018-04-19 17:21:44 +00:00
Brian Osman
0cfd547b46 Remove SK_SUPPORT_LEGACY_BLURMASKFILTER
Change-Id: I1d99d9bb83d8a612d1c1fd298c1f7ed706a2277b
Reviewed-on: https://skia-review.googlesource.com/118990
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-04-06 15:02:03 +00:00
Cary Clark
99885411ae remove SK_IGNORE_TO_STRING
SK_IGNORE_TO_STRING is not defined anywhere.
The same effect can be had by using a modern
linker.

Removing it simplifies bookmaker and makes
our includes easier to understand.

R=robertphillips@google.com
TBR=reed@google.com

Bug: skia:6898
Change-Id: Ib716f5ef1b42a7fbda0df43ece212d1b7c40289f
Reviewed-on: https://skia-review.googlesource.com/118963
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Cary Clark <caryclark@skia.org>
Commit-Queue: Cary Clark <caryclark@skia.org>
2018-04-05 23:52:23 +00:00
Kaloyan Donev
560d283295 Fixing build with SK_IGNORE_TO_STRING defined.
Change-Id: Id7238e427e490338d1f610255774c2069cfd4879
Reviewed-on: https://skia-review.googlesource.com/117060
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2018-03-29 13:42:45 +00:00
Mike Reed
1be1f8d097 hide SkBlurMaskFilter and SkBlurQuality
SK_SUPPORT_LEGACY_BLURMASKFILTER

Bug: skia:
Change-Id: Ic3e27e08e6e3cd2ffc1cd13b044e197bebc96236
Reviewed-on: https://skia-review.googlesource.com/113940
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-03-14 17:27:36 +00:00
Mike Reed
18e7556371 move blur impl into core
Ever since we added drawShadow to the public api, blurs have necessarily
part of the core. This CL just formalizes that.

This should also allow us to have builds that exclude all of /effects (for code size)
and still be valid.

Will follow-up with a change to deprecate SkBlurMaskFilter and SkBlurQuality (both no longer needed).

Bug: skia:
Change-Id: Ifbbd8b47a30a0386d215726b67bcf1e8b84fb8f5
Reviewed-on: https://skia-review.googlesource.com/113713
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-03-12 18:48:18 +00:00
Florin Malita
827af667bb Extend SkTrimPathEffect semantics
Add support for multiple contours, and an explicit "inverted" mode.

Bug: skia:
Change-Id: Iafadbbe9d4692f2467a4ef8585f7fcd9cee9566a
Reviewed-on: https://skia-review.googlesource.com/113270
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-03-12 14:07:28 +00:00
Mike Reed
8e03f6930f remove unused ConvertRadiusToSigma from SkBlurMaskFilter
Bug: skia:
Change-Id: I1726f22fc40ad61b1b0485bcda6d383614da1fdb
Reviewed-on: https://skia-review.googlesource.com/113463
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2018-03-12 13:26:48 +00:00
Mike Reed
4123223ccc add TrimPathEffect
Bug: skia:
Change-Id: I453fb81ded4435b33567e9c8a6f3abe9535d687f
Reviewed-on: https://skia-review.googlesource.com/112820
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-03-07 22:32:20 +00:00
Mike Reed
28d47731a1 make compute helper for blurs private
Precursor for moving blurmaskfilter into core, since it is referenced
by core code for drawShadow.

Bug: skia:
Change-Id: I900c6e10523115c75f45d2c410eb6a5ca56a6e4d
Reviewed-on: https://skia-review.googlesource.com/112301
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-03-06 15:12:16 +00:00
Robert Phillips
a83d0132ba Misc guarding of enums in ImageFilter CreateProcs
Change-Id: I51886aaf2a4670f46ca489b2369dc00e60403c75
Reviewed-on: https://skia-review.googlesource.com/99328
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2018-01-24 21:54:30 +00:00
Robert Phillips
b0ae566b23 Check enum values in SkDisplacementMapEffect's CreateProc
Bug: skia:5635
Change-Id: Iaa01d2207916d0e2a2e2623f124b2b4023b51b1b
Reviewed-on: https://skia-review.googlesource.com/99204
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2018-01-24 20:14:19 +00:00
Mike Reed
80747ef591 move the guts of SkMaskFilter.h into SkMaskFilterBase.h
Bug: skia:
Change-Id: I29ad0960156562867429542d3cfbf3d639529cab
Reviewed-on: https://skia-review.googlesource.com/98802
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2018-01-23 21:14:20 +00:00
Robert Phillips
bee273291f Fix some fuzzer bugs from Skia's image filter fuzzer
Change-Id: I432b3a351eecca0d36635e37f91d32c0e281b7d9
Reviewed-on: https://skia-review.googlesource.com/98384
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2018-01-23 19:54:00 +00:00
Mike Reed
8ad91a9bf8 remove unused SkRasterizer
Bug: skia:7500
Change-Id: Iaa683cf8f0b18887cce4ec676631d1e1efee1712
Reviewed-on: https://skia-review.googlesource.com/97400
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2018-01-21 18:24:11 +00:00
Mike Reed
6e87eee2a0 add shadermaskfilter
next steps:
- gpu impl (will look a lot like shader's asFragProcessor
- special-case rect-input (?)
- explore stages w/ mtklein

Bug: skia:7500
Change-Id: I71089e421d32443a3ddded6967b3e5bc67ed43f2
Reviewed-on: https://skia-review.googlesource.com/95104
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2018-01-18 21:24:38 +00:00
Brian Osman
3e31e99bab Revert "Alloc glyph image correctly for SkMask::k3D_Format."
This reverts commit 1662257bda.

Reason for revert: Android still using this API

Original change's description:
> Alloc glyph image correctly for SkMask::k3D_Format.
> 
> Remove the no longer used outside Skia SK_SUPPORT_LEGACY_EMBOSSMASKFILTER
> define, and either delete the code it guards or update it to use the new
> emboss mask filter factory.
> 
> Re-enable the code to test the emboss mask filter.
> 
> Add a test to ensure that embossed text is drawn correctly, as before
> glyphs did not allocate the proper amount of memory for the k3D_Format
> which the emboss mask filter produces.
> 
> Fixes SkEmbossMask::Emboss to write the whole of the mul and add planes
> to avoid pixel differences and MemorySanitizer errors.
> 
> Update the GPU to understand the k3D_Format and use just the alpha
> plane, ignoring the mul and add plane which it currently cannot support.
> 
> Change-Id: Icac1a3f37d6e8c6be3151df570f5e14111e18585
> Reviewed-on: https://skia-review.googlesource.com/70260
> Reviewed-by: Herb Derby <herb@google.com>
> Reviewed-on: https://skia-review.googlesource.com/70962
> Commit-Queue: Ben Wagner <bungeman@google.com>

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

Change-Id: Id6625bae8d3bd70ce7aa3045348c04fdd146c637
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/71183
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-11-14 16:16:45 +00:00
Ben Wagner
1662257bda Alloc glyph image correctly for SkMask::k3D_Format.
Remove the no longer used outside Skia SK_SUPPORT_LEGACY_EMBOSSMASKFILTER
define, and either delete the code it guards or update it to use the new
emboss mask filter factory.

Re-enable the code to test the emboss mask filter.

Add a test to ensure that embossed text is drawn correctly, as before
glyphs did not allocate the proper amount of memory for the k3D_Format
which the emboss mask filter produces.

Fixes SkEmbossMask::Emboss to write the whole of the mul and add planes
to avoid pixel differences and MemorySanitizer errors.

Update the GPU to understand the k3D_Format and use just the alpha
plane, ignoring the mul and add plane which it currently cannot support.

Change-Id: Icac1a3f37d6e8c6be3151df570f5e14111e18585
Reviewed-on: https://skia-review.googlesource.com/70260
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-on: https://skia-review.googlesource.com/70962
Commit-Queue: Ben Wagner <bungeman@google.com>
2017-11-14 14:10:22 +00:00
Ben Wagner
3ae1a307f6 Revert "Alloc glyph image correctly for SkMask::k3D_Format."
This reverts commit 6b26deb8d6.

Reason for revert: GPU bots failing

Original change's description:
> Alloc glyph image correctly for SkMask::k3D_Format.
> 
> This removes the no longer used outside Skia
> SK_SUPPORT_LEGACY_EMBOSSMASKFILTER define, and either deletes the code
> it guards or updates it to use the new emboss mask filter factory. This
> re-enables the code to test the emboss mask filter. Also added is a test
> to ensure that embossed text is drawn correctly, as before this glyphs
> did not allocate the proper amount of memory for the k3D_Format which
> this mask filter produces. This also fixes SkEmbossMask::Emboss to write
> the whole of the mul and add planes to avoid pixel differences and
> MemorySanitizer errors.
> 
> Change-Id: Ib492c72a19d6a27d140e3cd48179a3ca9ce313f5
> Reviewed-on: https://skia-review.googlesource.com/70260
> Commit-Queue: Ben Wagner <bungeman@google.com>
> Reviewed-by: Herb Derby <herb@google.com>

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

Change-Id: I8a9db6c00e0cb84bdd4833474a9ffffa6ecc606c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/70920
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2017-11-13 20:43:06 +00:00
Ben Wagner
6b26deb8d6 Alloc glyph image correctly for SkMask::k3D_Format.
This removes the no longer used outside Skia
SK_SUPPORT_LEGACY_EMBOSSMASKFILTER define, and either deletes the code
it guards or updates it to use the new emboss mask filter factory. This
re-enables the code to test the emboss mask filter. Also added is a test
to ensure that embossed text is drawn correctly, as before this glyphs
did not allocate the proper amount of memory for the k3D_Format which
this mask filter produces. This also fixes SkEmbossMask::Emboss to write
the whole of the mul and add planes to avoid pixel differences and
MemorySanitizer errors.

Change-Id: Ib492c72a19d6a27d140e3cd48179a3ca9ce313f5
Reviewed-on: https://skia-review.googlesource.com/70260
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2017-11-13 20:26:21 +00:00
Mike Reed
48723156c5 remove legacy code for resolution
Bug: skia:
Change-Id: I6909325d4ee51140ec0edb47682de18617c23cc7
Reviewed-on: https://skia-review.googlesource.com/70100
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2017-11-10 19:59:47 +00:00
Mike Reed
77e487dfc0 Revert "Revert "Remove MakeForLocalSpace since picture image is sufficient""
This reverts commit fc45998242.

Reason for revert: google3 updated (I think)

Original change's description:
> Revert "Remove MakeForLocalSpace since picture image is sufficient"
> 
> This reverts commit 0d8766c84c.
> 
> Reason for revert: broke google3
> 
> Original change's description:
> > Remove MakeForLocalSpace since picture image is sufficient
> > 
> > Bug: skia:
> > Change-Id: If38e702c418e93141311490edf447d1f09ed4434
> > Reviewed-on: https://skia-review.googlesource.com/68640
> > Commit-Queue: Mike Reed <reed@google.com>
> > Reviewed-by: Florin Malita <fmalita@chromium.org>
> 
> TBR=robertphillips@google.com,fmalita@chromium.org,reed@google.com
> 
> Change-Id: I3dec3d2c704e02b4db5977c27cc3e6d9f1c68ed5
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:
> Reviewed-on: https://skia-review.googlesource.com/69500
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Mike Reed <reed@google.com>

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

Change-Id: I5751fa637d280f361dea0f248a43c1f7e9bd8bdc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/69661
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-11-09 21:50:27 +00:00
Mike Reed
fc45998242 Revert "Remove MakeForLocalSpace since picture image is sufficient"
This reverts commit 0d8766c84c.

Reason for revert: broke google3

Original change's description:
> Remove MakeForLocalSpace since picture image is sufficient
> 
> Bug: skia:
> Change-Id: If38e702c418e93141311490edf447d1f09ed4434
> Reviewed-on: https://skia-review.googlesource.com/68640
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>

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

Change-Id: I3dec3d2c704e02b4db5977c27cc3e6d9f1c68ed5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/69500
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-11-09 18:44:17 +00:00
Mike Reed
0d8766c84c Remove MakeForLocalSpace since picture image is sufficient
Bug: skia:
Change-Id: If38e702c418e93141311490edf447d1f09ed4434
Reviewed-on: https://skia-review.googlesource.com/68640
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2017-11-09 16:49:44 +00:00
Brian Salomon
4cbb6e6d55 Pass GrRenderTargetContext's GrColorSpaceInfo to SkShader and SkColorFilter.
Also to SkColorTo(Premul|Unpremul)GrColor4f.

This can avoid cache lookups to find GrColorSpaceXforms as the xform pointer is stored in GrColorSpaceInfo after the first lookup.

Also uses GrColorSpaceInfo to construct GrTextUtils::Paint.

Bug: skia:
Change-Id: Idf19d512a60d2269e6921c7fb54d93aee499a70d
Reviewed-on: https://skia-review.googlesource.com/63660
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2017-10-25 19:32:20 +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
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
Derek Sollenberger
2fbf1bc8c9 Add SK_API to APIs used by the android framework.
This CL enables us to set the default visibility of the symbols
on Android to hidden.  It is the intent that all of he SK_APIs
that have been added to /src directies should be removed as soon
as we can remove their callers within Android.

Bug: b/31971097
Change-Id: Ic787f94df0fb0c2b8d941aa7095a12b317c4b5de
Reviewed-on: https://skia-review.googlesource.com/49501
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
2017-09-21 18:14:36 +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
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 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
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
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
Sadrul Habib Chowdhury
4189d1b8b7 Add SK_API to SkOverdrawCanvas and SkOverdrawColorFilter.
The SkiaRenderer in chromium is going to use the overdraw canvas and
filter for measuring overdraw. Move these headers out of src/ into
include/.

Bug: chromium:704285
Change-Id: I2abb1671b73e3d26552462cf700340a7e3b874f0
Reviewed-on: https://skia-review.googlesource.com/36160
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-08-18 16:53:49 +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