Skip to content

[macOS] Rendering an empty scene after a scene with content does not clear old content. #113785

@a-wallen

Description

@a-wallen

Steps to Reproduce

  1. Execute flutter run on the code sample

Expected results:

Screen.Recording.2022-10-20.at.9.12.22.AM.mov

The content should be cleared after the second call to render an empty scene.

Actual results:

Screen.Recording.2022-10-20.at.7.52.47.AM.mov

The content is not cleared.

Code sample
import 'dart:ui';

Picture _createSimplePicture() {
  Paint blackPaint = Paint();
  PictureRecorder baseRecorder = PictureRecorder();
  Canvas canvas = Canvas(baseRecorder);
  canvas.drawRect(Rect.fromLTRB(0.0, 0.0, 1000.0, 1000.0), blackPaint);
  return baseRecorder.endRecording();
}

void main() async {
  PlatformDispatcher.instance.views.first.render(SceneBuilder().build());
  // 1. should look black

  await Future.delayed(const Duration(seconds: 2));

  final SceneBuilder builder = SceneBuilder();
  builder.addPicture(Offset(1.0, 1.0), _createSimplePicture());
  builder.pushOffset(1.0, 2.0);
  builder.pop();
  PlatformDispatcher.instance.views.first.render(builder.build());
  // 2. should have a red square

  await Future.delayed(const Duration(seconds: 2));

  PlatformDispatcher.instance.views.first.render(SceneBuilder().build());
  // 3. should be black again.

  await Future.delayed(const Duration(seconds: 2));
}
Logs
flutter analyze
Analyzing flutter_desktop_bug...                                        

warning • The include file 'package:flutter_lints/flutter.yaml' in
       '/Users/stephenwallen/Development/flutter_projects/flutter_desktop_bug/analysis_options.ya
       ml' can't be found when analyzing
       '/Users/stephenwallen/Development/flutter_projects/flutter_desktop_bug' •
       analysis_options.yaml:10:10 • include_file_not_found
flutter doctor -v
[✓] Flutter (Channel master, 3.0.0-1.0.pre.3445, on macOS 12.6 21G115 darwin-arm64, locale en)
    • Flutter version 3.0.0-1.0.pre.3445 on channel master at
      /Users/stephenwallen/Development/flutter/flutter
    • Upstream repository [email protected]:a-wallen/flutter.git
    • FLUTTER_GIT_URL = [email protected]:a-wallen/flutter.git
    • Framework revision 38ef9410b4 (24 hours ago), 2022-10-19 12:13:12 -0700
    • Engine revision 563b8e830c
    • Dart version 2.19.0 (build 2.19.0-317.0.dev)
    • DevTools version 2.18.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at
      /Users/stephenwallen/Development/flutter/engine/src/third_party/android_tools/sdk
    • Platform android-33, build-tools 33.0.0
    • ANDROID_SDK_ROOT =
      /Users/stephenwallen/Development/flutter/engine/src/third_party/android_tools/sdk
    • Java binary at: /Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment Zulu11.58+23-CA (build 11.0.16.1+1-LTS)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.0)
    • Xcode at /Applications/Xcode-beta.app/Contents/Developer
    • Build 14A5270f
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed
      instructions).

[✓] VS Code (version 1.72.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.50.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 12.6 21G115 darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 106.0.5249.119

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: desktopRunning on desktopa: fidelityMatching the OEM platforms betterc: renderingUI glitches reported at the engine/skia or impeller rendering levelengineflutter/engine related. See also e: labels.found in release: 3.3Found to occur in 3.3found in release: 3.5Found to occur in 3.5has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-macBuilding on or for macOS specificallyr: fixedIssue is closed as already fixed in a newer version

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions