Loading libs/hwui/aconfig/hwui_flags.aconfig +10 −0 Original line number Diff line number Diff line Loading @@ -214,3 +214,13 @@ flag { purpose: PURPOSE_BUGFIX } } flag { name: "surfaceview_stretch_alignment" namespace: "core_graphics" description: "Fix SurfaceView alignment when overscroll stretch is occurring" bug: "419836766" metadata { purpose: PURPOSE_BUGFIX } } libs/hwui/jni/android_graphics_RenderNode.cpp +55 −26 Original line number Diff line number Diff line Loading @@ -15,6 +15,9 @@ */ #define ATRACE_TAG ATRACE_TAG_VIEW #ifdef __linux__ #include <com_android_graphics_hwui_flags.h> #endif #include <Animator.h> #include <DamageAccumulator.h> #include <Matrix.h> Loading @@ -36,6 +39,14 @@ using namespace uirenderer; ? (reinterpret_cast<RenderNode*>(renderNodePtr)->setPropertyFieldsDirty(dirtyFlag), true) \ : false) bool surfaceview_stretch_alignment() { #ifdef __linux__ return com::android::graphics::hwui::flags::surfaceview_stretch_alignment(); #else return true; #endif } // ---------------------------------------------------------------------------- // DisplayList view properties // ---------------------------------------------------------------------------- Loading Loading @@ -708,6 +719,23 @@ static void android_view_RenderNode_requestPositionUpdates(JNIEnv* env, jobject, info.damageAccumulator->findNearestStretchEffect(); const StretchEffect* effect = result.stretchEffect; if (effect) { if (surfaceview_stretch_alignment()) { auto& parentBounds = result.parentBounds; auto parentWidth = parentBounds.width(); auto parentHeight = parentBounds.height(); float normalized; normalized = targetBounds.top / parentHeight; targetBounds.top = effect->computeStretchedPositionY(normalized) * parentHeight; normalized = targetBounds.bottom / parentHeight; targetBounds.bottom = effect->computeStretchedPositionY(normalized) * parentHeight; normalized = targetBounds.left / parentWidth; targetBounds.left = effect->computeStretchedPositionX(normalized) * parentWidth; normalized = targetBounds.right / parentWidth; targetBounds.right = effect->computeStretchedPositionX(normalized) * parentWidth; } else { // Compute the number of pixels that the stretching container // scales by. // Then compute the scale factor that the child would need Loading @@ -734,6 +762,7 @@ static void android_view_RenderNode_requestPositionUpdates(JNIEnv* env, jobject, targetBounds.top = dst.top(); targetBounds.right = dst.right(); targetBounds.bottom = dst.bottom(); } } else { return; } Loading Loading
libs/hwui/aconfig/hwui_flags.aconfig +10 −0 Original line number Diff line number Diff line Loading @@ -214,3 +214,13 @@ flag { purpose: PURPOSE_BUGFIX } } flag { name: "surfaceview_stretch_alignment" namespace: "core_graphics" description: "Fix SurfaceView alignment when overscroll stretch is occurring" bug: "419836766" metadata { purpose: PURPOSE_BUGFIX } }
libs/hwui/jni/android_graphics_RenderNode.cpp +55 −26 Original line number Diff line number Diff line Loading @@ -15,6 +15,9 @@ */ #define ATRACE_TAG ATRACE_TAG_VIEW #ifdef __linux__ #include <com_android_graphics_hwui_flags.h> #endif #include <Animator.h> #include <DamageAccumulator.h> #include <Matrix.h> Loading @@ -36,6 +39,14 @@ using namespace uirenderer; ? (reinterpret_cast<RenderNode*>(renderNodePtr)->setPropertyFieldsDirty(dirtyFlag), true) \ : false) bool surfaceview_stretch_alignment() { #ifdef __linux__ return com::android::graphics::hwui::flags::surfaceview_stretch_alignment(); #else return true; #endif } // ---------------------------------------------------------------------------- // DisplayList view properties // ---------------------------------------------------------------------------- Loading Loading @@ -708,6 +719,23 @@ static void android_view_RenderNode_requestPositionUpdates(JNIEnv* env, jobject, info.damageAccumulator->findNearestStretchEffect(); const StretchEffect* effect = result.stretchEffect; if (effect) { if (surfaceview_stretch_alignment()) { auto& parentBounds = result.parentBounds; auto parentWidth = parentBounds.width(); auto parentHeight = parentBounds.height(); float normalized; normalized = targetBounds.top / parentHeight; targetBounds.top = effect->computeStretchedPositionY(normalized) * parentHeight; normalized = targetBounds.bottom / parentHeight; targetBounds.bottom = effect->computeStretchedPositionY(normalized) * parentHeight; normalized = targetBounds.left / parentWidth; targetBounds.left = effect->computeStretchedPositionX(normalized) * parentWidth; normalized = targetBounds.right / parentWidth; targetBounds.right = effect->computeStretchedPositionX(normalized) * parentWidth; } else { // Compute the number of pixels that the stretching container // scales by. // Then compute the scale factor that the child would need Loading @@ -734,6 +762,7 @@ static void android_view_RenderNode_requestPositionUpdates(JNIEnv* env, jobject, targetBounds.top = dst.top(); targetBounds.right = dst.right(); targetBounds.bottom = dst.bottom(); } } else { return; } Loading