Skip to content

[Impeller] Artefacts when drawing circle of non integer position with a ShaderMask #128353

@RobertOdrowaz

Description

@RobertOdrowaz

Is there an existing issue for this?

Steps to reproduce

  1. Draw a circle offset by a fraction of a pixel inside of a SharedMask widget
  2. Run application on physical iOS device (observed on iPhone 14, iOS 16.5)

Expected results

Circle is precisely rendered.

Actual results

The circle is imprecisely rendered (visible on screenshots).
Works correctly with impeller disabled. All simpler cases (without 0.5px padding or without ShaderMask) work properly as well.

Code sample

Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) => MaterialApp(
        home: Scaffold(
          body: Center(
            child: SizedBox.square(
              dimension: 100,
              child: ShaderMask(
                shaderCallback: (rect) => const LinearGradient(
                  colors: [
                    Colors.black,
                    Colors.transparent,
                  ],
                  stops: [
                    0,
                    1,
                  ],
                ).createShader(rect),
                blendMode: BlendMode.dstOut,
                child: const Padding(
                  padding: EdgeInsets.all(0.5),
                  child: DecoratedBox(
                    decoration: BoxDecoration(
                      shape: BoxShape.circle,
                      color: Colors.grey,
                    ),
                  ),
                ),
              ),
            ),
          ),
        ),
      );
}

Screenshots or Video

Screenshots / Video demonstration

IMG_0180

IMG_0180_cropped

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.10.3, on macOS 13.0.1 22A400 darwin-arm64, locale en-PL)
    • Flutter version 3.10.3 on channel stable at /Users/robert/fvm/versions/3.10.3
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f92f44110e (5 days ago), 2023-06-01 18:17:33 -0500
    • Engine revision 2a3401c9bb
    • Dart version 3.0.3
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /Users/robert/Library/Android/sdk
    • Platform android-33, build-tools 32.1.0-rc1
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode 14.2.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.12.1

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

[✓] Android Studio (version 2021.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

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

[✓] Connected device (4 available)
    • Robert’s iPhone (mobile)   • 00008110-000275E03ABA401E            • ios            • iOS
      16.5 20F66
    • iPhone 14 Pro Max (mobile) • 289D6742-D42F-4AA0-A767-036465059E0A • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator)
    • macOS (desktop)            • macos                                • darwin-arm64   • macOS
      13.0.1 22A400 darwin-arm64
    • Chrome (web)               • chrome                               • web-javascript • Google
      Chrome 113.0.5672.126
    ! Error: Robert’s iPhone is busy: Fetching debug symbols for Robert’s iPhone. Xcode will
      continue when Robert’s iPhone is finished. (code -10)

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work liste: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.found in release: 3.10Found to occur in 3.10found in release: 3.11Found to occur in 3.11has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specifically

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions