Update the golden image comparator to handle read-only image ByteData views (#61406)

This commit is contained in:
Jason Simmons 2020-07-14 01:41:02 -07:00 committed by GitHub
parent 1c96479760
commit af47958eff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -210,7 +210,9 @@ Future<ComparisonResult> compareLists(List<int> test, List<int> master) async {
final ByteData invertedMasterRgba = _invert(masterImageRgba);
final ByteData invertedTestRgba = _invert(testImageRgba);
final ByteData maskedDiffRgba = await testImage.toByteData();
final Uint8List testImageBytes = (await testImage.toByteData()).buffer.asUint8List();
final ByteData maskedDiffRgba = ByteData(testImageBytes.length);
maskedDiffRgba.buffer.asUint8List().setRange(0, testImageBytes.length, testImageBytes);
final ByteData isolatedDiffRgba = ByteData(width * height * 4);
for (int x = 0; x < width; x++) {