From 758d7c77440fde42e61bd1de4fcb101daf0aceb0 Mon Sep 17 00:00:00 2001 From: zarzet <42882290+zarzet@users.noreply.github.com> Date: Fri, 20 Nov 2026 20:16:46 +0700 Subject: [PATCH] fix(mornye): remove the thin line where a full screen cover ends Under the title of the Mornye player with a full screen still cover, a line about four device pixels tall ran across the page at the cover's lower edge, lighter or darker than the one colour below it depending on the cover. The cover's glow is drawn once at a quarter of the physical resolution. The box of its soft copy ended on a fraction of a pixel there, so the last row was covered only in part: the mask that fades the soft copy out reached that row with the same partial coverage and left part of the blurred cover in it. Stretched back to the page, that row is the line. The box now ends on a whole pixel. --- lib/widgets/mornye_cover_glow.dart | 4 +++- test/mornye_cover_glow_test.dart | 24 +++++++++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/lib/widgets/mornye_cover_glow.dart b/lib/widgets/mornye_cover_glow.dart index 0a4ad92e0..f48c94abf 100644 --- a/lib/widgets/mornye_cover_glow.dart +++ b/lib/widgets/mornye_cover_glow.dart @@ -284,11 +284,13 @@ class _MornyeCoverGlowState extends State width.toDouble(), artworkHeight * scale, ); + // Whole pixels: a last row the box covered in part would keep part of + // the soft copy under the mask and show as a line at the cover's edge. final soft = Rect.fromLTWH( 0, 0, width.toDouble(), - (artworkHeight - fadeTop) * scale, + math.max(1, ((artworkHeight - fadeTop) * scale).roundToDouble()), ); // Starts under the part of the soft copy that hides the cover, so its // upper edge is never seen. diff --git a/test/mornye_cover_glow_test.dart b/test/mornye_cover_glow_test.dart index 457022462..c97ef96ac 100644 --- a/test/mornye_cover_glow_test.dart +++ b/test/mornye_cover_glow_test.dart @@ -65,6 +65,7 @@ void main() { required String? artUri, bool visible = true, bool reducedMotion = false, + double fadeStart = 0.72, }) async { await tester.pumpWidget( MaterialApp( @@ -76,7 +77,7 @@ void main() { child: MornyeCoverGlow( artUri: artUri, visible: visible, - fadeStart: 0.72, + fadeStart: fadeStart, ), ), ), @@ -164,6 +165,27 @@ void main() { expect(dimmed, greaterThan(mornyeLabelBackgroundLuminance - 0.03)); }); + testWidgets('no line is left where the soft copy ends', (tester) async { + final white = await _cover(tester, directory, const Color(0xffffffff)); + // The fade is 114 dp, 28.5 pixels of the drawn image: its last row is + // covered in half. + await pumpGlow(tester, artUri: white, fadeStart: 0.715); + + final drawn = await pixels(tester); + final colour = pixel(drawn, 50, drawn.$1.height - 1); + // The soft copy is all but gone in its last row, and gone after it. + for (var y = 28; y < 32; y++) { + final row = pixel(drawn, 50, y); + for (var channel = 0; channel < 3; channel++) { + expect( + row[channel], + closeTo(colour[channel], y == 28 ? 3 : 1), + reason: 'row $y', + ); + } + } + }); + test('the one colour is the lower edge as the page shows it', () { // White above. The lower 30%: green at both sides, red then blue in // the middle.