Tracking bug for refactoring Gradient & Pattern as immutable classes.
Gradient in particular has several mutation methods that seem ripe for removal:
* addColorStop, setP{0,1}, set{Start,End}Radius, setDrawsInPMColorSpace, setSpreadMethod: only used shortly after construction, should be folded into the constructor.
* setGradientSpaceTransform: tricky usage - some clients always update before applying to paint, while others ignore it (relying on existing value which seems fragile). This can be removed if we pass the local matrix to applyToMatrix instead.
If all mutation methods are removed, then all that's left of Gradient & Pattern is a collection of factory methods + an SkShader cache. At that point it may be possible to unify them (Shader superclass?) and simplify the client code which now has to treat them differently.
Comment 1 by f...@opera.com
, May 24 2016