Loading core/java/android/view/SurfaceControl.java +14 −0 Original line number Diff line number Diff line Loading @@ -142,6 +142,9 @@ public final class SurfaceControl implements Parcelable { int layerStack); private static native void nativeSetBlurRegions(long transactionObj, long nativeObj, float[][] regions, int length); private static native void nativeSetStretchEffect(long transactionObj, long nativeObj, float left, float top, float right, float bottom, float vecX, float vecY, float maxStretchAmount); private static native boolean nativeClearContentFrameStats(long nativeObject); private static native boolean nativeGetContentFrameStats(long nativeObject, WindowContentFrameStats outStats); Loading Loading @@ -2970,6 +2973,17 @@ public final class SurfaceControl implements Parcelable { return this; } /** * @hide */ public Transaction setStretchEffect(SurfaceControl sc, float left, float top, float right, float bottom, float vecX, float vecY, float maxStretchAmount) { checkPreconditions(sc); nativeSetStretchEffect(mNativeObject, sc.mNativeObject, left, top, right, bottom, vecX, vecY, maxStretchAmount); return this; } /** * @hide */ Loading core/java/android/view/SurfaceView.java +8 −0 Original line number Diff line number Diff line Loading @@ -1443,6 +1443,14 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall } } @Override public void applyStretch(long frameNumber, float left, float top, float right, float bottom, float vecX, float vecY, float maxStretch) { mRtTransaction.setStretchEffect(mSurfaceControl, left, top, right, bottom, vecX, vecY, maxStretch); applyRtTransaction(frameNumber); } @Override public void positionLost(long frameNumber) { if (DEBUG) { Loading core/jni/android_view_SurfaceControl.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -593,6 +593,15 @@ static void nativeSetBlurRegions(JNIEnv* env, jclass clazz, jlong transactionObj transaction->setBlurRegions(ctrl, blurRegionVector); } static void nativeSetStretchEffect(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject, jfloat left, jfloat top, jfloat right, jfloat bottom, jfloat vecX, jfloat vecY, jfloat maxStretchAmount) { auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj); SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl*>(nativeObject); transaction->setStretchEffect(ctrl, left, top, right, bottom, vecX, vecY, maxStretchAmount); } static void nativeSetSize(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject, jint w, jint h) { auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj); Loading Loading @@ -1769,6 +1778,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = { (void*)nativeSetLayerStack }, {"nativeSetBlurRegions", "(JJ[[FI)V", (void*)nativeSetBlurRegions }, {"nativeSetStretchEffect", "(JJFFFFFFF)V", (void*) nativeSetStretchEffect }, {"nativeSetShadowRadius", "(JJF)V", (void*)nativeSetShadowRadius }, {"nativeSetFrameRate", "(JJFIZ)V", Loading graphics/java/android/graphics/RenderNode.java +19 −1 Original line number Diff line number Diff line Loading @@ -271,6 +271,16 @@ public final class RenderNode { */ void positionChanged(long frameNumber, int left, int top, int right, int bottom); /** * Call to apply a stretch effect to any child SurfaceControl layers * * TODO: Fold this into positionChanged & have HWUI do the ASurfaceControl calls? * * @hide */ default void applyStretch(long frameNumber, float left, float top, float right, float bottom, float vecX, float vecY, float maxStretch) { } /** * Called by native on RenderThread to notify that the view is no longer in the * draw tree. UI thread is blocked at this point. Loading Loading @@ -312,6 +322,14 @@ public final class RenderNode { pul.positionLost(frameNumber); } } @Override public void applyStretch(long frameNumber, float left, float top, float right, float bottom, float vecX, float vecY, float maxStretch) { for (PositionUpdateListener pul : mListeners) { pul.applyStretch(frameNumber, left, top, right, bottom, vecX, vecY, maxStretch); } } } /** Loading Loading @@ -707,7 +725,7 @@ public final class RenderNode { if (1.0 < vecY || vecY < -1.0) { throw new IllegalArgumentException("vecY must be in the range [-1, 1], was " + vecY); } if (top <= bottom || right <= left) { if (top >= bottom || left >= right) { throw new IllegalArgumentException( "Stretch region must not be empty, got " + new RectF(left, top, right, bottom).toString()); Loading libs/hwui/DamageAccumulator.cpp +15 −0 Original line number Diff line number Diff line Loading @@ -249,5 +249,20 @@ void DamageAccumulator::finish(SkRect* totalDirty) { mHead->pendingDirty.setEmpty(); } const StretchEffect* DamageAccumulator::findNearestStretchEffect() const { DirtyStack* frame = mHead; while (frame->prev != frame) { frame = frame->prev; if (frame->type == TransformRenderNode) { const auto& effect = frame->renderNode->properties().layerProperties().getStretchEffect(); if (!effect.isEmpty()) { return &effect; } } } return nullptr; } } /* namespace uirenderer */ } /* namespace android */ Loading
core/java/android/view/SurfaceControl.java +14 −0 Original line number Diff line number Diff line Loading @@ -142,6 +142,9 @@ public final class SurfaceControl implements Parcelable { int layerStack); private static native void nativeSetBlurRegions(long transactionObj, long nativeObj, float[][] regions, int length); private static native void nativeSetStretchEffect(long transactionObj, long nativeObj, float left, float top, float right, float bottom, float vecX, float vecY, float maxStretchAmount); private static native boolean nativeClearContentFrameStats(long nativeObject); private static native boolean nativeGetContentFrameStats(long nativeObject, WindowContentFrameStats outStats); Loading Loading @@ -2970,6 +2973,17 @@ public final class SurfaceControl implements Parcelable { return this; } /** * @hide */ public Transaction setStretchEffect(SurfaceControl sc, float left, float top, float right, float bottom, float vecX, float vecY, float maxStretchAmount) { checkPreconditions(sc); nativeSetStretchEffect(mNativeObject, sc.mNativeObject, left, top, right, bottom, vecX, vecY, maxStretchAmount); return this; } /** * @hide */ Loading
core/java/android/view/SurfaceView.java +8 −0 Original line number Diff line number Diff line Loading @@ -1443,6 +1443,14 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall } } @Override public void applyStretch(long frameNumber, float left, float top, float right, float bottom, float vecX, float vecY, float maxStretch) { mRtTransaction.setStretchEffect(mSurfaceControl, left, top, right, bottom, vecX, vecY, maxStretch); applyRtTransaction(frameNumber); } @Override public void positionLost(long frameNumber) { if (DEBUG) { Loading
core/jni/android_view_SurfaceControl.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -593,6 +593,15 @@ static void nativeSetBlurRegions(JNIEnv* env, jclass clazz, jlong transactionObj transaction->setBlurRegions(ctrl, blurRegionVector); } static void nativeSetStretchEffect(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject, jfloat left, jfloat top, jfloat right, jfloat bottom, jfloat vecX, jfloat vecY, jfloat maxStretchAmount) { auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj); SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl*>(nativeObject); transaction->setStretchEffect(ctrl, left, top, right, bottom, vecX, vecY, maxStretchAmount); } static void nativeSetSize(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject, jint w, jint h) { auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj); Loading Loading @@ -1769,6 +1778,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = { (void*)nativeSetLayerStack }, {"nativeSetBlurRegions", "(JJ[[FI)V", (void*)nativeSetBlurRegions }, {"nativeSetStretchEffect", "(JJFFFFFFF)V", (void*) nativeSetStretchEffect }, {"nativeSetShadowRadius", "(JJF)V", (void*)nativeSetShadowRadius }, {"nativeSetFrameRate", "(JJFIZ)V", Loading
graphics/java/android/graphics/RenderNode.java +19 −1 Original line number Diff line number Diff line Loading @@ -271,6 +271,16 @@ public final class RenderNode { */ void positionChanged(long frameNumber, int left, int top, int right, int bottom); /** * Call to apply a stretch effect to any child SurfaceControl layers * * TODO: Fold this into positionChanged & have HWUI do the ASurfaceControl calls? * * @hide */ default void applyStretch(long frameNumber, float left, float top, float right, float bottom, float vecX, float vecY, float maxStretch) { } /** * Called by native on RenderThread to notify that the view is no longer in the * draw tree. UI thread is blocked at this point. Loading Loading @@ -312,6 +322,14 @@ public final class RenderNode { pul.positionLost(frameNumber); } } @Override public void applyStretch(long frameNumber, float left, float top, float right, float bottom, float vecX, float vecY, float maxStretch) { for (PositionUpdateListener pul : mListeners) { pul.applyStretch(frameNumber, left, top, right, bottom, vecX, vecY, maxStretch); } } } /** Loading Loading @@ -707,7 +725,7 @@ public final class RenderNode { if (1.0 < vecY || vecY < -1.0) { throw new IllegalArgumentException("vecY must be in the range [-1, 1], was " + vecY); } if (top <= bottom || right <= left) { if (top >= bottom || left >= right) { throw new IllegalArgumentException( "Stretch region must not be empty, got " + new RectF(left, top, right, bottom).toString()); Loading
libs/hwui/DamageAccumulator.cpp +15 −0 Original line number Diff line number Diff line Loading @@ -249,5 +249,20 @@ void DamageAccumulator::finish(SkRect* totalDirty) { mHead->pendingDirty.setEmpty(); } const StretchEffect* DamageAccumulator::findNearestStretchEffect() const { DirtyStack* frame = mHead; while (frame->prev != frame) { frame = frame->prev; if (frame->type == TransformRenderNode) { const auto& effect = frame->renderNode->properties().layerProperties().getStretchEffect(); if (!effect.isEmpty()) { return &effect; } } } return nullptr; } } /* namespace uirenderer */ } /* namespace android */