Open jonathantneal opened 5 years ago
Yes, I will make the required changes, hopefully tonight.
@jonathantneal Alright, I tried porting that implementation over to CanvasKit. It uses a new approach to calculate color values using reference linear gradient generated by another buffer canvas.
I encountered a couple of bugs with Linear Gradient Shader but figured out fixes for most of them and will continue to figure out the remaining tomorrow. If it turns out that something is not easily fixable then I will for now just fall back to the latest master revision of the polyfill that still has more features than our current one but doesn't use gradients for color calculation yet.
Btw. CanvasKit was rapidly evolving lately and now has HTMLCanvas that is a wrapper over what we use right now and has same syntax and call signatures as a browser canvas. That's a perk that will allow for even less differences with original polyfill code in terms of drawing.
The conic gradient script should be updated, as it uses a version of the conic gradient polyfill that is a few years ago.
The latest and most feature-rich version appears to live at https://github.com/LeaVerou/conic-gradient/blob/665dbb4e104cc0dffdbe1715eb164c389892fd60/conic-gradient.js
@khovansky-al, could we use this version of the file and apply the deltas required by CanvasKit? We could add this to the next branch.