Skip to content

Discard sourceImage when all frames generated.#24

Open
Leander1P wants to merge 1 commit intoskylarkstudio:masterfrom
Leander1P:evict-sourceImage-when-all-frames-generated
Open

Discard sourceImage when all frames generated.#24
Leander1P wants to merge 1 commit intoskylarkstudio:masterfrom
Leander1P:evict-sourceImage-when-all-frames-generated

Conversation

@Leander1P
Copy link

After the final frame is pulled in by generateBitmap(i) call, it appears
we can safely null both sourceImage and sourceImageAlpha.

The usual uses of merge and updateImage and other methods seems to be
supported; the one case this might break is a "merge with another
spritesheet with the same sourceImage and sourceImageAlpha as ourselves",
causing it to generate frames earlier than it would have otherwise.

Once again, I could see some arguments against this, so posting as an RFC. It's been fairly effective at memory reduction in mobile browsers for us.

After the final frame is pulled in by generateBitmap(i) call, it appears
we can safely null both sourceImage and sourceImageAlpha.

The usual uses of merge and updateImage and other methods seems to be
supported; the one case this might break is a "merge with another
spritesheet with the same sourceImage and sourceImageAlpha as ourselves",
causing it to generate frames earlier than it would have otherwise.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant