Android浏览器显示大分辨率图片的问题 分享

很多人都发现android的浏览器显示大分辨图片会出现显示模糊的问题,我测试是超过100万像素(1024x1024)的图片就会出现模糊。在android的讨论网站上也有对这个问题的一个issue(http://code.google.com/p/android/issues/detail?id=6021 )。 很明显这是android的浏览器实现代码在加载图片的时候做了限制。相关代码在 external/webkit/WebCore/platform/graphics/android /ImageSourceAndroid.cpp,这个文件中有一个局部函数computeMaxBitmapSizeForCache(),看一下这个 函数前面的注释:
Images larger than this should be subsampled. Using ashmem, the decoded
pixels will be purged as needed, so this value can be pretty large. Making
it too small hurts image quality (e.g. abc.com background). 2Meg works for
the sites I've tested, but if we hit important sites that need more, we
should try increasing it and see if it has negative impact on performance
(i.e. we end up thrashing because we need to keep decoding images that have
been purged.

Perhaps this value should be some fraction of the available RAM...
已经说得很明白了,可以修改这个函数里面的常数(2*1024*1024),不过修改这个值以后记得改一下上面的一个宏定义MIN_RLE_ALLOC_SIZE为同样的值,否则在加载大图片时会很慢。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值