Index: src/pathops/SkPathOpsDebug.h |
diff --git a/src/pathops/SkPathOpsDebug.h b/src/pathops/SkPathOpsDebug.h |
index c1b1adb7072a750cf3e883cec1f8d3d9f2bf8171..5ea1dd8b2655a9993699140ad56b071d8f0e64ff 100644 |
--- a/src/pathops/SkPathOpsDebug.h |
+++ b/src/pathops/SkPathOpsDebug.h |
@@ -156,12 +156,19 @@ |
#include "SkTLS.h" |
#endif |
-#define FAIL_IF(cond) do { bool fail = (cond); SkOPASSERT(!fail); if (fail) return false; } \ |
- while (false) |
+// Tests with extreme numbers may fail, but all other tests should never fail. |
+#define FAIL_IF(cond) \ |
+ do { bool fail = (cond); SkOPASSERT(!fail); if (fail) return false; } while (false) |
+#define FAIL_WITH_NULL_IF(cond) \ |
+ do { bool fail = (cond); SkOPASSERT(!fail); if (fail) return nullptr; } while (false) |
+ |
+// Some functions serve two masters: one allows the function to fail, the other expects success |
+// always. If abort is true, tests with normal numbers may not fail and assert if they do so. |
+// If abort is false, both normal and extreme numbers may return false without asserting. |
#define RETURN_FALSE_IF(abort, cond) \ |
- do { bool fail = (cond); SkOPASSERT(!(abort) || !fail); if (fail) return false; } \ |
- while (false) |
+ do { bool fail = (cond); SkOPASSERT(!(abort) || !fail); if (fail) return false; \ |
+ } while (false) |
class SkPathOpsDebug { |
public: |