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

Method MakeFrom

src/platform/android/NativeCodec.cpp:244–262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242}
243
244std::shared_ptr<ImageCodec> ImageCodec::MakeFrom(NativeImageRef nativeImage) {
245 JNIEnvironment environment;
246 auto env = environment.current();
247 if (env == nullptr) {
248 return nullptr;
249 }
250 if (BitmapFactoryOptionsClass.get() == nullptr) {
251 LOGE("Could not run NativeCodec.MakeNativeCodec(), BitmapFactoryOptionsClass is not found!");
252 return nullptr;
253 }
254 auto info = AndroidBitmap::GetInfo(env, nativeImage);
255 if (info.isEmpty()) {
256 return nullptr;
257 }
258 auto image = std::shared_ptr<NativeCodec>(
259 new NativeCodec(info.width(), info.height(), Orientation::TopLeft));
260 image->nativeImage = nativeImage;
261 return image;
262}
263
264static jobject ConvertHardwareBitmap(JNIEnv* env, jobject bitmap) {
265 // The AndroidBitmapInfo does not contain the ANDROID_BITMAP_FLAGS_IS_HARDWARE flag in the old

Callers

nothing calls this directly

Calls 5

currentMethod · 0.80
getMethod · 0.45
isEmptyMethod · 0.45
widthMethod · 0.45
heightMethod · 0.45

Tested by

no test coverage detected