diff options
Diffstat (limited to 'libs/hwui/DamageAccumulator.cpp')
-rw-r--r-- | libs/hwui/DamageAccumulator.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/libs/hwui/DamageAccumulator.cpp b/libs/hwui/DamageAccumulator.cpp index 94fe243378b1..0adc0f64ee95 100644 --- a/libs/hwui/DamageAccumulator.cpp +++ b/libs/hwui/DamageAccumulator.cpp @@ -150,9 +150,19 @@ static inline void applyMatrix(const SkMatrix* transform, SkRect* rect) { } } +static inline void applyMatrix(const SkMatrix& transform, SkRect* rect) { + return applyMatrix(&transform, rect); +} + static inline void mapRect(const RenderProperties& props, const SkRect& in, SkRect* out) { if (in.isEmpty()) return; SkRect temp(in); + if (Properties::stretchEffectBehavior == StretchEffectBehavior::UniformScale) { + const StretchEffect& stretch = props.layerProperties().getStretchEffect(); + if (!stretch.isEmpty()) { + applyMatrix(stretch.makeLinearStretch(props.getWidth(), props.getHeight()), &temp); + } + } applyMatrix(props.getTransformMatrix(), &temp); if (props.getStaticMatrix()) { applyMatrix(props.getStaticMatrix(), &temp); @@ -272,18 +282,21 @@ void DamageAccumulator::finish(SkRect* totalDirty) { DamageAccumulator::StretchResult DamageAccumulator::findNearestStretchEffect() const { DirtyStack* frame = mHead; + const auto& headProperties = mHead->renderNode->properties(); + float startWidth = headProperties.getWidth(); + float startHeight = headProperties.getHeight(); while (frame->prev != frame) { if (frame->type == TransformRenderNode) { const auto& renderNode = frame->renderNode; const auto& frameRenderNodeProperties = renderNode->properties(); const auto& effect = frameRenderNodeProperties.layerProperties().getStretchEffect(); - const float width = (float) renderNode->getWidth(); - const float height = (float) renderNode->getHeight(); + const float width = (float) frameRenderNodeProperties.getWidth(); + const float height = (float) frameRenderNodeProperties.getHeight(); if (!effect.isEmpty()) { Matrix4 stretchMatrix; computeTransformImpl(mHead, frame, &stretchMatrix); - Rect stretchRect = Rect(0.f, 0.f, width, height); + Rect stretchRect = Rect(0.f, 0.f, startWidth, startHeight); stretchMatrix.mapRect(stretchRect); return StretchResult{ |