Skip to content

[Impeller] Rendering issue with gradient tile mode set to 'decal' #128327

@ColdPaleLight

Description

@ColdPaleLight

Is there an existing issue for this?

Steps to reproduce

run the sample code on master channel

Expected results

Outside of radial gradient is white

Actual results

Outside of radial gradient is black

Code sample

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

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Decal Gradient Demo'),
        ),
        body: Center(
          child: CustomPaint(
            size: Size(400, 400),
            painter: MyPainter(),
          ),
        ),
      ),
    );
  }
}

class MyPainter extends CustomPainter {
  @override
  void paint(Canvas canvas, Size size) {
    canvas.save();
    Rect rect = const Rect.fromLTWH(0, 0, 100, 100);
    Paint paint = Paint()
      ..shader = const RadialGradient(
              tileMode: TileMode.decal,
              colors: [Colors.red, Colors.yellow, Colors.green, Colors.blue])
          .createShader(rect);
    canvas.drawRect(rect, paint);
    canvas.restore();
  }

  @override
  bool shouldRepaint(CustomPainter oldDelegate) => false;
}

Screenshots or Video

Screenshots / Video demonstration

expect

IMG_0087

actual

IMG_0086

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel master, 3.11.0-20.0.pre.16, on macOS 13.3.1 22E261 darwin-arm64, locale zh-Hans-CN)
    • Flutter version 3.11.0-20.0.pre.16 on channel master at /Users/zz/Develop/upstream/flutter
    • Upstream repository [email protected]:flutter/flutter.git
    • Framework revision 24e411f49b (8 hours ago), 2023-06-06 01:08:26 -0400
    • Engine revision 722aad83e5
    • Dart version 3.1.0 (build 3.1.0-163.0.dev)
    • DevTools version 2.24.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/zz/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • ANDROID_HOME = /Users/zz/Library/Android/sdk
    • 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.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14B47b
    • CocoaPods version 1.11.3

[✓] 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 (3 available)
    • iPhone SE (2nd generation) (mobile) • 00008030-0018042E2E46802E • ios            • iOS 15.0 19A346
    • macOS (desktop)                     • macos                     • darwin-arm64   • macOS 13.3.1 22E261 darwin-arm64
    • Chrome (web)                        • chrome                    • web-javascript • Google Chrome 113.0.5672.126

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

• No issues found!

Metadata

Metadata

Assignees

Labels

e: impellerImpeller rendering backend issues and features requests

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions