Skip to content

[Impeller] Rendering problem with Clip.antiAliasWithSaveLayer. #134705

@flar

Description

@flar

Rendering inside a Clip widget using the AA with SaveLayer option should have a protective saveLayer for everything rendered inside of it, but that saveLayer is skipped on Impeller affecting the output.

Notice that on Skia the text "x-rays" through to the yellow backdrop behind it, but on Impeller it "x-rays" through likely all the way to the blank framebuffer.

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: SizedBox(
          width: 300,
          height: 300,
          child: Container(
            color: Colors.yellow,
            child: ClipOval(
              clipBehavior: Clip.antiAliasWithSaveLayer,
              child: Container(
                color: Colors.blue,
                child: Center(
                  child: RepaintBoundary(
                    child: Text(
                      'Transparent',
                      style: TextStyle(
                        backgroundColor: Colors.blue,
                        // color: Colors.yellow,
                        foreground: Paint()..blendMode = BlendMode.clear,
                      ),
                    ),
                  ),
                ),
              ),
            ),
          ),
        ),
      ),
    );
  }
}
Skia output Screenshot 2023-09-13 at 7 25 20 PM
Impeller output Screenshot 2023-09-13 at 7 25 43 PM

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.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