Skip to content

Commit

Permalink
Allow infinity values in the Dart wrappers for Skia Canvas (flutter#3985
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-simmons authored Aug 16, 2017
1 parent a246501 commit 74248d1
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lib/ui/painting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 74248d1

Please sign in to comment.