jackpocket/android-scratchoff

Need Much memory

Closed this issue · 2 comments

this view need much memory

Yes, it does. And the larger the area you want scratched, the more memory it will require.

In order to create the scratchable surface, a Bitmap is generated from the surface's drawing cache before scratching begins. As you scratch, that image is clipped and run through checks to determine if the threshold is passed.

Unfortunately, I never came up with a more efficient way to create that illusion, but I am always open to new ideas if you have any.

My comment from Jan 12 is less relevant after the last commit. Now, only 2 Bitmaps should be created and re-used when the controller is reset, instead of re-building the drawing cache each threshold cycle.

Bitmap memory used will still be directly related to the amount of space your View uses, though.