Optimize gradient textures

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

Change-Id: I2d7f20477d31b81e9735f2c1d83ebdd0dbcbe340
This commit is contained in:
Romain Guy
2012-07-18 20:26:02 -07:00
parent 6355347813
commit eb61cd8296

View File

@@ -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);