Note: Shouldn't add or change the Skia API, only accepts an optional z value to preScale()
Change-Id: Ic73c723ebc2b75acca1fce5395953434ef1582e6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404376
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
Known hacks for now:
- only default typeface
- only ascii support
Fonts have several limitations for now.
SkParagraph (our temporary backend) wants a fontmgr up front,
rather than just relying on the typefaces in its styles. This makes it
hard to inter-op with our JS api. Not a long-term problem, as this
backend is short-term. The hacky work-around is just to pass NULL for
the typeface for now.
Related but different, I haven't yet figured out how to "return" a
JS Typeface object. Something about bare-pointers and sk_sp. I'll figure
it out eventually, but for now I just set the output slot to null
as well. (there's a TODO in the .cpp)
Ascii support
JS strings are UTF16 (afaik). However, our current backend thinks in
terms of UTF8 offsets. Plus, (at the moment) when I try to access the
JS string for C++, it coerces to utf8 (std::string).
We can fix both of these eventually, but for now I'll just test with
ascii input characters, and the API can still work.
Change-Id: I62ca71b0b45d017ac8e3881c06720776dc2d75a1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/405400
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Also fixing a small problem with offsets that never appeared
because we never use this code path (but could)
Bug: skia:11947
Change-Id: I8c02c696797ea45d35fcab5746fbc079326e4539
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404897
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Introduce two new text properties to control the font size range when
auto-scaling text:
- plumb new json props ('mf' -- minimum font size, 'xf' -- maximum
font size)
- update the scale-to-fit binary search to use the specified extremes
Change-Id: I9e7e4915936a0be74bea473a520cf75acc05c84b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404781
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Change-Id: I5309005146b8121528ad23589fa64cc6bf286aee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402578
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This handles the case where a filter effect input is StrokePaint or
FillPaint, but the referencing element has a 'none' paint specified
(explicitly or via parsing error, as in the original bug report).
Bug: skia:11213
Change-Id: Ie710a9fc5ccb3c24014735e01c70a0ba42c7a99d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404696
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
This is in preparation for reusing the image loading + aspect ratio
mapping for <feImage>.
Change-Id: I53dcf904476aae386f672488379201524855a703
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404217
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Somewhat subtle, but we were improperly handling the override of the
default subregion via the 'width' and 'height' <fe*> attributes.
Simple example: when specifying 'x' but not 'width', previously we
would use the overridden x (subregion.fLeft = boundaries.fLeft;), but
were not updating subregion.fRight based on the new fLeft value.
Bug: skia:10841
Change-Id: I309de4f0cf50a413ea6a0e7605926a3eb6cd94e2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404205
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
The full 'display' presentation attribute [1] has a number of settings
that we likely don't want to support. However, 'display:none' has some
practical uses and is easy enough to support. This progresses some
local tests as well as a few W3C tests.
[1] https://www.w3.org/TR/SVG11/painting.html#DisplayProperty
Bug: skia:10842
Change-Id: I60fef959fb45c3cfb229b85b720dfa69fc458bc3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/403438
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Two issues:
1) we are currently computing object bounding boxes using the
RenderContext of the client resource, which can override presentation
attributes
-> introduce an OBBScope to capture not just the current OBB node but
also its original RenderContext
2) text fragments must use the root <text> bounding box for OBB-relative
units [1]
-> update SkSVGTextFragment::renderText to not override the current
OBBScope; this ensures we're using the root element scope for the
whole text subtree
[1] https://www.w3.org/TR/SVG11/text.html#ObjectBoundingBoxUnitsTextObjects
Bug: skia:11936
Change-Id: Ib48ccd3dc22639de42ea150b881a26dda72fa4bf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/403037
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Note Chrome, Firefox and Inkscape (only other viewers I tested) disagree
in smallish ways with the W3C png for filters-light-01. We're somewhere
in the middle, but likely conforming enough to call it correct.
Bug: skia:10841
Change-Id: Ia83b9936d260780148fe326b6d3b2248eef69aac
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/403036
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Introduce a helper (SkSVGRenderContext::obbTransform) and refactor all
obb clients to funnel their calls through it.
This will facilitate some follow up obb changes.
Bug: skia:11936
Change-Id: If0d81b0fc9148389c2cb4bff597057a2afa2fb1b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402956
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
https://www.w3.org/TR/SVG11/filters.html#feDistantLightElement
(specular lighting only in this CL)
Tests filters-specular-01-f and filters-light-02-f should be passing
now. Note that our filters-light-02 result matches the behavior of
Chrome and Firefox, but is different than the official W3C png. We
currently think the test is somewhat poorly written, so we are
comfortable matching the output of Chrome and Firefox.
Bug: skia:10841
Change-Id: Id9517c8594a3826e5d98685d1e7d1d1b3d3cdf51
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402582
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Also some includes that I noticed along the way.
Change-Id: If48a3a9ff8bd5daea21065051c811e8b3e8a701f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402136
Reviewed-by: Kevin Lubick <kjlubick@google.com>
1. Fold "origin" into the positions (simplification)
2. Extend positions and offset arrays by 1, to include 1-past last glyph
3. Add flags field to run (with just WS flag for now)
Change-Id: I93e38df808a5e9e4e5bcedbc62bc5a7aa433ef2e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/399876
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Yegor Jbanov <yjbanov@google.com>
Newer API with stricter error checking on signature of main and usage of
sample().
Bug: skia:11813
Change-Id: Ib13035e2e7af899dc9d17281b4420ec379001bee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/401916
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
Currently backed by sk_app, we need to move the Android window context files out of sk_app into its own module.
Vulkan is only supported by Android devices running SDK 24+, added guards to Create_VK and annotations for developers.
Change-Id: Ica64a1feef4a3daf50758df05df488da0346ed72
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/401796
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
This relands the idea that onMatchFaceStyle is no longer used, but
leaves the baseclass virtual to stage removing it from client
subclasses.
This reverts commit 3c04a65508.
Change-Id: I18570065249c86f7f155c28288dce3ea9d59f619
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/401759
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
SkMaskFilter::MakeBlur expects a sigma value, but Flutter/Libtxt had
incorrectly called it a radius.
Change-Id: I9ab1ef7a92370ca4825a65ca6f06e1fe9ac55167
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/401496
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Jason Simmons <jsimmons@google.com>
This is a no-op for the current/raster backend, but will be implemented
for GPU.
Change-Id: Id2ff4fe3b254b0d1730c2cb931737c372edbcf7e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/400096
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
- opaque Shader class to act as a Java SkShader wrapper
- shader slot on Paint
- RuntimeShaderBuilder utility to enable the same use pattern as native
Skia:
RuntimeShaderBuilder builder(sksl_string);
builder.setUniform("foo", 1);
builder.setUniform("bar", 2);
paint.setShader(builder.makeShader());
or, more fluent:
paint.setShader(
RuntimeShaderBuilder(sksl_string)
.setUniform("foo", 1)
.setUniform("bar", 2)
.makeShader());
Change-Id: I7cd241a2f64bc54dcae2175ed35040edf6506ed3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/399736
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Mike Reed <reed@google.com>
These new tests rely on compiled shaders that live in the
`tests/sksl/dslfp/` directory; this CL updates the Bazel and
emscripten build scripts to include these shaders.
Change-Id: Ib670682af8bf451a4473504dd4cc76a0e9222129
Bug: skia:11854
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/400097
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>