Home | History | Annotate | Download | only in hwui

Lines Matching refs:Texture

23 #include "Texture.h"
36 : mCache(LruCache<uint32_t, Texture*>::kUnlimitedCapacity)
44 INIT_LOGD(" Maximum texture dimension is %d pixels", mMaxTextureSize);
69 void TextureCache::operator()(uint32_t&, Texture*& texture) {
71 if (texture) {
72 mSize -= texture->bitmapSize;
74 texture->id, texture->bitmapSize, mSize);
76 ALOGD("Texture deleted, size = %d", texture->bitmapSize);
78 texture->deleteTexture();
79 delete texture;
92 LruCache<uint32_t, Texture*>::Iterator iter(mCache);
102 ALOGW("Bitmap too large to be uploaded into a texture (%dx%d, max=%dx%d)",
109 // Returns a prepared Texture* that either is already in the cache or can fit
111 Texture* TextureCache::getCachedTexture(const SkBitmap* bitmap, AtlasUsageType atlasUsageType) {
115 return entry->texture;
119 Texture* texture = mCache.get(bitmap->pixelRef()->getStableID());
121 if (!texture) {
130 Texture* oldest = mCache.peekOldestValue();
139 texture = new Texture(Caches::getInstance());
140 texture->bitmapSize = size;
141 texture->generation = bitmap->getGenerationID();
142 texture->upload(*bitmap);
145 TEXTURE_LOGD("TextureCache::get: create texture(%p): name, size, mSize = %d, %d, %d",
146 bitmap, texture->id, size, mSize);
148 ALOGD("Texture created, size = %d", size);
150 mCache.put(bitmap->pixelRef()->getStableID(), texture);
152 } else if (!texture->isInUse && bitmap->getGenerationID() != texture->generation) {
153 // Texture was in the cache but is dirty, re-upload
155 texture->upload(*bitmap);
156 texture->generation = bitmap->getGenerationID();
159 return texture;
163 Texture* texture = getCachedTexture(bitmap, AtlasUsageType::Use);
164 if (texture) {
165 texture->isInUse = ownerToken;
167 return texture;
174 Texture* TextureCache::get(const SkBitmap* bitmap, AtlasUsageType atlasUsageType) {
175 Texture* texture = getCachedTexture(bitmap, atlasUsageType);
177 if (!texture) {
183 texture = new Texture(Caches::getInstance());
184 texture->bitmapSize = size;
185 texture->upload(*bitmap);
186 texture->generation = bitmap->getGenerationID();
187 texture->cleanup = true;
190 return texture;