Lines Matching refs:texture

42         INIT_LOGD("  Setting texture cache size to %sMB", property);
45 INIT_LOGD(" Using default texture cache size of %.2fMB", DEFAULT_TEXTURE_CACHE_SIZE);
50 INIT_LOGD(" Setting texture cache flush rate to %.2f%%", flushRate * 100.0f);
53 INIT_LOGD(" Using default texture cache flush rate of %.2f%%",
74 INIT_LOGD(" Maximum texture dimension is %d pixels", mMaxTextureSize);
106 void TextureCache::operator()(SkBitmap*& bitmap, Texture*& texture) {
108 if (texture) {
109 mSize -= texture->bitmapSize;
111 texture->id, texture->bitmapSize, mSize);
113 ALOGD("Texture deleted, size = %d", texture->bitmapSize);
115 glDeleteTextures(1, &texture->id);
116 delete texture;
125 Texture* texture = mCache.get(bitmap);
127 if (!texture) {
129 ALOGW("Bitmap too large to be uploaded into a texture (%dx%d, max=%dx%d)",
142 texture = new Texture;
143 texture->bitmapSize = size;
144 generateTexture(bitmap, texture, false);
148 TEXTURE_LOGD("TextureCache::get: create texture(%p): name, size, mSize = %d, %d, %d",
149 bitmap, texture->id, size, mSize);
153 mCache.put(bitmap, texture);
155 texture->cleanup = true;
157 } else if (bitmap->getGenerationID() != texture->generation) {
158 generateTexture(bitmap, texture, true);
161 return texture;
165 Texture* texture = new Texture;
166 texture->bitmapSize = bitmap->rowBytes() * bitmap->height();
167 texture->cleanup = true;
169 generateTexture(bitmap, texture, false);
171 return texture;
212 void TextureCache::generateTexture(SkBitmap* bitmap, Texture* texture, bool regenerate) {
216 ALOGE("Cannot generate texture from bitmap");
224 // If the texture had mipmap enabled but not anymore,
226 const bool resize = !regenerate || bitmap->width() != int(texture->width) ||
227 bitmap->height() != int(texture->height) ||
228 (regenerate && canMipMap && texture->mipMap && !bitmap->hasHardwareMipMap());
231 glGenTextures(1, &texture->id);
234 texture->generation = bitmap->getGenerationID();
235 texture->width = bitmap->width();
236 texture->height = bitmap->height();
238 glBindTexture(GL_TEXTURE_2D, texture->id);
243 uploadToTexture(resize, GL_ALPHA, bitmap->rowBytesAsPixels(), texture->height,
245 texture->blend = true;
249 uploadToTexture(resize, GL_RGB, bitmap->rowBytesAsPixels(), texture->height,
251 texture->blend = false;
255 uploadToTexture(resize, GL_RGBA, bitmap->rowBytesAsPixels(), texture->height,
259 texture->blend = !bitmap->isOpaque();
264 uploadLoFiTexture(resize, bitmap, texture->width, texture->height);
265 texture->blend = !bitmap->isOpaque();
273 texture->mipMap = bitmap->hasHardwareMipMap();
274 if (texture->mipMap) {
280 texture->setFilter(GL_NEAREST);
281 texture->setWrap(GL_CLAMP_TO_EDGE);