Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eb61cd82 authored by Romain Guy's avatar Romain Guy
Browse files

Optimize gradient textures

Compute the size of the backing textures based on the maximum possible
number of shades in the gradient.

Change-Id: I2d7f20477d31b81e9735f2c1d83ebdd0dbcbe340
parent 63553478
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -117,7 +117,7 @@ void GradientCache::clear() {
Texture* GradientCache::addLinearGradient(GradientCacheEntry& gradient,
        uint32_t* colors, float* positions, int count, SkShader::TileMode tileMode) {
    SkBitmap bitmap;
    bitmap.setConfig(SkBitmap::kARGB_8888_Config, 1024, 1);
    bitmap.setConfig(SkBitmap::kARGB_8888_Config, 256 * (count - 1), 1);
    bitmap.allocPixels();
    bitmap.eraseColor(0);