Use ColorLongs in Linear-, Radial-, and Sweep-Gradient
Bug: 122844033 Test: Id1809aef84eca0ccc61bafc2476ad52ed78d5f22 Add APIs that mirror the existing creation APIs, but use @ColorLongs instead of @ColorInts. Note that call-sites that used a null array (but not a variable "int[]" pointing to a null array) are now ambiguous. It is unlikely that there are any such call-sites, though, since they would throw NullPointerException. Consolidate constructors. Those that take two color endpoints now create two-member long-arrays and call the more general constructor, saving lots of code. The additional cost of small arrays is not as much as it used to be, in the early days of Android, when this class was written. In *Gradient#copy, there is no longer any need to clone the colors array, since the mColorLongs was created by the Gradient. Similarly, there never was any need to clone mPositions, which was always a clone of the user-supplied array anyway. Clean up Shader.cpp: - Throw and return if the pointer is null before dereferencing it. - Simplify and put together matrix-related code. Change-Id: Ib71c5e85b2a398959bf687bce33980d3429bcbc3
Loading
Please register or sign in to comment