From 33f2dcb7eb97ac62d614a102cb4061b00eef0751 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Wed, 25 Sep 2024 21:54:11 -0700 Subject: [PATCH] [iOS] remove clear color hack. (flutter/engine#54451) Fixes https://github.com/flutter/flutter/issues/125640 This doesn't actually do anything, instead it forces opaque to false. If developers want opaque to be false, they can just set it directly. --- .../platform/darwin/ios/framework/Source/FlutterView.mm | 6 ------ .../platform/darwin/ios/framework/Source/FlutterViewTest.mm | 4 ++-- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterView.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterView.mm index e50f903492..7e8e1108b1 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterView.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterView.mm @@ -76,12 +76,6 @@ FLUTTER_ASSERT_ARC _delegate = delegate; _isWideGamutEnabled = isWideGamutEnabled; self.layer.opaque = opaque; - - // This line is necessary. CoreAnimation(or UIKit) may take this to do - // something to compute the final frame presented on screen, if we don't set this, - // it will make it take long time for us to take next CAMetalDrawable and will - // cause constant junk during rendering. - self.backgroundColor = UIColor.clearColor; } return self; diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterViewTest.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterViewTest.mm index 098c0f3eb9..e7b26cbe70 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterViewTest.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterViewTest.mm @@ -51,10 +51,10 @@ FLUTTER_ASSERT_ARC XCTAssertTrue(delegate.callbackCalled); } -- (void)testFlutterViewBackgroundColorIsNotNil { +- (void)testFlutterViewBackgroundColorIsNil { FakeDelegate* delegate = [[FakeDelegate alloc] init]; FlutterView* view = [[FlutterView alloc] initWithDelegate:delegate opaque:NO enableWideGamut:NO]; - XCTAssertNotNil(view.backgroundColor); + XCTAssertNil(view.backgroundColor); } - (void)testIgnoreWideColorWithoutImpeller {