diff options
Diffstat (limited to 'libs/hwui/pipeline/skia/RenderNodeDrawable.cpp')
-rw-r--r-- | libs/hwui/pipeline/skia/RenderNodeDrawable.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp b/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp index 1ae06d082744..509884e23c26 100644 --- a/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp +++ b/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp @@ -171,11 +171,16 @@ void RenderNodeDrawable::forceDraw(SkCanvas* canvas) const { displayList->mProjectedOutline = nullptr; } +static bool stretchNeedsLayer(const LayerProperties& properties) { + return Properties::stretchEffectBehavior == StretchEffectBehavior::Shader && + !properties.getStretchEffect().isEmpty(); +} + static bool layerNeedsPaint(const sk_sp<SkImage>& snapshotImage, const LayerProperties& properties, float alphaMultiplier, SkPaint* paint) { if (alphaMultiplier < 1.0f || properties.alpha() < 255 || properties.xferMode() != SkBlendMode::kSrcOver || properties.getColorFilter() != nullptr || - properties.getImageFilter() != nullptr || !properties.getStretchEffect().isEmpty()) { + properties.getImageFilter() != nullptr || stretchNeedsLayer(properties)) { paint->setAlpha(properties.alpha() * alphaMultiplier); paint->setBlendMode(properties.xferMode()); paint->setColorFilter(sk_ref_sp(properties.getColorFilter())); @@ -247,7 +252,8 @@ void RenderNodeDrawable::drawContent(SkCanvas* canvas) const { } const StretchEffect& stretch = properties.layerProperties().getStretchEffect(); - if (stretch.isEmpty()) { + if (stretch.isEmpty() || + Properties::stretchEffectBehavior != StretchEffectBehavior::Shader) { // 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 @@ -326,6 +332,13 @@ void RenderNodeDrawable::setViewProperties(const RenderProperties& properties, S canvas->concat(*properties.getTransformMatrix()); } } + if (Properties::stretchEffectBehavior == StretchEffectBehavior::LinearScale) { + const StretchEffect& stretch = properties.layerProperties().getStretchEffect(); + if (!stretch.isEmpty()) { + canvas->concat( + stretch.makeLinearStretch(properties.getWidth(), properties.getHeight())); + } + } const bool isLayer = properties.effectiveLayerType() != LayerType::None; int clipFlags = properties.getClippingFlags(); if (properties.getAlpha() < 1) { |