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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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.comTBR=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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>