Lines Matching refs:Texture
38 mCache(GenerationCache<GradientCacheEntry, Texture*>::kUnlimitedCapacity),
52 mCache(GenerationCache<GradientCacheEntry, Texture*>::kUnlimitedCapacity),
84 void GradientCache::operator()(GradientCacheEntry& shader, Texture*& texture) {
85 if (texture) {
86 const uint32_t size = texture->width * texture->height * 4;
90 if (texture) {
91 glDeleteTextures(1, &texture->id);
92 delete texture;
100 Texture* GradientCache::get(uint32_t* colors, float* positions,
104 Texture* texture = mCache.get(gradient);
106 if (!texture) {
107 texture = addLinearGradient(gradient, colors, positions, count, tileMode);
110 return texture;
117 Texture* GradientCache::addLinearGradient(GradientCacheEntry& gradient,
145 Texture* texture = new Texture;
146 generateTexture(&bitmap, texture);
149 mCache.put(gradient, texture);
151 return texture;
154 void GradientCache::generateTexture(SkBitmap* bitmap, Texture* texture) {
157 LOGE("Cannot generate texture from shader");
161 texture->generation = bitmap->getGenerationID();
162 texture->width = bitmap->width();
163 texture->height = bitmap->height();
165 glGenTextures(1, &texture->id);
167 glBindTexture(GL_TEXTURE_2D, texture->id);
170 texture->blend = !bitmap->isOpaque();
171 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bitmap->rowBytesAsPixels(), texture->height, 0,
174 texture->setFilter(GL_LINEAR, GL_LINEAR);
175 texture->setWrap(GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE);