Open GoogleCodeExporter opened 8 years ago
I had a look at the source code for Canvas and it appears that the passed
bitmap is null:
81 public [More ...] <a name="Canvas.<init>(android.graphics.Bitmap)"
style="padding: 0px; margin: 0px; ">Canvas(Bitmap bitmap) {
82 if (!bitmap.isMutable()) {
83 throw new IllegalStateException(
84 "Immutable bitmap passed to Canvas constructor");
85 }
A look at the calling code suggests that the createBitmap method call in
ZoomInTileLooper returns null as Bitmap:
final Bitmap bitmap = Bitmap.createBitmap(pTileSizePx, pTileSizePx, Bitmap.Config.ARGB_8888);
final Canvas canvas = new Canvas(bitmap);
Checking the source for Bitmap this refers to a native method, which might
explain why the fault only happens on specific devices:
public static Bitmap createBitmap(int width, int height, Config config) {
Bitmap bm = nativeCreate(null, 0, width, width, height, config.nativeInt, true);
bm.eraseColor(0); // start with black/transparent pixels
return bm;
}
But if the Bitmap returned by createBitmap was null it would fail with a NPE in
bm.eraseColor(0). Is it possible that Huawei uses different libraries?
Original comment by osei...@gmail.com
on 9 Oct 2012 at 3:42
In the latest source the code has been changed to use Bitmap.Config.RGB_565
instead of Bitmap.Config.ARGB_8888. It's possible that may help.
Original comment by neilboyd
on 9 Oct 2012 at 5:42
I have noticed that change and will post here if it happens again with the
changed code.
Original comment by osei...@gmail.com
on 9 Oct 2012 at 6:57
This still occurs with Bitmap.Config.RGB_565 - I just got more error reports.
Any ideas?
Original comment by osei...@gmail.com
on 25 Mar 2013 at 2:53
Original issue reported on code.google.com by
osei...@gmail.com
on 9 Oct 2012 at 3:40