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

Method DrawFrame

camera/basic/src/main/cpp/camera_engine.cpp:155–172  ·  view source on GitHub ↗

* The main function rendering a frame. In our case, it is yuv to RGBA8888 * converter */

Source from the content-addressed store, hash-verified

153 * converter
154 */
155void CameraEngine::DrawFrame(void) {
156 if (!cameraReady_ || !yuvReader_) return;
157 AImage* image = yuvReader_->GetNextImage();
158 if (!image) {
159 return;
160 }
161
162 ANativeWindow_acquire(app_->window);
163 ANativeWindow_Buffer buf;
164 if (ANativeWindow_lock(app_->window, &buf, nullptr) < 0) {
165 yuvReader_->DeleteImage(image);
166 return;
167 }
168
169 yuvReader_->DisplayImage(&buf, image);
170 ANativeWindow_unlockAndPost(app_->window);
171 ANativeWindow_release(app_->window);
172}

Callers 1

android_mainFunction · 0.45

Calls 3

GetNextImageMethod · 0.80
DeleteImageMethod · 0.80
DisplayImageMethod · 0.80

Tested by

no test coverage detected