Skip to content

[Impeller] Imparity of blur result with MaskFilter.blur in custom painter with skia on master #127770

@junaid1460

Description

@junaid1460

Is there an existing issue for this?

Steps to reproduce

  1. clone https://github.com/junaid1460/flutter_impeller_reported_bugs
  2. This project has old reported issues as well, but tabbed to show it. choose mask blur tab
Screenshot 2023-05-28 at 4 43 52 PM
  1. Repeat step to with with and without --no-enable-impeller

Expected results

Simulator Screenshot - iPhone 14 Pro Max - 2023-05-28 at 10 51 20

Actual results

Simulator Screenshot - iPhone 14 Pro Max - 2023-05-28 at 10 47 17

Code sample

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

class CustomPaintMaskBlur extends StatefulWidget {
  const CustomPaintMaskBlur({super.key});

  @override
  State<CustomPaintMaskBlur> createState() => _CustomPaintMaskBlurState();
}

class _CustomPaintMaskBlurState extends State<CustomPaintMaskBlur> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text('Custom Paint Mask Blur'),
        ),
        body: SizedBox.expand(
          child: CustomPaint(
            painter: _ExamplePainter(),
          ),
        ));
  }
}

class _ExamplePainter extends CustomPainter {
  @override
  void paint(Canvas canvas, Size size) {
    Path path_0 = Path();
    path_0.moveTo(size.width * 0.4969963, size.height * 0.2225648);
    path_0.cubicTo(
        size.width * 0.3010403,
        size.height * 0.2494297,
        size.width * 0.2630477,
        size.height * 0.4639523,
        size.width * 0.2850391,
        size.height * 0.6040218);
    path_0.cubicTo(
        size.width * 0.2850391,
        size.height * 0.6892674,
        size.width * 0.2085379,
        size.height * 0.6246876,
        size.width * 0.1895880,
        size.height * 0.7013233);
    path_0.cubicTo(
        size.width * 0.1706381,
        size.height * 0.7779591,
        size.width * 0.3566271,
        size.height * 0.8106794,
        size.width * 0.6528056,
        size.height * 0.7762360);
    path_0.cubicTo(
        size.width * 0.9489841,
        size.height * 0.7417940,
        size.width * 0.7405367,
        size.height * 0.5954106,
        size.width * 0.7398350,
        size.height * 0.4051119);
    path_0.cubicTo(
        size.width * 0.7391333,
        size.height * 0.2148145,
        size.width * 0.7419401,
        size.height * 0.1889823,
        size.width * 0.4969963,
        size.height * 0.2225648);
    path_0.close();

    final paint = Paint()
      ..maskFilter = const MaskFilter.blur(BlurStyle.normal, 164.0)
      ..shader = LinearGradient(
        colors: [
          const Color(0xff00AF54).withOpacity(0.3),
          const Color(0xffFFE972).withOpacity(0.3)
        ],
        begin: Alignment.topLeft,
        end: Alignment.bottomRight,
      ).createShader(Rect.fromLTWH(0, 0, size.width, size.height));

    canvas.drawPath(path_0, paint);
  }

  @override
  bool shouldRepaint(covariant CustomPainter oldDelegate) {
    return false;
  }
}

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]
Simulator Screenshot - iPhone 14 Pro Max - 2023-05-28 at 10 47 17
Simulator Screenshot - iPhone 14 Pro Max - 2023-05-28 at 10 47 53

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 3.11.0-14.0.pre.59, on macOS 13.1 22C65 darwin-arm64, locale en-IN)
    • Flutter version 3.11.0-14.0.pre.59 on channel master at /Users/mj/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision bca7644070 (16 hours ago), 2023-05-27 15:40:24 -0400
    • Engine revision b1698020bd
    • Dart version 3.1.0 (build 3.1.0-155.0.dev)
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/mj/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

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

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

[✓] Android Studio (version 2022.1)
    • 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.15+0-b2043.56-8887301)

[✓] Android Studio (version 2021.3)
    • Android Studio at /////////
    • 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)

[✓] IntelliJ IDEA Community Edition (version 2022.2.1)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 69.0.5
    • Dart plugin version 222.3739.24

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

[✓] Connected device (4 available)
-----

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work liste: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.team-engineOwned by Engine teamtriaged-engineTriaged by Engine team

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions