开发者

Why is drawing bitmaps is very slow on some android 2.2 phones?

开发者 https://www.devze.com 2023-01-21 06:36 出处:网络
I have a simple card game where the user can drag and drop cards around the screen. On some of the 2.2 开发者_StackOverflow社区android phones like the Droid and EVO the card drawing is very slow. This

I have a simple card game where the user can drag and drop cards around the screen. On some of the 2.2 开发者_StackOverflow社区android phones like the Droid and EVO the card drawing is very slow. This is strange because it happens on some of the faster phones. However it's not all phones I test on the Droid and Droid X and the program runs great also runs good on slower phone like the G1. I started getting reports about this after Motorolla released the 2.2 update for the Droid.

Here's the fix I came up with but it really lowers the quality of my graphics. Gradients look horrible.

I changed this

Bitmap.createBitmap(newBmp.getWidth(), newBmp.getHeight(), Bitmap.Config.ARGB_8888);

to this

Bitmap.createBitmap(newBmp.getWidth(), newBmp.getHeight(), Bitmap.Config.ARGB_4444);

The problem goes away but the looks suffer. I need to keep the alpha channel so I can't use RGB_565. Is there some way to keep my quality images and not make it run so slow?


Possibly these are some large Bitmaps that you are trying to process. Have a look at this android training Loading Large Bitmaps Efficiently .

I think this could help your performance and make loading bitmaps not block the main UI thread.

0

精彩评论

暂无评论...
验证码 换一张
取 消