Galaxy Nexus, drawBitmap, and JNI

87 views
Skip to first unread message

GJTorikian

unread,
Dec 9, 2012, 1:35:43 PM12/9/12
to andro...@googlegroups.com
This is the third manifestation of a question I've been asking in several places, with zero results.

I suspect something foul is occurring with my Galaxy Nexus. Code that I've written runs fine on 2.2 devies, and it even runs fine on the ICS emulator--but not on my actual Galaxy Nexus.

I'm making updates to a live wallpaper I've developed. It does the WallpaperService in Java, then does some bitmap manipulation in native code. On the Galaxy Nexus, it seems that only the last column is being correctly drawn. For example, in a coordinate system, if my phone is 420 x 720 (not sure of the exact dimensions), then only pixels (420, 0) through (420, 719) are being drawn. The rest is black / transparent.


Why would a chunk of code work in the emulator, but not the device? And why does it work on pre-4.0 devices, and not this one? I've turned off hardware acceleration, to no effect. There's no crash, nothing ndk-gdb can tell me. Only the last rectangle of the bitmap is being drawn.

GJTorikian

unread,
Dec 9, 2012, 2:55:48 PM12/9/12
to andro...@googlegroups.com
All right, so after days I finally figured it out.

After creating my bitmap, I need to set every pixel in Java:

            for (int x = 0; x < 254; x++) {
                for (int y =0; y < 254; y++) {
                    bmp.setPixel(x, y, Color.argb(255, 0, 0, 0));
                }
            }


The question is: WHY only for ICS?
Reply all
Reply to author
Forward
0 new messages