Index: src/core/SkValidation.h |
diff --git a/src/core/SkValidation.h b/src/core/SkValidation.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..dba7494e23ce81737017b9939c55bae3175cb6a4 |
--- /dev/null |
+++ b/src/core/SkValidation.h |
@@ -0,0 +1,32 @@ |
+/* |
+ * Copyright 2013 Google Inc. |
+ * |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
+ |
+#ifndef SkValidation_DEFINED |
reed1
2013/09/04 18:49:36
SkValidationUtils.h might be a more similar naming
sugoi1
2013/09/04 20:14:52
Done.
|
+#define SkValidation_DEFINED |
+ |
+#include "SkBitmap.h" |
+#include "SkXfermode.h" |
+ |
+/** Returns true if coeff's value is in the SkXfermode::Coeff enum. |
+ */ |
+static inline bool IsValidCoeff(SkXfermode::Coeff coeff) { |
+ return coeff >= 0 && coeff < SkXfermode::kCoeffCount; |
+} |
+ |
+/** Returns true if mode's value is in the SkXfermode::Mode enum. |
+ */ |
+static inline bool IsValidMode(SkXfermode::Mode mode) { |
+ return (mode >= 0) && (mode <= SkXfermode::kLastMode); |
+} |
+ |
+/** Returns true if config's value is in the SkBitmap::Config enum. |
+ */ |
+static inline bool IsValidConfig(SkBitmap::Config config) { |
+ return (config >= 0) && (config <= SkBitmap::kLastConfig); |
+} |
+ |
+#endif |