Well, there seems to be a bug when specifying a different Format in the Options of BitmapFactory.decodeStream(). I specified ARGB4444 and it didn't complain. On 2.0 it worked, on the G1/MyTouch it didn't. Maybe i'll file a bug about this.
On 2 Feb., 15:46, Mario Zechner <badlogicga...@gmail.com> wrote: > Hi, > > I have a larger 512x512 32-bit ARGB Bitmap loaded from a PNG in my > application. I traverse each pixel in this bitmap as follows: > > int height = bitmap.getHeight()-1; > for( int y = 0; y < bitmap.getHeight(); y++ ) > { > for( int x = 0; x < bitmap.getWidth(); x++ ) > { > int pixel = bitmap.getPixel( x, y); > collisionMap[x][height-y] = pixel != -1 ?(byte)BACKGROUND_PIXEL: > 0; > } > > } > > I check each pixel in the bitmap for a specific color value and set a > byte in a corresponding 2D array that has the same dimensions as the > image. This works perfectly fine on my droid, on my hero as well as on > the emulator. I send the app containing this code to some other people > that have a g1 and a mytouch and there this few lines fail horribly > with a segfault: > > 02-01 17:47:25.532 I/ActivityManager( 74): Process > android.process.media (pid 3920) has died. > 02-01 17:47:25.622 I/DEBUG ( 48): *** *** *** *** *** *** *** *** > *** *** *** *** *** *** *** *** > 02-01 17:47:25.622 I/DEBUG ( 48): Build fingerprint: 'tmobile/opal/ > sapphire/sapphire:1.6/DRC92/15632:user/ota-rel-keys,release-keys' > 02-01 17:47:25.622 I/DEBUG ( 48): pid: 4033, tid: 4039 >>> > com.badlogic.doodleescape <<< > 02-01 17:47:25.622 I/DEBUG ( 48): signal 7 (SIGBUS), fault addr > 00000000 > 02-01 17:47:25.622 I/DEBUG ( 48): r0 44527d84 r1 4622700a r2 > 00000001 r3 00000000 > 02-01 17:47:25.622 I/DEBUG ( 48): r4 00000001 r5 4622700a r6 > 44527d84 r7 4104be78 > 02-01 17:47:25.622 I/DEBUG ( 48): r8 44527d9c r9 4104be6c 10 > 4104be5c fp 00000001 > 02-01 17:47:25.622 I/DEBUG ( 48): ip 4622700a sp 44527d70 lr > ad346c1f pc ad3469a0 cpsr 00000030 > 02-01 17:47:26.242 I/DEBUG ( 48): #00 pc 000469a0 / > system/lib/libandroid_runtime.so > 02-01 17:47:26.242 I/DEBUG ( 48): #01 pc 00046c1c / > system/lib/libandroid_runtime.so > 02-01 17:47:26.242 I/DEBUG ( 48): #02 pc 0000e434 / > system/lib/libdvm.so > 02-01 17:47:26.252 I/DEBUG ( 48): stack: > 02-01 17:47:26.252 I/DEBUG ( 48): 44527d30 ad083e1c /system/ > lib/libdvm.so > 02-01 17:47:26.252 I/DEBUG ( 48): 44527d34 ad0159f4 /system/ > lib/libdvm.so > 02-01 17:47:26.252 I/DEBUG ( 48): 44527d38 0000032c > 02-01 17:47:26.252 I/DEBUG ( 48): 44527d3c 0000002a > 02-01 17:47:26.252 I/DEBUG ( 48): 44527d40 00000054 > 02-01 17:47:26.252 I/DEBUG ( 48): 44527d44 ad083e1c /system/ > lib/libdvm.so > 02-01 17:47:26.252 I/DEBUG ( 48): 44527d48 00000064 > 02-01 17:47:26.262 I/DEBUG ( 48): 44527d4c 0000001a > 02-01 17:47:26.262 I/DEBUG ( 48): 44527d50 00000000 > 02-01 17:47:26.262 I/DEBUG ( 48): 44527d54 4104be78 > 02-01 17:47:26.262 I/DEBUG ( 48): 44527d58 00000001 > 02-01 17:47:26.262 I/DEBUG ( 48): 44527d5c 41c3a728 /system/ > framework/framework.odex > 02-01 17:47:26.262 I/DEBUG ( 48): 44527d60 00000003 > 02-01 17:47:26.262 I/DEBUG ( 48): 44527d64 41c3a728 /system/ > framework/framework.odex > 02-01 17:47:26.262 I/DEBUG ( 48): 44527d68 df002777 > 02-01 17:47:26.262 I/DEBUG ( 48): 44527d6c e3a070ad > 02-01 17:47:26.262 I/DEBUG ( 48): #00 44527d70 ad346999 /system/ > lib/libandroid_runtime.so > 02-01 17:47:26.262 I/DEBUG ( 48): 44527d74 001aae00 [heap] > 02-01 17:47:26.262 I/DEBUG ( 48): 44527d78 00000001 > 02-01 17:47:26.262 I/DEBUG ( 48): 44527d7c ad346c1f /system/ > lib/libandroid_runtime.so > 02-01 17:47:26.262 I/DEBUG ( 48): #01 44527d80 00000027 > 02-01 17:47:26.262 I/DEBUG ( 48): 44527d84 ffffffff > 02-01 17:47:26.262 I/DEBUG ( 48): 44527d88 44527dc0 > 02-01 17:47:26.262 I/DEBUG ( 48): 44527d8c 00000004 > 02-01 17:47:26.262 I/DEBUG ( 48): 44527d90 ad346bed /system/ > lib/libandroid_runtime.so > 02-01 17:47:26.262 I/DEBUG ( 48): 44527d94 ad00e438 /system/ > lib/libdvm.so > 02-01 17:47:28.122 I/ActivityManager( 74): Process > com.badlogic.doodleescape (pid 4033) has died. > > The bitmap is loaded successfully otherwise i'd get a > NullPointerException when requesting its height in the first line of > code. It seems that Bitmap.getPixel() fails with a segfault. > > I have not the slightest clou of what is happening here. The really > frightening part is that it works on the droid,hero and emulator but > not on g1 hardware. I'd really appreciate any pointers. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en