| 63 | } |
| 64 | |
| 65 | HardwareBufferRef AndroidBitmap::GetHardwareBuffer(JNIEnv* env, jobject bitmap) { |
| 66 | static const auto fromBitmap = AHardwareBufferFunctions::Get()->fromBitmap; |
| 67 | static const auto release = AHardwareBufferFunctions::Get()->release; |
| 68 | if (fromBitmap == nullptr || release == nullptr || bitmap == nullptr) { |
| 69 | return nullptr; |
| 70 | } |
| 71 | AHardwareBuffer* hardwareBuffer = nullptr; |
| 72 | fromBitmap(env, bitmap, &hardwareBuffer); |
| 73 | if (hardwareBuffer != nullptr) { |
| 74 | // The hardware buffer returned by AndroidBitmap_getHardwareBuffer() has a reference count of 1. |
| 75 | // We decrease it to keep the behaviour the same as AHardwareBuffer_fromHardwareBuffer(). |
| 76 | release(hardwareBuffer); |
| 77 | } |
| 78 | return hardwareBuffer; |
| 79 | } |
| 80 | } // namespace tgfx |
nothing calls this directly
no outgoing calls
no test coverage detected