Merge "Java bindings for SurfaceControl::setFinalCrop" into nyc-dev

This commit is contained in:
Pablo Ceballos
2016-03-23 16:30:52 +00:00
committed by Android (Google) Code Review
2 changed files with 23 additions and 0 deletions

View File

@@ -57,6 +57,7 @@ public class SurfaceControl {
private static native void nativeSetMatrix(long nativeObject, float dsdx, float dtdx, float dsdy, float dtdy);
private static native void nativeSetFlags(long nativeObject, int flags, int mask);
private static native void nativeSetWindowCrop(long nativeObject, int l, int t, int r, int b);
private static native void nativeSetFinalCrop(long nativeObject, int l, int t, int r, int b);
private static native void nativeSetLayerStack(long nativeObject, int layerStack);
private static native boolean nativeClearContentFrameStats(long nativeObject);
@@ -456,6 +457,16 @@ public class SurfaceControl {
}
}
public void setFinalCrop(Rect crop) {
checkNotReleased();
if (crop != null) {
nativeSetFinalCrop(mNativeObject,
crop.left, crop.top, crop.right, crop.bottom);
} else {
nativeSetFinalCrop(mNativeObject, 0, 0, 0, 0);
}
}
public void setLayerStack(int layerStack) {
checkNotReleased();
nativeSetLayerStack(mNativeObject, layerStack);

View File

@@ -309,6 +309,16 @@ static void nativeSetWindowCrop(JNIEnv* env, jclass clazz, jlong nativeObject,
}
}
static void nativeSetFinalCrop(JNIEnv* env, jclass clazz, jlong nativeObject,
jint l, jint t, jint r, jint b) {
SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
Rect crop(l, t, r, b);
status_t err = ctrl->setFinalCrop(crop);
if (err < 0 && err != NO_INIT) {
doThrowIAE(env);
}
}
static void nativeSetLayerStack(JNIEnv* env, jclass clazz, jlong nativeObject, jint layerStack) {
SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
status_t err = ctrl->setLayerStack(layerStack);
@@ -630,6 +640,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
(void*)nativeSetFlags },
{"nativeSetWindowCrop", "(JIIII)V",
(void*)nativeSetWindowCrop },
{"nativeSetFinalCrop", "(JIIII)V",
(void*)nativeSetFinalCrop },
{"nativeSetLayerStack", "(JI)V",
(void*)nativeSetLayerStack },
{"nativeGetBuiltInDisplay", "(I)Landroid/os/IBinder;",