Allow infinity values in the Dart wrappers for Skia Canvas (flutter/engine#3985)

Fixes https://github.com/flutter/flutter/issues/11586
This commit is contained in:
Jason Simmons
2017-08-16 16:21:52 -07:00
committed by GitHub
parent a78aa4cde4
commit bd7ae44737

View File

@@ -13,19 +13,25 @@ part of dart.ui;
// would cause a crash. It is, however, acceptable for error messages to be much
// less useful or correct in release mode than in debug mode.
//
// Painting APIs will also warn about arguments representing NaN or infinite
// coordinates, which can not be rendered by Skia.
// Painting APIs will also warn about arguments representing NaN coordinates,
// which can not be rendered by Skia.
bool _rectIsValid(Rect rect) {
return rect != null && rect.isFinite;
assert(rect != null, 'Rect argument was null.');
assert(!rect._value.any((double value) => value.isNaN), 'Rect argument contained a NaN value.');
return true;
}
bool _rrectIsValid(RRect rrect) {
return rrect != null && rrect.isFinite;
assert(rrect != null, 'RRect argument was null.');
assert(!rrect._value.any((double value) => value.isNaN), 'RRect argument contained a NaN value.');
return true;
}
bool _offsetIsValid(Offset offset) {
return offset != null && offset.isFinite;
assert(offset != null, 'Offset argument was null.');
assert(!offset.dx.isNaN && !offset.dy.isNaN, 'Offset argument contained a NaN value.');
return true;
}
Color _scaleAlpha(Color a, double factor) {