Lines Matching defs:bitmap

100 bool TextureCache::canMakeTextureFromBitmap(const SkBitmap* bitmap) {
101 if (bitmap->width() > mMaxTextureSize || bitmap->height() > mMaxTextureSize) {
103 bitmap->width(), bitmap->height(), mMaxTextureSize, mMaxTextureSize);
111 Texture* TextureCache::getCachedTexture(const SkBitmap* bitmap, AtlasUsageType atlasUsageType) {
113 AssetAtlas::Entry* entry = mAssetAtlas->getEntry(bitmap->pixelRef());
119 Texture* texture = mCache.get(bitmap->pixelRef()->getStableID());
122 if (!canMakeTextureFromBitmap(bitmap)) {
126 const uint32_t size = bitmap->rowBytes() * bitmap->height();
128 // Don't even try to cache a bitmap that's bigger than the cache
141 texture->generation = bitmap->getGenerationID();
142 texture->upload(*bitmap);
146 bitmap, texture->id, size, mSize);
150 mCache.put(bitmap->pixelRef()->getStableID(), texture);
152 } else if (!texture->isInUse && bitmap->getGenerationID() != texture->generation) {
154 // TODO: Re-adjust the cache size if the bitmap's dimensions have changed
155 texture->upload(*bitmap);
156 texture->generation = bitmap->getGenerationID();
162 bool TextureCache::prefetchAndMarkInUse(void* ownerToken, const SkBitmap* bitmap) {
163 Texture* texture = getCachedTexture(bitmap, AtlasUsageType::Use);
170 Texture* TextureCache::get(const SkBitmap* bitmap, AtlasUsageType atlasUsageType) {
171 Texture* texture = getCachedTexture(bitmap, atlasUsageType);
174 if (!canMakeTextureFromBitmap(bitmap)) {
178 const uint32_t size = bitmap->rowBytes() * bitmap->height();
181 texture->upload(*bitmap);
182 texture->generation = bitmap->getGenerationID();