Add plumbing for sending stretch effect to SF
Bug: 179047472
Test: builds & boots, doesn't do anything yet
Change-Id: Ib8cccdde518f0591c2f2ee3416684442f37a1e06
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp
index fff3305..f053372 100644
--- a/libs/gui/LayerState.cpp
+++ b/libs/gui/LayerState.cpp
@@ -167,6 +167,9 @@
SAFE_PARCEL(output.writeInt32, region.right);
SAFE_PARCEL(output.writeInt32, region.bottom);
}
+
+ SAFE_PARCEL(output.write, stretchEffect);
+
return NO_ERROR;
}
@@ -290,6 +293,9 @@
SAFE_PARCEL(input.readInt32, ®ion.bottom);
blurRegions.push_back(region);
}
+
+ SAFE_PARCEL(input.read, stretchEffect);
+
return NO_ERROR;
}
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index 550803d..73807c4 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -1569,6 +1569,23 @@
return *this;
}
+SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setStretchEffect(
+ const sp<SurfaceControl>& sc, float left, float top, float right, float bottom, float vecX,
+ float vecY, float maxAmount) {
+ layer_state_t* s = getLayerState(sc);
+ if (!s) {
+ mStatus = BAD_INDEX;
+ return *this;
+ }
+
+ s->what |= layer_state_t::eStretchChanged;
+ s->stretchEffect = StretchEffect{.area = {left, top, right, bottom},
+ .vectorX = vecX,
+ .vectorY = vecY,
+ .maxAmount = maxAmount};
+ return *this;
+}
+
// ---------------------------------------------------------------------------
DisplayState& SurfaceComposerClient::Transaction::getDisplayState(const sp<IBinder>& token) {
diff --git a/libs/gui/include/gui/LayerState.h b/libs/gui/include/gui/LayerState.h
index 2f9a0c0..b273805 100644
--- a/libs/gui/include/gui/LayerState.h
+++ b/libs/gui/include/gui/LayerState.h
@@ -56,6 +56,7 @@
#include <ui/Rect.h>
#include <ui/Region.h>
#include <ui/Rotation.h>
+#include <ui/StretchEffect.h>
#include <ui/Transform.h>
#include <utils/Errors.h>
@@ -135,6 +136,7 @@
eFrameTimelineInfoChanged = 0x800'00000000,
eBlurRegionsChanged = 0x1000'00000000,
eAutoRefreshChanged = 0x2000'00000000,
+ eStretchChanged = 0x4000'00000000,
};
layer_state_t();
@@ -244,6 +246,9 @@
// can and not wait for a frame to become available. This is only relevant
// in shared buffer mode.
bool autoRefresh;
+
+ // Stretch effect to be applied to this layer
+ StretchEffect stretchEffect;
};
struct ComposerState {
diff --git a/libs/gui/include/gui/SurfaceComposerClient.h b/libs/gui/include/gui/SurfaceComposerClient.h
index e7abfe6..61c0ab6 100644
--- a/libs/gui/include/gui/SurfaceComposerClient.h
+++ b/libs/gui/include/gui/SurfaceComposerClient.h
@@ -551,6 +551,10 @@
// transactions from blocking each other.
Transaction& setApplyToken(const sp<IBinder>& token);
+ Transaction& setStretchEffect(const sp<SurfaceControl>& sc, float left, float top,
+ float right, float bottom, float vecX, float vecY,
+ float maxAmount);
+
status_t setDisplaySurface(const sp<IBinder>& token,
const sp<IGraphicBufferProducer>& bufferProducer);