@@ -752,6 +752,25 @@ static void Surface_copyFrom(
752752 }
753753}
754754
755+ static void Surface_transferFrom (
756+ JNIEnv* env, jobject clazz, jobject other)
757+ {
758+ if (clazz == other)
759+ return ;
760+
761+ if (other == NULL ) {
762+ doThrowNPE (env);
763+ return ;
764+ }
765+
766+ sp<SurfaceControl> control (getSurfaceControl (env, other));
767+ sp<Surface> surface (Surface_getSurface (env, other));
768+ setSurfaceControl (env, clazz, control);
769+ setSurface (env, clazz, surface);
770+ setSurfaceControl (env, other, 0 );
771+ setSurface (env, other, 0 );
772+ }
773+
755774static void Surface_readFromParcel (
756775 JNIEnv* env, jobject clazz, jobject argParcel)
757776{
@@ -820,6 +839,7 @@ static JNINativeMethod gSurfaceMethods[] = {
820839 {" destroy" , " ()V" , (void *)Surface_destroy },
821840 {" release" , " ()V" , (void *)Surface_release },
822841 {" copyFrom" , " (Landroid/view/Surface;)V" , (void *)Surface_copyFrom },
842+ {" transferFrom" , " (Landroid/view/Surface;)V" , (void *)Surface_transferFrom },
823843 {" isValid" , " ()Z" , (void *)Surface_isValid },
824844 {" lockCanvasNative" , " (Landroid/graphics/Rect;)Landroid/graphics/Canvas;" , (void *)Surface_lockCanvas },
825845 {" unlockCanvasAndPost" , " (Landroid/graphics/Canvas;)V" , (void *)Surface_unlockCanvasAndPost },
0 commit comments