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

Commit ea23c429 authored by Andrey Kulikov's avatar Andrey Kulikov Committed by Android (Google) Code Review
Browse files

Merge "Introduce View.getAnimationMatrix()"

parents a5916fb6 c15c9ca5
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -50355,6 +50355,7 @@ package android.view {
    method @IdRes public int getAccessibilityTraversalBefore();
    method @IdRes public int getAccessibilityTraversalBefore();
    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getAlpha();
    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getAlpha();
    method public android.view.animation.Animation getAnimation();
    method public android.view.animation.Animation getAnimation();
    method @Nullable public android.graphics.Matrix getAnimationMatrix();
    method public android.os.IBinder getApplicationWindowToken();
    method public android.os.IBinder getApplicationWindowToken();
    method @NonNull public int[] getAttributeResolutionStack(@AttrRes int);
    method @NonNull public int[] getAttributeResolutionStack(@AttrRes int);
    method @NonNull public java.util.Map<java.lang.Integer,java.lang.Integer> getAttributeSourceResourceMap();
    method @NonNull public java.util.Map<java.lang.Integer,java.lang.Integer> getAttributeSourceResourceMap();
+17 −0
Original line number Original line Diff line number Diff line
@@ -17197,6 +17197,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * and {@link #setTranslationY(float)} (float)}} instead.
     * and {@link #setTranslationY(float)} (float)}} instead.
     *
     *
     * @param matrix The matrix, null indicates that the matrix should be cleared.
     * @param matrix The matrix, null indicates that the matrix should be cleared.
     * @see #getAnimationMatrix()
     */
     */
    public void setAnimationMatrix(@Nullable Matrix matrix) {
    public void setAnimationMatrix(@Nullable Matrix matrix) {
        invalidateViewProperty(true, false);
        invalidateViewProperty(true, false);
@@ -17206,6 +17207,22 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        invalidateParentIfNeededAndWasQuickRejected();
        invalidateParentIfNeededAndWasQuickRejected();
    }
    }
    /**
     * Return the current transformation matrix of the view. This is used in animation frameworks,
     * such as {@link android.transition.Transition}. Returns <code>null</code> when there is no
     * transformation provided by {@link #setAnimationMatrix(Matrix)}.
     * Application developers should use transformation methods like {@link #setRotation(float)},
     * {@link #setScaleX(float)}, {@link #setScaleX(float)}, {@link #setTranslationX(float)}}
     * and {@link #setTranslationY(float)} (float)}} instead.
     *
     * @return the Matrix, null indicates there is no transformation
     * @see #setAnimationMatrix(Matrix)
     */
    @Nullable
    public Matrix getAnimationMatrix() {
        return mRenderNode.getAnimationMatrix();
    }
    /**
    /**
     * Returns the current StateListAnimator if exists.
     * Returns the current StateListAnimator if exists.
     *
     *
+14 −0
Original line number Original line Diff line number Diff line
@@ -338,6 +338,19 @@ static jboolean android_view_RenderNode_hasOverlappingRendering(jlong renderNode
    return renderNode->stagingProperties().hasOverlappingRendering();
    return renderNode->stagingProperties().hasOverlappingRendering();
}
}


static jboolean android_view_RenderNode_getAnimationMatrix(jlong renderNodePtr, jlong outMatrixPtr) {
    RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr);
    SkMatrix* outMatrix = reinterpret_cast<SkMatrix*>(outMatrixPtr);

    const SkMatrix* animationMatrix = renderNode->stagingProperties().getAnimationMatrix();

    if (animationMatrix) {
        *outMatrix = *animationMatrix;
        return JNI_TRUE;
    }
    return JNI_FALSE;
}

static jboolean android_view_RenderNode_getClipToBounds(jlong renderNodePtr) {
static jboolean android_view_RenderNode_getClipToBounds(jlong renderNodePtr) {
    RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr);
    RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr);
    return renderNode->stagingProperties().getClipToBounds();
    return renderNode->stagingProperties().getClipToBounds();
@@ -649,6 +662,7 @@ static const JNINativeMethod gMethods[] = {
    { "nSetLayerPaint",        "(JJ)Z",  (void*) android_view_RenderNode_setLayerPaint },
    { "nSetLayerPaint",        "(JJ)Z",  (void*) android_view_RenderNode_setLayerPaint },
    { "nSetStaticMatrix",      "(JJ)Z",  (void*) android_view_RenderNode_setStaticMatrix },
    { "nSetStaticMatrix",      "(JJ)Z",  (void*) android_view_RenderNode_setStaticMatrix },
    { "nSetAnimationMatrix",   "(JJ)Z",  (void*) android_view_RenderNode_setAnimationMatrix },
    { "nSetAnimationMatrix",   "(JJ)Z",  (void*) android_view_RenderNode_setAnimationMatrix },
    { "nGetAnimationMatrix",   "(JJ)Z",  (void*) android_view_RenderNode_getAnimationMatrix },
    { "nSetClipToBounds",      "(JZ)Z",  (void*) android_view_RenderNode_setClipToBounds },
    { "nSetClipToBounds",      "(JZ)Z",  (void*) android_view_RenderNode_setClipToBounds },
    { "nGetClipToBounds",      "(J)Z",   (void*) android_view_RenderNode_getClipToBounds },
    { "nGetClipToBounds",      "(J)Z",   (void*) android_view_RenderNode_getClipToBounds },
    { "nSetClipBounds",        "(JIIII)Z", (void*) android_view_RenderNode_setClipBounds },
    { "nSetClipBounds",        "(JIIII)Z", (void*) android_view_RenderNode_setClipBounds },
+27 −1
Original line number Original line Diff line number Diff line
@@ -808,13 +808,36 @@ public final class RenderNode {
     * for the matrix parameter.
     * for the matrix parameter.
     *
     *
     * @param matrix The matrix, null indicates that the matrix should be cleared.
     * @param matrix The matrix, null indicates that the matrix should be cleared.
     * @see #getAnimationMatrix()
     *
     * @hide TODO Do we want this?
     * @hide TODO Do we want this?
     */
     */
    public boolean setAnimationMatrix(Matrix matrix) {
    public boolean setAnimationMatrix(@Nullable Matrix matrix) {
        return nSetAnimationMatrix(mNativeRenderNode,
        return nSetAnimationMatrix(mNativeRenderNode,
                (matrix != null) ? matrix.native_instance : 0);
                (matrix != null) ? matrix.native_instance : 0);
    }
    }


    /**
     * Returns the previously set Animation matrix. This matrix exists if an Animation is
     * currently playing on a View, and is set on the display list during at draw() time.
     * Returns <code>null</code> when there is no transformation provided by
     * {@link #setAnimationMatrix(Matrix)}.
     *
     * @return the current Animation matrix.
     * @see #setAnimationMatrix(Matrix)
     *
     * @hide
     */
    @Nullable
    public Matrix getAnimationMatrix() {
        Matrix output = new Matrix();
        if (nGetAnimationMatrix(mNativeRenderNode, output.native_instance)) {
            return output;
        } else {
            return null;
        }
    }

    /**
    /**
     * Sets the translucency level for the display list.
     * Sets the translucency level for the display list.
     *
     *
@@ -1659,6 +1682,9 @@ public final class RenderNode {
    @CriticalNative
    @CriticalNative
    private static native boolean nHasOverlappingRendering(long renderNode);
    private static native boolean nHasOverlappingRendering(long renderNode);


    @CriticalNative
    private static native boolean nGetAnimationMatrix(long renderNode, long animationMatrix);

    @CriticalNative
    @CriticalNative
    private static native boolean nGetClipToOutline(long renderNode);
    private static native boolean nGetClipToOutline(long renderNode);