Chromium Code Reviews| Index: core/fxcrt/include/fx_coordinates.h |
| diff --git a/core/fxcrt/include/fx_coordinates.h b/core/fxcrt/include/fx_coordinates.h |
| index eff2a7258a2bd5ca37315894b3d0f1072a5be482..75b1c472191e4a8fe9805b4b8d37f084be481649 100644 |
| --- a/core/fxcrt/include/fx_coordinates.h |
| +++ b/core/fxcrt/include/fx_coordinates.h |
| @@ -150,6 +150,20 @@ struct FX_RECT { |
| int Height() const { return bottom - top; } |
| bool IsEmpty() const { return right <= left || bottom <= top; } |
| + bool Valid() const { |
| + pdfium::base::CheckedNumeric<int> w = right; |
|
Tom Sepez
2016/08/08 21:09:45
nit: I might write this as
pdfium::base::CheckedN
dsinclair
2016/08/09 13:35:19
Done.
|
| + w -= left; |
| + if (!w.IsValid()) |
| + return false; |
| + |
| + pdfium::base::CheckedNumeric<int> h = bottom; |
| + h -= top; |
| + if (!h.IsValid()) |
| + return false; |
| + |
| + return true; |
| + } |
| + |
| void Normalize(); |
| void Intersect(const FX_RECT& src); |