ScratchBitmapPool


Constructor

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

Parameters

  • doPooling (boolean, optional, default: true)
  • initialCount (integer, optional, default: 10)
  • 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

Parameters

Returns

  • void

returnRegions(usedRegions: dynamic): void

Parameters

  • usedRegions (dynamic)

Returns

  • void

stageRegionsForReturn(usedRegions: dynamic): void

Stages regions for later return to the pool via returnStagedRegions(). A caller may still call returnStagedRegions() itself whenever it's convenient (e.g. once at the end of a frame) - that's still correct, just a no-op if nothing is staged. But it's no longer required for correctness: once stagedRegions crosses selfFlushThreshold, this flushes them itself, so a caller that stages many regions across many draws (e.g. a textured model's per-face triangle draws) can't exhaust the pool by batching too long between manual flushes - see #129.

Parameters

  • usedRegions (dynamic)

Returns

  • void

returnStagedRegions(): void

Returns

  • void

clearPool(): void

Returns

  • void

getMaxSize(): SizeWH

Returns

getStagedCount(): integer

Number of regions currently staged awaiting return to the pool (i.e. not yet flushed by returnStagedRegions()). Exposed mainly for tests of the self-flush behavior in stageRegionsForReturn() - see #129.

Returns

  • integer

getMaxPoolCount(): integer

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

Returns

  • integer

getSelfFlushThreshold(): integer

The staged-region count at which stageRegionsForReturn() self-flushes.

Returns

  • integer

toStr(): string

Returns

  • string