为什么在某些 Android 2.2 手机上绘制位图非常慢?
我有一个简单的纸牌游戏,用户可以在屏幕上拖放纸牌。在某些 2.2 Android 手机(例如 Droid 和 EVO)上,抽卡速度非常慢。这很奇怪,因为它发生在一些更快的手机上。然而,并不是我在 Droid 和 Droid X 上测试的所有手机,该程序运行良好,在 G1 等速度较慢的手机上也运行良好。在摩托罗拉发布 Droid 2.2 更新后,我开始收到有关此问题的报告。
这是我想出的修复方法,但它确实降低了我的图形质量。渐变看起来很可怕。
我把这个改成了
Bitmap.createBitmap(newBmp.getWidth(), newBmp.getHeight(), Bitmap.Config.ARGB_8888);
这个
Bitmap.createBitmap(newBmp.getWidth(), newBmp.getHeight(), Bitmap.Config.ARGB_4444);
问题消失了,但外观受到影响。我需要保留 Alpha 通道,因此无法使用 RGB_565。有什么方法可以保持我的图像质量并且不让它运行得这么慢吗?
I have a simple card game where the user can drag and drop cards around the screen. On some of the 2.2 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这些可能是您正在尝试处理的一些大型位图。看看这个 Android 培训高效加载大位图。
我认为这可以提高您的性能并使加载位图不会阻塞主 UI 线程。
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.