-
public final class BitmapPoolObject pool for Bitmap instances to reduce GC pressure during scrolling. Reuses bitmaps of the same size instead of creating new ones. Thread-safe implementation using ConcurrentLinkedQueue and AtomicInteger.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classBitmapPool.Companion
-
Constructor Summary
Constructors Constructor Description BitmapPool(Integer maxPoolSize)
-
Method Summary
Modifier and Type Method Description final Bitmapacquire(Integer width, Integer height, Bitmap.Config config)Get a bitmap from the pool or create a new one. final Unitrelease(Bitmap bitmap)Return a bitmap to the pool for reuse. final UnitclearPool()Clear all pooled bitmaps. final StringgetStats()Get current pool statistics. -
-
Constructor Detail
-
BitmapPool
BitmapPool(Integer maxPoolSize)
-
-
Method Detail
-
acquire
final Bitmap acquire(Integer width, Integer height, Bitmap.Config config)
Get a bitmap from the pool or create a new one.
- Parameters:
width- Desired widthheight- Desired heightconfig- Bitmap configuration (RGB_565 or ARGB_8888)
-
release
final Unit release(Bitmap bitmap)
Return a bitmap to the pool for reuse.
- Parameters:
bitmap- The bitmap to recycle (will be added to pool or recycled)
-
-
-
-