02-11-2010 02:15 PM
It seems calling setARGB on a Bitmap causes it be drawn 25x slower. The effects of setARGB are permanent, once it's called the Bitmap is forever drawn at a slower rate. I've noticed calling setARGB on a Bitmap in a constructor doesn't cause the slow down, only in other functions. Is there anyway to change this, anyway to keep the Bitmap drawn at an accelerated rate? Or is there another way to do the same function as setARGB?
Solved! Go to Solution.
02-11-2010 03:21 PM
Welcome to the forums.
This is a bit worrying.
Should I be able to see this for myself, if I just do a get and then a set, even if they are the same thing?
What size image are you testing with and is this on the device or the simulator?
02-11-2010 03:52 PM
I tested this on the simulator with System.getCurrentTimeMillis() over 1000 iterations to get an average for each case. Without setARGB, the image draws at about 0.08 ms (on average). Once I do setARGB, this jumps up to around 2 ms. Still very tiny on the simulator, but on the device these numbers are probably 20x worse.
The size of the image is 480x360. Doing a get and then set should work.
02-13-2010 07:06 PM
I would caution you from making to many broad assumptions based on simulator timing. But i agree that this seems disconcerting. I would guess that calling setARGB activates an alpha level on the bitmap, which will cause it to be drawn slower because of alpha blending that needs to happen. But that is just a Wild **bleep** Guess
02-13-2010 09:49 PM