Skip to content

Rendering errors with Rect.largest when used with toImage (e.g. gold image tests) using impeller #144643

@Hixie

Description

@Hixie

If you run the following using flutter test --enable-impeller, you get a test.png containing a hollow square with the top left corner damaged, but it should just be a hollow square:

// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:io';
import 'dart:ui';

const double z = 1000000000; // aka _giantScalar, used in Rect.largest

void main() async {
  final PictureRecorder recorder = PictureRecorder();
  final Canvas canvas = Canvas(recorder);
  final Path clip = Path()
    ..fillType = PathFillType.evenOdd
    ..addRect(const Rect.fromLTRB(-z, -z, z, z))
    ..addRect(const Offset(50.0, 50.0) & const Size(100.0, 100.0));
  canvas.clipPath(clip);
  canvas.drawPaint(Paint()..color = const Color(0xFF33CC66));
  final Picture picture = recorder.endRecording();
  await File('test.png').writeAsBytes((await (await picture.toImage(200, 200)).toByteData(format: ImageByteFormat.png))!.buffer.asUint8List());
}

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

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions