summaryrefslogtreecommitdiff
path: root/graphics/java/android
diff options
context:
space:
mode:
author John Reck <jreck@google.com> 2021-02-08 19:22:59 -0500
committer John Reck <jreck@google.com> 2021-02-17 15:44:50 -0500
commit5d53a7540a089a0397c9fb687bbccc7127a65698 (patch)
tree9ed3d1dbedf90700c86ec71e80cf9866928b1c59 /graphics/java/android
parent02e5c21052334fe2b78c936e6c355c826ec8903d (diff)
Wire up SurfaceView stretch effect
Bug: 179047472 Test: StretchySurfaceViewActivity Change-Id: I7f3d582cc66fb732a557e9332edc6d186db2335c
Diffstat (limited to 'graphics/java/android')
-rw-r--r--graphics/java/android/graphics/RenderNode.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/graphics/java/android/graphics/RenderNode.java b/graphics/java/android/graphics/RenderNode.java
index 4a92cf11fa5c..f6f770be3de8 100644
--- a/graphics/java/android/graphics/RenderNode.java
+++ b/graphics/java/android/graphics/RenderNode.java
@@ -272,6 +272,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.
*
@@ -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);
+ }
+ }
}
/**
@@ -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());