MCPcopy Create free account
hub / github.com/Tencent/tgfx / GetHardwareBuffer

Method GetHardwareBuffer

src/platform/android/AndroidBitmap.cpp:65–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65HardwareBufferRef 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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected