Consolidate the common logic in a Gradient base class, and add
radial/conical/sweep factories.
Change-Id: Ife15ae78e7c6df48cfa67fe20054f9bd9a8a1e90
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420897
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
Paint both sides (two passes), and skip a face for inside visibility.
Change-Id: I138d790578c4ce30c7d4df9400485a983c1f9e95
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/414900
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
Additionally, pass return value from native save and saveLayer to java
Change-Id: I1a4e04305ba8e57f6a639978b00f8e2ca1a59f90
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/415170
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Also update SkottieSample to always clear its dest rect (for animations
which are not opaque).
Change-Id: I36c6172d468567ee8e03d97dd707e03ca968aa26
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/414898
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
Convert existing RuntimeShaderActivity to use RuntimeSample, and add
a couple to the cube demo.
Change-Id: Ibc6056cd6c7939c13bd902ce848c49a211b9b334
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/413737
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
Convert existing SkottieActivity to use a Skottie Sample, and also add
one to the cube demo.
Change-Id: I86193889d293ddd653b0cac7200e830fa873ea69
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/413736
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
Introduce a Sample interface for abstracting out various demos/samples.
Implement a simple image shader sample for starters.
Update the cube demo to map samples to sides.
Change-Id: I9c9c70fa05634404ced7bd30739f6e884546b91d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/413441
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
Update the cube sample to be centered and sized relative to the target
surface.
Also simplify projection handling:
- pre-compute a full view matrix in onSurfaceInitialized()
- set the origin to the surface center
- compute perspective and camera transforms in local coordinates
(instead of unit view cube)
Also fix (invert) fling Y direction.
Change-Id: I48a3d0b4547812fb3c9b49a9842fb18c0ed0d863
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/413436
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
Tangential updates:
- new encoded input stream Image factory
- Paint setters now return the object to support a fluent workflow
- cube demo updated to store face paints instead of colors
Change-Id: I6142a229b18165112ef1fe76acae38bc4b27480d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410789
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
Most samples use the same render thread boilerplate -- consolidate as
a utility base class.
Also add Canvas.getWidth/getHeight.
Change-Id: I27c9f51b4fd9d228a39593fbd4650a66d10240c2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/409896
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
This moves ownership of the SkSurface to ThreadedSurface::fWindowSurface.
When we pass a Message to the SurfaceThread, we will include a pointer to ThreadedSurface.fWindowSurface so we can call:
getCanvas() to draw the SkPicture
WindowSurface's constructor so it can hold the WindowContext made during the init
To reference WindowSurface in SurfaceThread, we need to make a header for Surface.cpp (added in this cl)
Change-Id: I8c67223eee301a1b6e0d05934e1f8597cf70bc64
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404918
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
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>
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 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>
Oscillating rect demo using a dedicated render thread.
At the moment this is using an intermediate Bitmap for rendering, but
should be converted to native GL Surface when it becomes available.
TBR=
Change-Id: I9b4f66598b6d2b56e865e7f1d10139a2bcf1f3e0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/398536
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
Add Color and Paint classes:
- Color is pure Java (equivalent of SkColor4f)
- Paint is backed by a native SkPaint
Change-Id: I79dbfae48f9e51254a51bc1c3966930f32cea5c4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/396020
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>