Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 015912e7 authored by Jim Miller's avatar Jim Miller Committed by Android (Google) Code Review
Browse files

Merge "Make sure we have a native Surface in nContextSetSurface."

parents a2af03f8 ee956053
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@
#include "jni.h"
#include "JNIHelp.h"
#include "android_runtime/AndroidRuntime.h"
#include "android_runtime/android_view_Surface.h"

#include <RenderScript.h>
#include <RenderScriptEnv.h>
@@ -184,9 +185,7 @@ nContextSetSurface(JNIEnv *_env, jobject _this, RsContext con, jint width, jint
    if (wnd == NULL) {

    } else {
        jclass surface_class = _env->FindClass("android/view/Surface");
        jfieldID surfaceFieldID = _env->GetFieldID(surface_class, ANDROID_VIEW_SURFACE_JNI_ID, "I");
        window = (Surface*)_env->GetIntField(wnd, surfaceFieldID);
        window = (Surface*) android_Surface_getNativeWindow(_env, wnd).get();
    }

    rsContextSetSurface(con, width, height, window);