summaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2023-10-24 20:43:22 -0400
committerJohn Reck <jreck@google.com>2023-10-27 16:49:22 -0400
commit1b152e712159c0b82831a7567ce2f3c49cdc11bf (patch)
tree74c107d65ae11b92af840bcd985910ed7ec4dc42 /graphics
parent57cca107540d12c63b10ba326483b9acc4fa7b45 (diff)
downloadbase-1b152e712159c0b82831a7567ce2f3c49cdc11bf.tar.gz
Implement automatic SV clipping
Clip SV to its ancestor clipping bounds. This enables Z-above SurfaceView + scrolling containers to work more naturally Replaces the hidden API of setEnableSurfaceClipping Fixes: 298621623 Test: Sample app Change-Id: Iaa862598e37065677f5ba163a5ac7a6fab2739ea
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/graphics/RenderNode.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/graphics/java/android/graphics/RenderNode.java b/graphics/java/android/graphics/RenderNode.java
index 15d26ebe66f6..27325694073c 100644
--- a/graphics/java/android/graphics/RenderNode.java
+++ b/graphics/java/android/graphics/RenderNode.java
@@ -272,6 +272,17 @@ public final class RenderNode {
void positionChanged(long frameNumber, int left, int top, int right, int bottom);
/**
+ * Called by native by a Rendering Worker thread to update window position; includes
+ * the local rect that represents the clipped area of the RenderNode's bounds.
+ *
+ * @hide
+ */
+ default void positionChanged(long frameNumber, int left, int top, int right, int bottom,
+ int clipLeft, int clipTop, int clipRight, int clipBottom) {
+ positionChanged(frameNumber, left, top, right, bottom);
+ }
+
+ /**
* Called by JNI
*
* @hide */
@@ -287,6 +298,23 @@ public final class RenderNode {
}
/**
+ * Called by JNI
+ *
+ * @hide */
+ static boolean callPositionChanged2(WeakReference<PositionUpdateListener> weakListener,
+ long frameNumber, int left, int top, int right, int bottom,
+ int clipLeft, int clipTop, int clipRight, int clipBottom) {
+ final PositionUpdateListener listener = weakListener.get();
+ if (listener != null) {
+ listener.positionChanged(frameNumber, left, top, right, bottom, clipLeft,
+ clipTop, clipRight, clipBottom);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
* Call to apply a stretch effect to any child SurfaceControl layers
*
* TODO: Fold this into positionChanged & have HWUI do the ASurfaceControl calls?
@@ -371,6 +399,15 @@ public final class RenderNode {
}
@Override
+ public void positionChanged(long frameNumber, int left, int top, int right, int bottom,
+ int clipLeft, int clipTop, int clipRight, int clipBottom) {
+ for (PositionUpdateListener pul : mListeners) {
+ pul.positionChanged(frameNumber, left, top, right, bottom, clipLeft, clipTop,
+ clipRight, clipBottom);
+ }
+ }
+
+ @Override
public void positionLost(long frameNumber) {
for (PositionUpdateListener pul : mListeners) {
pul.positionLost(frameNumber);