Reproduction: https://jsfiddle.net/459cepyq/
Running the same linear gradient rendering code simple side by side with native ctx2d and MakeCanvas's ctx produces different results:

In the source code, LinearCanvasGradient’s _getShader is applying the current transform to the points before calling CanvasKit.Shader.MakeLinearGradient.
this._getShader = function(currentTransform) {Removing this step seems to produce the correct result:


I think by the time _getShader is called, surface’s `canvas` is already set up to the correct transform for this._canvas.drawPath() that uses this._fillPaint() (that calls _getShader()), so we don’t need to transform it again for MakeLinearGradient.
--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/a97bf7f9-803c-4570-bb10-130487204c76n%40googlegroups.com.
Thank you for the investigation. We didn’t have hard stop use cases so we didn’t discover it. Other than the gradient issue it is performing extremely well.
I think the compatible ctx2d is a hidden gem of canvaskit. It basically allows you to call ctx2d api and render with webgl (maybe webgpu in the future). This means you can migrate your existing ctx2d app to canvaskit, and progressively refactor it with native skia apis for better performance (drawVertices, drawAtlas etc), whereas for native ctx2d you would have hit a wall after pulling every trick in the book. The only downside is fonts management because system fonts won't be available (exclusive to native ctx2d's fillText), and Safari/Firefox support for Local Font Access api doesn't look promising.