Updated EdgeEffect parameters for overscroll stretch
Added dampening logic to caluclate the distance to
overscroll.
Updated StretchEffect to support independent
maximum stretch amounts for the x/y axis
Removed debugging parameters to configure
stretch distance since they are no longer
used. Removed hidden API calls to configure
stretch distance in ScrollView/HorizontalScrollView
Bug: 179047472
Test: re-ran EdgeEffectTests
Change-Id: I4698669273d364695a21c2cce00ec2cfec41b2cc
diff --git a/libs/hwui/effects/StretchEffect.h b/libs/hwui/effects/StretchEffect.h
index d2da06b..8221b41 100644
--- a/libs/hwui/effects/StretchEffect.h
+++ b/libs/hwui/effects/StretchEffect.h
@@ -33,8 +33,12 @@
SmoothStep,
};
- StretchEffect(const SkRect& area, const SkVector& direction, float maxStretchAmount)
- : stretchArea(area), maxStretchAmount(maxStretchAmount), mStretchDirection(direction) {}
+ StretchEffect(const SkRect& area, const SkVector& direction, float maxStretchAmountX,
+ float maxStretchAmountY)
+ : stretchArea(area)
+ , maxStretchAmountX(maxStretchAmountX)
+ , maxStretchAmountY(maxStretchAmountY)
+ , mStretchDirection(direction) {}
StretchEffect() {}
@@ -50,7 +54,8 @@
this->stretchArea = other.stretchArea;
this->mStretchDirection = other.mStretchDirection;
this->mStretchFilter = nullptr;
- this->maxStretchAmount = other.maxStretchAmount;
+ this->maxStretchAmountX = other.maxStretchAmountX;
+ this->maxStretchAmountY = other.maxStretchAmountY;
return *this;
}
@@ -67,13 +72,15 @@
return setEmpty();
}
stretchArea.join(other.stretchArea);
- maxStretchAmount = std::max(maxStretchAmount, other.maxStretchAmount);
+ maxStretchAmountX = std::max(maxStretchAmountX, other.maxStretchAmountX);
+ maxStretchAmountY = std::max(maxStretchAmountY, other.maxStretchAmountY);
}
sk_sp<SkImageFilter> getImageFilter(const sk_sp<SkImage>& snapshotImage) const;
SkRect stretchArea {0, 0, 0, 0};
- float maxStretchAmount = 0;
+ float maxStretchAmountX = 0;
+ float maxStretchAmountY = 0;
void setStretchDirection(const SkVector& direction) {
mStretchFilter = nullptr;