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

Commit 18809c06 authored by Chris Craik's avatar Chris Craik Committed by Android (Google) Code Review
Browse files

Merge "3d view system!"

parents f8bc9642 f57776b2
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -437,6 +437,21 @@ public abstract class DisplayList {
     */
    public abstract float getTranslationY();

    /**
     * Sets the translation value for the display list on the Z axis
     *
     * @see View#setTranslationZ(float)
     * @see #getTranslationZ()
     */
    public abstract void setTranslationZ(float translationZ);

    /**
     * Returns the translation value for this display list on the Z axis.
     *
     * @see #setTranslationZ(float)
     */
    public abstract float getTranslationZ();

    /**
     * Sets the rotation value for the display list around the Z axis
     *
@@ -536,7 +551,8 @@ public abstract class DisplayList {
     *
     * @hide
     */
    public abstract void setTransformationInfo(float alpha, float translationX, float translationY,
    public abstract void setTransformationInfo(float alpha,
            float translationX, float translationY, float translationZ,
            float rotation, float rotationX, float rotationY, float scaleX, float scaleY);

    /**
+23 −4
Original line number Diff line number Diff line
@@ -230,6 +230,21 @@ class GLES20DisplayList extends DisplayList {
        return 0.0f;
    }

    @Override
    public void setTranslationZ(float translationZ) {
        if (hasNativeDisplayList()) {
            nSetTranslationZ(mFinalizer.mNativeDisplayList, translationZ);
        }
    }

    @Override
    public float getTranslationZ() {
        if (hasNativeDisplayList()) {
            return nGetTranslationZ(mFinalizer.mNativeDisplayList);
        }
        return 0.0f;
    }

    @Override
    public void setRotation(float rotation) {
        if (hasNativeDisplayList()) {
@@ -306,10 +321,12 @@ class GLES20DisplayList extends DisplayList {
    }

    @Override
    public void setTransformationInfo(float alpha, float translationX, float translationY,
    public void setTransformationInfo(float alpha,
            float translationX, float translationY, float translationZ,
            float rotation, float rotationX, float rotationY, float scaleX, float scaleY) {
        if (hasNativeDisplayList()) {
            nSetTransformationInfo(mFinalizer.mNativeDisplayList, alpha, translationX, translationY,
            nSetTransformationInfo(mFinalizer.mNativeDisplayList, alpha,
                    translationX, translationY, translationZ,
                    rotation, rotationX, rotationY, scaleX, scaleY);
        }
    }
@@ -466,14 +483,15 @@ class GLES20DisplayList extends DisplayList {
            boolean hasOverlappingRendering);
    private static native void nSetTranslationX(int displayList, float translationX);
    private static native void nSetTranslationY(int displayList, float translationY);
    private static native void nSetTranslationZ(int displayList, float translationZ);
    private static native void nSetRotation(int displayList, float rotation);
    private static native void nSetRotationX(int displayList, float rotationX);
    private static native void nSetRotationY(int displayList, float rotationY);
    private static native void nSetScaleX(int displayList, float scaleX);
    private static native void nSetScaleY(int displayList, float scaleY);
    private static native void nSetTransformationInfo(int displayList, float alpha,
            float translationX, float translationY, float rotation, float rotationX,
            float rotationY, float scaleX, float scaleY);
            float translationX, float translationY, float translationZ,
            float rotation, float rotationX, float rotationY, float scaleX, float scaleY);
    private static native void nSetStaticMatrix(int displayList, int nativeMatrix);
    private static native void nSetAnimationMatrix(int displayList, int animationMatrix);

@@ -489,6 +507,7 @@ class GLES20DisplayList extends DisplayList {
    private static native float nGetScaleY(int displayList);
    private static native float nGetTranslationX(int displayList);
    private static native float nGetTranslationY(int displayList);
    private static native float nGetTranslationZ(int displayList);
    private static native float nGetRotation(int displayList);
    private static native float nGetRotationX(int displayList);
    private static native float nGetRotationY(int displayList);
+33 −0
Original line number Diff line number Diff line
@@ -2981,6 +2981,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        @ViewDebug.ExportedProperty
        float mTranslationY = 0f;
        @ViewDebug.ExportedProperty
        float mTranslationZ = 0f;
        /**
         * The amount of scale in the x direction around the pivot point. A
         * value of 1 means no scaling is applied.
@@ -10507,6 +10510,35 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        }
    }
    /**
     * @hide
     */
    @ViewDebug.ExportedProperty(category = "drawing")
    public float getTranslationZ() {
        return mTransformationInfo != null ? mTransformationInfo.mTranslationZ : 0;
    }
    /**
     * @hide
     */
    public void setTranslationZ(float translationZ) {
        ensureTransformationInfo();
        final TransformationInfo info = mTransformationInfo;
        if (info.mTranslationZ != translationZ) {
            invalidateViewProperty(true, false);
            info.mTranslationZ = translationZ;
            info.mMatrixDirty = true;
            invalidateViewProperty(false, true);
            if (mDisplayList != null) {
                mDisplayList.setTranslationZ(translationZ);
            }
            if ((mPrivateFlags2 & PFLAG2_VIEW_QUICK_REJECTED) == PFLAG2_VIEW_QUICK_REJECTED) {
                // View was rejected last time it was drawn by its parent; this may have changed
                invalidateParentIfNeeded();
            }
        }
    }
    /**
     * Hit rectangle in parent's coordinates
     *
@@ -14173,6 +14205,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
                }
                displayList.setTransformationInfo(alpha,
                        mTransformationInfo.mTranslationX, mTransformationInfo.mTranslationY,
                        mTransformationInfo.mTranslationZ,
                        mTransformationInfo.mRotation, mTransformationInfo.mRotationX,
                        mTransformationInfo.mRotationY, mTransformationInfo.mScaleX,
                        mTransformationInfo.mScaleY);
+25 −2
Original line number Diff line number Diff line
@@ -144,9 +144,10 @@ public class ViewPropertyAnimator {
    private static final int X              = 0x0080;
    private static final int Y              = 0x0100;
    private static final int ALPHA          = 0x0200;
    private static final int TRANSLATION_Z  = 0x0400;

    private static final int TRANSFORM_MASK = TRANSLATION_X | TRANSLATION_Y | SCALE_X | SCALE_Y |
            ROTATION | ROTATION_X | ROTATION_Y | X | Y;
    private static final int TRANSFORM_MASK = TRANSLATION_X | TRANSLATION_Y | TRANSLATION_Z |
            SCALE_X | SCALE_Y | ROTATION | ROTATION_X | ROTATION_Y | X | Y;

    /**
     * The mechanism by which the user can request several properties that are then animated
@@ -572,6 +573,22 @@ public class ViewPropertyAnimator {
        return this;
    }

    /**
     * @hide
     */
    public ViewPropertyAnimator translationZ(float value) {
        animateProperty(TRANSLATION_Z, value);
        return this;
    }

    /**
     * @hide
     */
    public ViewPropertyAnimator translationZBy(float value) {
        animatePropertyBy(TRANSLATION_Z, value);
        return this;
    }

    /**
     * This method will cause the View's <code>translationY</code> property to be animated to the
     * specified value. Animations already running on the property will be canceled.
@@ -909,6 +926,10 @@ public class ViewPropertyAnimator {
                info.mTranslationY = value;
                if (displayList != null) displayList.setTranslationY(value);
                break;
            case TRANSLATION_Z:
                info.mTranslationZ = value;
                if (displayList != null) displayList.setTranslationZ(value);
                break;
            case ROTATION:
                info.mRotation = value;
                if (displayList != null) displayList.setRotation(value);
@@ -957,6 +978,8 @@ public class ViewPropertyAnimator {
                return info.mTranslationX;
            case TRANSLATION_Y:
                return info.mTranslationY;
            case TRANSLATION_Z:
                return info.mTranslationZ;
            case ROTATION:
                return info.mRotation;
            case ROTATION_X:
+10 −3
Original line number Diff line number Diff line
@@ -114,6 +114,11 @@ static void android_view_GLES20DisplayList_setTranslationY(JNIEnv* env,
    displayList->setTranslationY(ty);
}

static void android_view_GLES20DisplayList_setTranslationZ(JNIEnv* env,
        jobject clazz, DisplayList* displayList, float tz) {
    displayList->setTranslationZ(tz);
}

static void android_view_GLES20DisplayList_setRotation(JNIEnv* env,
        jobject clazz, DisplayList* displayList, float rotation) {
    displayList->setRotation(rotation);
@@ -141,11 +146,12 @@ static void android_view_GLES20DisplayList_setScaleY(JNIEnv* env,

static void android_view_GLES20DisplayList_setTransformationInfo(JNIEnv* env,
        jobject clazz, DisplayList* displayList, float alpha,
        float translationX, float translationY, float rotation, float rotationX, float rotationY,
        float scaleX, float scaleY) {
        float translationX, float translationY, float translationZ,
        float rotation, float rotationX, float rotationY, float scaleX, float scaleY) {
    displayList->setAlpha(alpha);
    displayList->setTranslationX(translationX);
    displayList->setTranslationY(translationY);
    displayList->setTranslationZ(translationZ);
    displayList->setRotation(rotation);
    displayList->setRotationX(rotationX);
    displayList->setRotationY(rotationY);
@@ -320,12 +326,13 @@ static JNINativeMethod gMethods[] = {
            (void*) android_view_GLES20DisplayList_setHasOverlappingRendering },
    { "nSetTranslationX",      "(IF)V",  (void*) android_view_GLES20DisplayList_setTranslationX },
    { "nSetTranslationY",      "(IF)V",  (void*) android_view_GLES20DisplayList_setTranslationY },
    { "nSetTranslationZ",      "(IF)V",  (void*) android_view_GLES20DisplayList_setTranslationZ },
    { "nSetRotation",          "(IF)V",  (void*) android_view_GLES20DisplayList_setRotation },
    { "nSetRotationX",         "(IF)V",  (void*) android_view_GLES20DisplayList_setRotationX },
    { "nSetRotationY",         "(IF)V",  (void*) android_view_GLES20DisplayList_setRotationY },
    { "nSetScaleX",            "(IF)V",  (void*) android_view_GLES20DisplayList_setScaleX },
    { "nSetScaleY",            "(IF)V",  (void*) android_view_GLES20DisplayList_setScaleY },
    { "nSetTransformationInfo","(IFFFFFFFF)V",
    { "nSetTransformationInfo","(IFFFFFFFFF)V",
            (void*) android_view_GLES20DisplayList_setTransformationInfo },
    { "nSetPivotX",            "(IF)V",  (void*) android_view_GLES20DisplayList_setPivotX },
    { "nSetPivotY",            "(IF)V",  (void*) android_view_GLES20DisplayList_setPivotY },
Loading