Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Unified Diff: include/gpu/GrTypes.h

Issue 2225303002: Add flag for window rectangles to GrRenderTarget (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: include/gpu/GrTypes.h
diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h
index a0f13aa6febcbf35f8909ac486e44d3eef5f5f5b..8a1d7a6c07d470fa4fa280fee017109c57b3e4c0 100644
--- a/include/gpu/GrTypes.h
+++ b/include/gpu/GrTypes.h
@@ -49,6 +49,27 @@
\
template <typename T> \
friend X operator & (X a, T b); \
+
+/**
+ * Defines bitwise operators that make it possible to use an enum class as a
+ * very basic bitfield.
+ */
+#define GR_MAKE_BITFIELD_CLASS_OPS(X) \
+ inline X operator | (X a, X b) { \
+ return (X) ((int)a | (int)b); \
+ } \
+ inline X& operator |= (X& a, X b) { \
+ return (a = a | b); \
+ } \
+ inline bool operator & (X a, X b) { \
+ return ((int)a & (int)b); \
+ }
+
+#define GR_DECL_BITFIELD_CLASS_OPS_FRIENDS(X) \
+ friend X operator | (X a, X b); \
+ friend X& operator |= (X& a, X b); \
+ friend bool operator & (X a, X b);
+
////////////////////////////////////////////////////////////////////////////////
// compile time versions of min/max

Powered by Google App Engine
This is Rietveld 408576698