aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Chris Dalton <csmartdalton@google.com>2017-11-27 14:33:06 -0700
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-11-27 22:40:27 +0000
commit3b51df12119d82661ed64efa87d5ccfe2d32f625 (patch)
tree14e9d374b599621722c102cd61a382715ed75a03 /include
parent4b9506bc3c6e06958d1c38abe56b034777d48d5c (diff)
Cleanup yes/no enums in Ganesh
Yes/no enums should have a base type of bool, and kYes should always be true. Also, there is no need for a "GrEnumToBool()" function, as we can just use the enum itself directly: e.g. "GrAA(bool)". Bug: skia: Change-Id: I7bb3c2983f717f3467fca4ce6b32920d71026894 Reviewed-on: https://skia-review.googlesource.com/74860 Commit-Queue: Chris Dalton <csmartdalton@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/gpu/GrTypes.h24
-rw-r--r--include/private/GrTypesPriv.h6
2 files changed, 12 insertions, 18 deletions
diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h
index 7d27b6c8a4..59add784a3 100644
--- a/include/gpu/GrTypes.h
+++ b/include/gpu/GrTypes.h
@@ -208,27 +208,21 @@ typedef intptr_t GrBackendContext;
/**
* Used to control antialiasing in draw calls.
*/
-enum class GrAA {
- kYes,
- kNo
+enum class GrAA : bool {
+ kNo = false,
+ kYes = true
};
-static inline GrAA GrBoolToAA(bool aa) { return aa ? GrAA::kYes : GrAA::kNo; }
-
///////////////////////////////////////////////////////////////////////////////
/**
* Used to say whether a texture has mip levels allocated or not.
*/
-enum class GrMipMapped {
- kYes,
- kNo
+enum class GrMipMapped : bool {
+ kNo = false,
+ kYes = true
};
-static inline GrMipMapped GrBoolToMipMapped(bool mipMapped) {
- return mipMapped ? GrMipMapped::kYes : GrMipMapped::kNo;
-}
-
///////////////////////////////////////////////////////////////////////////////
/**
@@ -484,9 +478,9 @@ static const uint32_t kAll_GrBackendState = 0xffffffff;
// Enum used as return value when flush with semaphores so the client knows whether the
// semaphores were submitted to GPU or not.
-enum class GrSemaphoresSubmitted : int {
- kNo,
- kYes,
+enum class GrSemaphoresSubmitted : bool {
+ kNo = false,
+ kYes = true
};
#endif
diff --git a/include/private/GrTypesPriv.h b/include/private/GrTypesPriv.h
index 4c63599927..4689e41140 100644
--- a/include/private/GrTypesPriv.h
+++ b/include/private/GrTypesPriv.h
@@ -85,7 +85,7 @@ enum class GrFSAAType {
* Not all drawing code paths support using mixed samples when available and instead use
* coverage-based aa.
*/
-enum class GrAllowMixedSamples { kNo, kYes };
+enum class GrAllowMixedSamples : bool { kNo = false, kYes = true };
GrAAType GrChooseAAType(GrAA, GrFSAAType, GrAllowMixedSamples, const GrCaps&);
@@ -94,8 +94,8 @@ GrAAType GrChooseAAType(GrAA, GrFSAAType, GrAllowMixedSamples, const GrCaps&);
* range. This is important for blending - the latter category may require manual clamping.
*/
enum class GrPixelConfigIsClamped : bool {
- kNo, // F16 or F32
- kYes, // Any UNORM type
+ kNo = false, // F16 or F32
+ kYes = true, // Any UNORM type
};
/**