Various fixes for linear blending and gradients

With linear blending turned off some textures were still
created as sRGB textures instead of linear textures.
Multi-stop gradients were not behaving properly on devices
with no support for float textures.
Gradients are now always interpolated in linear space
even if linear blending is off.
New functions to always force sRGB->linear->sRGB conversions.

Test: Manual testing
Bug: 29940137
Change-Id: Ie2f84ee2a65fd85570e88af813e841e0e625df6c
diff --git a/libs/hwui/GradientCache.h b/libs/hwui/GradientCache.h
index 3fd8e80..5e35435 100644
--- a/libs/hwui/GradientCache.h
+++ b/libs/hwui/GradientCache.h
@@ -154,11 +154,13 @@
     size_t bytesPerPixel() const;
     size_t sourceBytesPerPixel() const;
 
-    typedef void (GradientCache::*ChannelMixer)(FloatColor& start, FloatColor& end,
+    typedef void (GradientCache::*ChannelMixer)(const FloatColor& start, const FloatColor& end,
             float amount, uint8_t*& dst) const;
 
-    void mixBytes(FloatColor& start, FloatColor& end, float amount, uint8_t*& dst) const;
-    void mixFloats(FloatColor& start, FloatColor& end, float amount, uint8_t*& dst) const;
+    void mixBytes(const FloatColor& start, const FloatColor& end,
+            float amount, uint8_t*& dst) const;
+    void mixFloats(const FloatColor& start, const FloatColor& end,
+            float amount, uint8_t*& dst) const;
 
     LruCache<GradientCacheEntry, Texture*> mCache;