ScratchBitmapPool

initialCount < 0 uses the device tier's default (see setUpBasedOnDevice())


Constructor

new ScratchBitmapPool( doPooling?: boolean, initialCount?: integer, forcePoolingRegardlessOfDevice?: boolean, ): ScratchBitmapPool

Parameters

  • doPooling (boolean, optional, default: true)
  • initialCount (integer, optional, default: -1)
  • forcePoolingRegardlessOfDevice (boolean, optional, default: false)

Instance Methods

getRegion( askedForWidth: float, askedForHeight: float, onTopRight?: boolean, ): BGE.ScratchRegion

Parameters

  • askedForWidth (float)
  • askedForHeight (float)
  • onTopRight (boolean, optional, default: false)

Returns

returnRegion(usedRegion: ScratchRegion): void

Hands a region back. Its bitmap is reused from the next frame on (see onFrameEnd()).

Parameters

Returns

  • void

returnRegions(usedRegions: Array.<ScratchRegion>): void

Parameters

Returns

  • void

stageRegionsForReturn(usedRegions: Array.<ScratchRegion>): void

Same as returnRegions() - kept for callers that draw from the regions later this frame.

Parameters

Returns

  • void

returnStagedRegions(): void

No-op, kept for existing callers: returned regions are reused from the next frame.

Returns

  • void

onFrameEnd(): void

Makes every bitmap returned this frame available again. Call once per frame, after the screen has been swapped (Renderer.onSwapBuffers() does).

Returns

  • void

clearPool(): void

Returns

  • void

isPooling(): boolean

Whether regions come from pooled bitmaps (and so are limited to getMaxSize()).

Returns

  • boolean

getMaxSize(): SizeWH

Returns

getUsedThisFrameCount(): integer

How many returned bitmaps are waiting for onFrameEnd().

Returns

  • integer

getMaxPoolCount(): integer

The hard cap on how many ScratchBitmap instances this pool will ever create.

Returns

  • integer

toStr(): string

Returns

  • string