Loading libs/hwui/DamageAccumulator.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -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::LinearScale) { 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); Loading libs/hwui/Properties.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,8 @@ float Properties::defaultSdrWhitePoint = 200.f; bool Properties::useHintManager = true; int Properties::targetCpuTimePercentage = 70; StretchEffectBehavior Properties::stretchEffectBehavior = StretchEffectBehavior::Shader; bool Properties::load() { bool prevDebugLayersUpdates = debugLayersUpdates; bool prevDebugOverdraw = debugOverdraw; Loading Loading @@ -135,6 +137,10 @@ bool Properties::load() { targetCpuTimePercentage = base::GetIntProperty(PROPERTY_TARGET_CPU_TIME_PERCENTAGE, 70); 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)); stretchEffectBehavior = static_cast<StretchEffectBehavior>(stretchType); return (prevDebugLayersUpdates != debugLayersUpdates) || (prevDebugOverdraw != debugOverdraw); } Loading libs/hwui/Properties.h +9 −0 Original line number Diff line number Diff line Loading @@ -171,6 +171,8 @@ enum DebugLevel { */ #define PROPERTY_TARGET_CPU_TIME_PERCENTAGE "debug.hwui.target_cpu_time_percent" #define PROPERTY_STRETCH_EFFECT_TYPE "debug.hwui.stretch_mode" /** * Property for whether this is running in the emulator. */ Loading @@ -197,6 +199,11 @@ enum class OverdrawColorSet { Default = 0, Deuteranomaly }; enum class RenderPipelineType { SkiaGL, SkiaVulkan, NotInitialized = 128 }; enum class StretchEffectBehavior { Shader, LinearScale, }; /** * Renderthread-only singleton which manages several static rendering properties. Most of these * are driven by system properties which are queried once at initialization, and again if init() Loading Loading @@ -270,6 +277,8 @@ public: static bool useHintManager; static int targetCpuTimePercentage; static StretchEffectBehavior stretchEffectBehavior; private: static ProfileType sProfileType; static bool sDisableProfileBars; Loading libs/hwui/RenderNode.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -477,6 +477,14 @@ void RenderNode::applyViewPropertyTransforms(mat4& matrix, bool true3dTransform) } } } if (Properties::stretchEffectBehavior == StretchEffectBehavior::LinearScale) { const StretchEffect& stretch = properties().layerProperties().getStretchEffect(); if (!stretch.isEmpty()) { matrix.multiply( stretch.makeLinearStretch(properties().getWidth(), properties().getHeight())); } } } const SkPath* RenderNode::getClippedOutline(const SkRect& clipRect) const { Loading libs/hwui/effects/StretchEffect.h +9 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <SkImage.h> #include <SkImageFilter.h> #include <SkMatrix.h> #include <SkPoint.h> #include <SkRect.h> #include <SkRuntimeEffect.h> Loading Loading @@ -99,6 +100,14 @@ public: const SkVector getStretchDirection() const { return mStretchDirection; } SkMatrix makeLinearStretch(float width, float height) const { SkMatrix matrix; auto [sX, sY] = getStretchDirection(); matrix.setScale(1 + std::abs(sX), 1 + std::abs(sY), sX > 0 ? 0 : width, sY > 0 ? 0 : height); return matrix; } private: static sk_sp<SkRuntimeEffect> getStretchEffect(); mutable SkVector mStretchDirection{0, 0}; Loading Loading
libs/hwui/DamageAccumulator.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -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::LinearScale) { 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); Loading
libs/hwui/Properties.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,8 @@ float Properties::defaultSdrWhitePoint = 200.f; bool Properties::useHintManager = true; int Properties::targetCpuTimePercentage = 70; StretchEffectBehavior Properties::stretchEffectBehavior = StretchEffectBehavior::Shader; bool Properties::load() { bool prevDebugLayersUpdates = debugLayersUpdates; bool prevDebugOverdraw = debugOverdraw; Loading Loading @@ -135,6 +137,10 @@ bool Properties::load() { targetCpuTimePercentage = base::GetIntProperty(PROPERTY_TARGET_CPU_TIME_PERCENTAGE, 70); 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)); stretchEffectBehavior = static_cast<StretchEffectBehavior>(stretchType); return (prevDebugLayersUpdates != debugLayersUpdates) || (prevDebugOverdraw != debugOverdraw); } Loading
libs/hwui/Properties.h +9 −0 Original line number Diff line number Diff line Loading @@ -171,6 +171,8 @@ enum DebugLevel { */ #define PROPERTY_TARGET_CPU_TIME_PERCENTAGE "debug.hwui.target_cpu_time_percent" #define PROPERTY_STRETCH_EFFECT_TYPE "debug.hwui.stretch_mode" /** * Property for whether this is running in the emulator. */ Loading @@ -197,6 +199,11 @@ enum class OverdrawColorSet { Default = 0, Deuteranomaly }; enum class RenderPipelineType { SkiaGL, SkiaVulkan, NotInitialized = 128 }; enum class StretchEffectBehavior { Shader, LinearScale, }; /** * Renderthread-only singleton which manages several static rendering properties. Most of these * are driven by system properties which are queried once at initialization, and again if init() Loading Loading @@ -270,6 +277,8 @@ public: static bool useHintManager; static int targetCpuTimePercentage; static StretchEffectBehavior stretchEffectBehavior; private: static ProfileType sProfileType; static bool sDisableProfileBars; Loading
libs/hwui/RenderNode.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -477,6 +477,14 @@ void RenderNode::applyViewPropertyTransforms(mat4& matrix, bool true3dTransform) } } } if (Properties::stretchEffectBehavior == StretchEffectBehavior::LinearScale) { const StretchEffect& stretch = properties().layerProperties().getStretchEffect(); if (!stretch.isEmpty()) { matrix.multiply( stretch.makeLinearStretch(properties().getWidth(), properties().getHeight())); } } } const SkPath* RenderNode::getClippedOutline(const SkRect& clipRect) const { Loading
libs/hwui/effects/StretchEffect.h +9 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <SkImage.h> #include <SkImageFilter.h> #include <SkMatrix.h> #include <SkPoint.h> #include <SkRect.h> #include <SkRuntimeEffect.h> Loading Loading @@ -99,6 +100,14 @@ public: const SkVector getStretchDirection() const { return mStretchDirection; } SkMatrix makeLinearStretch(float width, float height) const { SkMatrix matrix; auto [sX, sY] = getStretchDirection(); matrix.setScale(1 + std::abs(sX), 1 + std::abs(sY), sX > 0 ? 0 : width, sY > 0 ? 0 : height); return matrix; } private: static sk_sp<SkRuntimeEffect> getStretchEffect(); mutable SkVector mStretchDirection{0, 0}; Loading