Is an immutable Bitmap faster then a mutable one?

匿名 (未验证) 提交于 2019-12-03 03:04:01

问题:

The Bitmap class has a method copy() with the signature below:

public Bitmap copy(Bitmap.Config config, boolean isMutable) 

Is there a performance difference between a mutable and an immutable Bitmap?

回答1:

Romain Guy answered in the comments:

To answer the original question: no, there is no performance difference. There are some optimizations we could implement for mutable bitmaps though. Hopefully in a future release :)



回答2:

There is no performance difference. This will not affect the performance of your app. If you want to perform any opration like rotation etc then i think the bitmap should be mutable...



回答3:

On Application level, there is always a difference between immutable & mutable Bitmap resources.

You always get an immutable Bitmap from the resources. you need to convert them into mutable bitmap as per necessiti.

Bitmap Bitmap = BitmapFactory.decodeResource(....); Bitmap mutableBitmap = immutableBitmap.copy(Bitmap.Config.ARGB_8888, true);

So probably there must be a performance issue in this reference.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!