分区域加载大图,使用的是https://github.com/LuckyJayce/LargeImage
红米Pro手机上OK的,显示速度虽然慢点,但还是足够清晰。
在华为P9Plus上,
bitmap = decoder.decodeRegion(clipImageRect, decodingOptions);
返回的bitmap为null。
再看日志,有ERROR:
10-23 19:45:22.464 28415-28426/com.example.zhaohusdk_tester E/HW-JPEG-DEC: [HME_JPEG_DEC_Delete](3260): HME_JPEG_DEC_Delete: decoder_ctx=null
10-23 19:45:22.505 28415-28426/com.example.zhaohusdk_tester E/HW-JPEG-DEC: [HME_JPEG_DEC_Delete](3260): HME_JPEG_DEC_Delete: decoder_ctx=null
10-23 19:45:23.747 28415-28428/com.example.zhaohusdk_tester I/art: Background partial concurrent mark sweep GC freed 815(24KB) AllocSpace objects, 30(29MB) LOS objects, 36% free, 27MB/43MB, paused 6.084ms total 48.980ms
10-23 19:45:32.688 1306-1505/? E/HwCHRWebMonitor: running processName=com.example.zhaohusdk_tester
10-23 19:45:37.713 1306-1505/? E/HwCHRWebMonitor: running processName=com.example.zhaohusdk_tester
10-23 19:45:39.564 582-613/? I/AwareLog: HibSTrategy::HibStrategySwapCandidateProcessAdd packagename com.example.zhaohusdk_tester
10-23 19:45:39.567 582-613/? I/AwareLog: HibStrategy::HibStrategySwapCandidateProcessRemove packagename is com.example.zhaohusdk_tester
10-23 19:45:42.736 1306-1505/? E/HwCHRWebMonitor: running processName=com.example.zhaohusdk_tester
10-23 19:45:47.837 582-613/? I/AwareLog: HibSTrategy::HibStrategySwapCandidateProcessAdd packagename com.example.zhaohusdk_tester
10-23 19:45:47.839 582-613/? I/AwareLog: HibStrategy::HibStrategySwapCandidateProcessRemove packagename is com.example.zhaohusdk_tester
后发现是解析图片时bitmap复用导致。解析图片时不使用inbitmap属性,可以规避之。
网友评论