MCPcopy Create free account
hub / github.com/android/ndk-samples / RenderPlasma

Function RenderPlasma

bitmap-plasma/app/src/main/cpp/plasma.cpp:330–365  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

328}
329
330void RenderPlasma(JNIEnv* env, jclass, jobject bitmap, jlong time_ms) {
331 AndroidBitmapInfo info;
332 void* pixels;
333 int ret;
334 static Stats stats;
335 static int init;
336
337 if (!init) {
338 init_tables();
339 stats_init(&stats);
340 init = 1;
341 }
342
343 if ((ret = AndroidBitmap_getInfo(env, bitmap, &info)) < 0) {
344 LOGE("AndroidBitmap_getInfo() failed ! error=%d", ret);
345 return;
346 }
347
348 if (info.format != ANDROID_BITMAP_FORMAT_RGB_565) {
349 LOGE("Bitmap format is not RGB_565 !");
350 return;
351 }
352
353 if ((ret = AndroidBitmap_lockPixels(env, bitmap, &pixels)) < 0) {
354 LOGE("AndroidBitmap_lockPixels() failed ! error=%d", ret);
355 }
356
357 stats_startFrame(&stats);
358
359 /* Now fill the values with a nice little plasma */
360 fill_plasma(&info, pixels, time_ms);
361
362 AndroidBitmap_unlockPixels(env, bitmap);
363
364 stats_endFrame(&stats);
365}

Callers

nothing calls this directly

Calls 5

init_tablesFunction · 0.85
stats_initFunction · 0.85
stats_startFrameFunction · 0.85
fill_plasmaFunction · 0.85
stats_endFrameFunction · 0.85

Tested by

no test coverage detected