Skip to content

Commit eb61cd8

Browse files
author
Romain Guy
committed
Optimize gradient textures
Compute the size of the backing textures based on the maximum possible number of shades in the gradient. Change-Id: I2d7f20477d31b81e9735f2c1d83ebdd0dbcbe340
1 parent 6355347 commit eb61cd8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libs/hwui/GradientCache.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ void GradientCache::clear() {
117117
Texture* GradientCache::addLinearGradient(GradientCacheEntry& gradient,
118118
uint32_t* colors, float* positions, int count, SkShader::TileMode tileMode) {
119119
SkBitmap bitmap;
120-
bitmap.setConfig(SkBitmap::kARGB_8888_Config, 1024, 1);
120+
bitmap.setConfig(SkBitmap::kARGB_8888_Config, 256 * (count - 1), 1);
121121
bitmap.allocPixels();
122122
bitmap.eraseColor(0);
123123

0 commit comments

Comments
 (0)