| 62 | |
| 63 | #ifdef ANDROID |
| 64 | uint32_t* lockJavaBitmap(JNIEnv* env, jobject bitmap, AndroidBitmapInfo& info) |
| 65 | { |
| 66 | // https://developer.android.com/ndk/reference/group___bitmap.html |
| 67 | int ret = AndroidBitmap_getInfo(env, bitmap, &info); |
| 68 | if(ret < 0) |
| 69 | { |
| 70 | LOGE("AndroidBitmap_getInfo() failed ! error = %d", ret); |
| 71 | return nullptr; |
| 72 | } |
| 73 | |
| 74 | // LOGD("width:%d height:%d stride:%d", info.width, info.height, info.stride); |
| 75 | assert(info.format == ANDROID_BITMAP_FORMAT_RGBA_8888); |
| 76 | |
| 77 | uint32_t* pixels; |
| 78 | ret = AndroidBitmap_lockPixels(env, bitmap, reinterpret_cast<void**>(&pixels)); |
| 79 | if(ret < 0) |
| 80 | { |
| 81 | LOGE("AndroidBitmap_lockPixels() failed ! error=%d", ret); |
| 82 | return nullptr; |
| 83 | } |
| 84 | |
| 85 | return pixels; |
| 86 | } |
| 87 | |
| 88 | void unlockJavaBitmap(JNIEnv* env, jobject bitmap) |
| 89 | { |
no outgoing calls
no test coverage detected