summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/hwui/DamageAccumulator.cpp2
-rw-r--r--libs/hwui/Properties.cpp2
-rw-r--r--libs/hwui/Properties.h6
-rw-r--r--libs/hwui/RenderNode.cpp2
-rw-r--r--libs/hwui/effects/StretchEffect.h2
-rw-r--r--libs/hwui/jni/android_graphics_RenderNode.cpp4
-rw-r--r--libs/hwui/pipeline/skia/RenderNodeDrawable.cpp4
-rw-r--r--libs/hwui/tests/common/scenes/StretchyListViewAnimation.cpp58
8 files changed, 55 insertions, 25 deletions
diff --git a/libs/hwui/DamageAccumulator.cpp b/libs/hwui/DamageAccumulator.cpp
index a1642339190a..0adc0f64ee95 100644
--- a/libs/hwui/DamageAccumulator.cpp
+++ b/libs/hwui/DamageAccumulator.cpp
@@ -157,7 +157,7 @@ static inline void applyMatrix(const SkMatrix& transform, SkRect* rect) {
static inline void mapRect(const RenderProperties& props, const SkRect& in, SkRect* out) {
if (in.isEmpty()) return;
SkRect temp(in);
- if (Properties::stretchEffectBehavior == StretchEffectBehavior::LinearScale) {
+ if (Properties::stretchEffectBehavior == StretchEffectBehavior::UniformScale) {
const StretchEffect& stretch = props.layerProperties().getStretchEffect();
if (!stretch.isEmpty()) {
applyMatrix(stretch.makeLinearStretch(props.getWidth(), props.getHeight()), &temp);
diff --git a/libs/hwui/Properties.cpp b/libs/hwui/Properties.cpp
index 9ed801baf5ea..a4614a9076c8 100644
--- a/libs/hwui/Properties.cpp
+++ b/libs/hwui/Properties.cpp
@@ -138,7 +138,7 @@ bool Properties::load() {
if (targetCpuTimePercentage <= 0 || targetCpuTimePercentage > 100) targetCpuTimePercentage = 70;
int stretchType = base::GetIntProperty(PROPERTY_STRETCH_EFFECT_TYPE, 0);
- stretchType = std::clamp(stretchType, 0, static_cast<int>(StretchEffectBehavior::LinearScale));
+ stretchType = std::clamp(stretchType, 0, static_cast<int>(StretchEffectBehavior::UniformScale));
stretchEffectBehavior = static_cast<StretchEffectBehavior>(stretchType);
return (prevDebugLayersUpdates != debugLayersUpdates) || (prevDebugOverdraw != debugOverdraw);
diff --git a/libs/hwui/Properties.h b/libs/hwui/Properties.h
index 9d2b6173021d..9964254581df 100644
--- a/libs/hwui/Properties.h
+++ b/libs/hwui/Properties.h
@@ -200,9 +200,9 @@ enum class OverdrawColorSet { Default = 0, Deuteranomaly };
enum class RenderPipelineType { SkiaGL, SkiaVulkan, NotInitialized = 128 };
enum class StretchEffectBehavior {
- ShaderHWUI, // Stretch shader in HWUI only, matrix scale in SF
- Shader, // Stretch shader in both HWUI and SF
- LinearScale // Linear stretch everywhere
+ ShaderHWUI, // Stretch shader in HWUI only, matrix scale in SF
+ Shader, // Stretch shader in both HWUI and SF
+ UniformScale // Uniform scale stretch everywhere
};
/**
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp
index 64abd9428528..ad2cd8c4508f 100644
--- a/libs/hwui/RenderNode.cpp
+++ b/libs/hwui/RenderNode.cpp
@@ -478,7 +478,7 @@ void RenderNode::applyViewPropertyTransforms(mat4& matrix, bool true3dTransform)
}
}
- if (Properties::stretchEffectBehavior == StretchEffectBehavior::LinearScale) {
+ if (Properties::stretchEffectBehavior == StretchEffectBehavior::UniformScale) {
const StretchEffect& stretch = properties().layerProperties().getStretchEffect();
if (!stretch.isEmpty()) {
matrix.multiply(
diff --git a/libs/hwui/effects/StretchEffect.h b/libs/hwui/effects/StretchEffect.h
index 3b3067d2717f..0e1a654e8c9a 100644
--- a/libs/hwui/effects/StretchEffect.h
+++ b/libs/hwui/effects/StretchEffect.h
@@ -111,7 +111,7 @@ public:
bool requiresLayer() const {
return !(isEmpty() ||
- Properties::stretchEffectBehavior == StretchEffectBehavior::LinearScale);
+ Properties::stretchEffectBehavior == StretchEffectBehavior::UniformScale);
}
private:
diff --git a/libs/hwui/jni/android_graphics_RenderNode.cpp b/libs/hwui/jni/android_graphics_RenderNode.cpp
index cd0783f75106..a096ed0c63bb 100644
--- a/libs/hwui/jni/android_graphics_RenderNode.cpp
+++ b/libs/hwui/jni/android_graphics_RenderNode.cpp
@@ -573,8 +573,8 @@ static void android_view_RenderNode_requestPositionUpdates(JNIEnv* env, jobject,
const RenderProperties& props = node.properties();
uirenderer::Rect bounds(props.getWidth(), props.getHeight());
- bool useStretchShader = Properties::stretchEffectBehavior !=
- StretchEffectBehavior::LinearScale;
+ bool useStretchShader =
+ Properties::stretchEffectBehavior != StretchEffectBehavior::UniformScale;
if (useStretchShader && info.stretchEffectCount) {
handleStretchEffect(info, bounds);
}
diff --git a/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp b/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp
index 0b43f0923434..1c5515c7deee 100644
--- a/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp
+++ b/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp
@@ -248,7 +248,7 @@ void RenderNodeDrawable::drawContent(SkCanvas* canvas) const {
const StretchEffect& stretch = properties.layerProperties().getStretchEffect();
if (stretch.isEmpty() ||
- Properties::stretchEffectBehavior == StretchEffectBehavior::LinearScale) {
+ Properties::stretchEffectBehavior == StretchEffectBehavior::UniformScale) {
// If we don't have any stretch effects, issue the filtered
// canvas draw calls to make sure we still punch a hole
// with the same canvas transformation + clip into the target
@@ -327,7 +327,7 @@ void RenderNodeDrawable::setViewProperties(const RenderProperties& properties, S
canvas->concat(*properties.getTransformMatrix());
}
}
- if (Properties::stretchEffectBehavior == StretchEffectBehavior::LinearScale) {
+ if (Properties::stretchEffectBehavior == StretchEffectBehavior::UniformScale) {
const StretchEffect& stretch = properties.layerProperties().getStretchEffect();
if (!stretch.isEmpty()) {
canvas->concat(
diff --git a/libs/hwui/tests/common/scenes/StretchyListViewAnimation.cpp b/libs/hwui/tests/common/scenes/StretchyListViewAnimation.cpp
index 964b8bfb6fb1..c45111274396 100644
--- a/libs/hwui/tests/common/scenes/StretchyListViewAnimation.cpp
+++ b/libs/hwui/tests/common/scenes/StretchyListViewAnimation.cpp
@@ -22,8 +22,10 @@
class StretchyListViewAnimation;
class StretchyListViewHolePunch;
-class StretchyLinearListView;
-class StretchyLinearListViewHolePunch;
+class StretchyUniformListView;
+class StretchyUniformListViewHolePunch;
+class StretchyUniformLayerListView;
+class StretchyUniformLayerListViewHolePunch;
static TestScene::Registrar _StretchyListViewAnimation(TestScene::Info{
"stretchylistview",
@@ -36,21 +38,34 @@ static TestScene::Registrar _StretchyListViewHolePunch(TestScene::Info{
"A mock ListView of scrolling content that's stretching. Includes a hole punch",
TestScene::simpleCreateScene<StretchyListViewHolePunch>});
-static TestScene::Registrar _StretchyLinearListView(TestScene::Info{
- "stretchylistview_linear",
- "A mock ListView of scrolling content that's stretching using a linear stretch effect.",
- TestScene::simpleCreateScene<StretchyLinearListView>});
+static TestScene::Registrar _StretchyUniformListView(TestScene::Info{
+ "stretchylistview_uniform",
+ "A mock ListView of scrolling content that's stretching using a uniform stretch effect.",
+ TestScene::simpleCreateScene<StretchyUniformListView>});
-static TestScene::Registrar _StretchyLinearListViewHolePunch(TestScene::Info{
- "stretchylistview_linear_holepunch",
- "A mock ListView of scrolling content that's stretching using a linear stretch effect. "
+static TestScene::Registrar _StretchyUniformListViewHolePunch(TestScene::Info{
+ "stretchylistview_uniform_holepunch",
+ "A mock ListView of scrolling content that's stretching using a uniform stretch effect. "
"Includes a hole punch",
- TestScene::simpleCreateScene<StretchyLinearListViewHolePunch>});
+ TestScene::simpleCreateScene<StretchyUniformListViewHolePunch>});
+
+static TestScene::Registrar _StretchyUniformLayerListView(TestScene::Info{
+ "stretchylistview_uniform_layer",
+ "A mock ListView of scrolling content that's stretching using a uniform stretch effect. "
+ "Uses a layer",
+ TestScene::simpleCreateScene<StretchyUniformLayerListView>});
+
+static TestScene::Registrar _StretchyUniformLayerListViewHolePunch(TestScene::Info{
+ "stretchylistview_uniform_layer_holepunch",
+ "A mock ListView of scrolling content that's stretching using a uniform stretch effect. "
+ "Uses a layer & includes a hole punch",
+ TestScene::simpleCreateScene<StretchyUniformLayerListViewHolePunch>});
class StretchyListViewAnimation : public TestScene {
protected:
virtual StretchEffectBehavior stretchBehavior() { return StretchEffectBehavior::Shader; }
virtual bool haveHolePunch() { return false; }
+ virtual bool forceLayer() { return false; }
private:
int mItemHeight;
@@ -172,6 +187,10 @@ private:
void doFrame(int frameNr) override {
if (frameNr == 0) {
Properties::stretchEffectBehavior = stretchBehavior();
+ if (forceLayer()) {
+ mListView->mutateStagingProperties().mutateLayerProperties().setType(
+ LayerType::RenderLayer);
+ }
}
auto& props = mListView->mutateStagingProperties();
auto& stretch = props.mutateLayerProperties().mutableStretchEffect();
@@ -190,11 +209,22 @@ class StretchyListViewHolePunch : public StretchyListViewAnimation {
bool haveHolePunch() override { return true; }
};
-class StretchyLinearListView : public StretchyListViewAnimation {
- StretchEffectBehavior stretchBehavior() override { return StretchEffectBehavior::LinearScale; }
+class StretchyUniformListView : public StretchyListViewAnimation {
+ StretchEffectBehavior stretchBehavior() override { return StretchEffectBehavior::UniformScale; }
+};
+
+class StretchyUniformListViewHolePunch : public StretchyListViewAnimation {
+ StretchEffectBehavior stretchBehavior() override { return StretchEffectBehavior::UniformScale; }
+ bool haveHolePunch() override { return true; }
+};
+
+class StretchyUniformLayerListView : public StretchyListViewAnimation {
+ StretchEffectBehavior stretchBehavior() override { return StretchEffectBehavior::UniformScale; }
+ bool forceLayer() override { return true; }
};
-class StretchyLinearListViewHolePunch : public StretchyListViewAnimation {
- StretchEffectBehavior stretchBehavior() override { return StretchEffectBehavior::LinearScale; }
+class StretchyUniformLayerListViewHolePunch : public StretchyListViewAnimation {
+ StretchEffectBehavior stretchBehavior() override { return StretchEffectBehavior::UniformScale; }
bool haveHolePunch() override { return true; }
+ bool forceLayer() override { return true; }
}; \ No newline at end of file