Loading core/java/android/view/SurfaceControl.java +26 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,8 @@ public class SurfaceControl implements Parcelable { private static native void nativeSetMatrix(long transactionObj, long nativeObject, float dsdx, float dtdx, float dtdy, float dsdy); private static native void nativeSetColorTransform(long transactionObj, long nativeObject, float[] matrix, float[] translation); private static native void nativeSetColor(long transactionObj, long nativeObject, float[] color); private static native void nativeSetFlags(long transactionObj, long nativeObject, int flags, int mask); Loading Loading @@ -945,6 +947,18 @@ public class SurfaceControl implements Parcelable { } } /** * Sets the color transform for the Surface. * @param matrix A float array with 9 values represents a 3x3 transform matrix * @param translation A float array with 3 values represents a translation vector */ public void setColorTransform(@Size(9) float[] matrix, @Size(3) float[] translation) { checkNotReleased(); synchronized (SurfaceControl.class) { sGlobalTransaction.setColorTransform(this, matrix, translation); } } public void setWindowCrop(Rect crop) { checkNotReleased(); synchronized (SurfaceControl.class) { Loading Loading @@ -1438,6 +1452,18 @@ public class SurfaceControl implements Parcelable { return this; } /** * Sets the color transform for the Surface. * @param matrix A float array with 9 values represents a 3x3 transform matrix * @param translation A float array with 3 values represents a translation vector */ public Transaction setColorTransform(SurfaceControl sc, @Size(9) float[] matrix, @Size(3) float[] translation) { sc.checkNotReleased(); nativeSetColorTransform(mNativeObject, sc.mNativeObject, matrix, translation); return this; } @UnsupportedAppUsage public Transaction setWindowCrop(SurfaceControl sc, Rect crop) { sc.checkNotReleased(); Loading core/jni/android_view_SurfaceControl.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -339,6 +339,17 @@ static void nativeSetMatrix(JNIEnv* env, jclass clazz, jlong transactionObj, transaction->setMatrix(ctrl, dsdx, dtdx, dtdy, dsdy); } static void nativeSetColorTransform(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject, jfloatArray fMatrix, jfloatArray fTranslation) { auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj); SurfaceControl* const surfaceControl = reinterpret_cast<SurfaceControl*>(nativeObject); float* floatMatrix = env->GetFloatArrayElements(fMatrix, 0); mat3 matrix(static_cast<float const*>(floatMatrix)); float* floatTranslation = env->GetFloatArrayElements(fTranslation, 0); vec3 translation(floatTranslation[0], floatTranslation[1], floatTranslation[2]); transaction->setColorTransform(surfaceControl, matrix, translation); } static void nativeSetWindowCrop(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject, jint l, jint t, jint r, jint b) { Loading Loading @@ -849,6 +860,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = { (void*)nativeSetColor }, {"nativeSetMatrix", "(JJFFFF)V", (void*)nativeSetMatrix }, {"nativeSetColorTransform", "(JJ[F[F)V", (void*)nativeSetColorTransform }, {"nativeSetFlags", "(JJII)V", (void*)nativeSetFlags }, {"nativeSetWindowCrop", "(JJIIII)V", Loading Loading
core/java/android/view/SurfaceControl.java +26 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,8 @@ public class SurfaceControl implements Parcelable { private static native void nativeSetMatrix(long transactionObj, long nativeObject, float dsdx, float dtdx, float dtdy, float dsdy); private static native void nativeSetColorTransform(long transactionObj, long nativeObject, float[] matrix, float[] translation); private static native void nativeSetColor(long transactionObj, long nativeObject, float[] color); private static native void nativeSetFlags(long transactionObj, long nativeObject, int flags, int mask); Loading Loading @@ -945,6 +947,18 @@ public class SurfaceControl implements Parcelable { } } /** * Sets the color transform for the Surface. * @param matrix A float array with 9 values represents a 3x3 transform matrix * @param translation A float array with 3 values represents a translation vector */ public void setColorTransform(@Size(9) float[] matrix, @Size(3) float[] translation) { checkNotReleased(); synchronized (SurfaceControl.class) { sGlobalTransaction.setColorTransform(this, matrix, translation); } } public void setWindowCrop(Rect crop) { checkNotReleased(); synchronized (SurfaceControl.class) { Loading Loading @@ -1438,6 +1452,18 @@ public class SurfaceControl implements Parcelable { return this; } /** * Sets the color transform for the Surface. * @param matrix A float array with 9 values represents a 3x3 transform matrix * @param translation A float array with 3 values represents a translation vector */ public Transaction setColorTransform(SurfaceControl sc, @Size(9) float[] matrix, @Size(3) float[] translation) { sc.checkNotReleased(); nativeSetColorTransform(mNativeObject, sc.mNativeObject, matrix, translation); return this; } @UnsupportedAppUsage public Transaction setWindowCrop(SurfaceControl sc, Rect crop) { sc.checkNotReleased(); Loading
core/jni/android_view_SurfaceControl.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -339,6 +339,17 @@ static void nativeSetMatrix(JNIEnv* env, jclass clazz, jlong transactionObj, transaction->setMatrix(ctrl, dsdx, dtdx, dtdy, dsdy); } static void nativeSetColorTransform(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject, jfloatArray fMatrix, jfloatArray fTranslation) { auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj); SurfaceControl* const surfaceControl = reinterpret_cast<SurfaceControl*>(nativeObject); float* floatMatrix = env->GetFloatArrayElements(fMatrix, 0); mat3 matrix(static_cast<float const*>(floatMatrix)); float* floatTranslation = env->GetFloatArrayElements(fTranslation, 0); vec3 translation(floatTranslation[0], floatTranslation[1], floatTranslation[2]); transaction->setColorTransform(surfaceControl, matrix, translation); } static void nativeSetWindowCrop(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject, jint l, jint t, jint r, jint b) { Loading Loading @@ -849,6 +860,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = { (void*)nativeSetColor }, {"nativeSetMatrix", "(JJFFFF)V", (void*)nativeSetMatrix }, {"nativeSetColorTransform", "(JJ[F[F)V", (void*)nativeSetColorTransform }, {"nativeSetFlags", "(JJII)V", (void*)nativeSetFlags }, {"nativeSetWindowCrop", "(JJIIII)V", Loading