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

Side by Side Diff: include/gpu/GrTypes.h

Issue 1139513002: Add assignment op to enum bitfield ops (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/gpu/effects/GrCustomXfermode.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #ifndef GrTypes_DEFINED 9 #ifndef GrTypes_DEFINED
10 #define GrTypes_DEFINED 10 #define GrTypes_DEFINED
11 11
12 #include "SkTypes.h" 12 #include "SkTypes.h"
13 #include "GrConfig.h" 13 #include "GrConfig.h"
14 #include "SkMath.h" 14 #include "SkMath.h"
15 15
16 //////////////////////////////////////////////////////////////////////////////// 16 ////////////////////////////////////////////////////////////////////////////////
17 17
18 /** 18 /**
19 * Defines overloaded bitwise operators to make it easier to use an enum as a 19 * Defines overloaded bitwise operators to make it easier to use an enum as a
20 * bitfield. 20 * bitfield.
21 */ 21 */
22 #define GR_MAKE_BITFIELD_OPS(X) \ 22 #define GR_MAKE_BITFIELD_OPS(X) \
23 inline X operator | (X a, X b) { \ 23 inline X operator | (X a, X b) { \
24 return (X) (+a | +b); \ 24 return (X) (+a | +b); \
25 } \ 25 } \
26 inline X& operator |= (X& a, X b) { \
27 return (a = a | b); \
28 } \
26 \ 29 \
27 inline X operator & (X a, X b) { \ 30 inline X operator & (X a, X b) { \
28 return (X) (+a & +b); \ 31 return (X) (+a & +b); \
29 } \ 32 } \
30 template <typename T> \ 33 template <typename T> \
31 inline X operator & (T a, X b) { \ 34 inline X operator & (T a, X b) { \
32 return (X) (+a & +b); \ 35 return (X) (+a & +b); \
33 } \ 36 } \
34 template <typename T> \ 37 template <typename T> \
35 inline X operator & (X a, T b) { \ 38 inline X operator & (X a, T b) { \
36 return (X) (+a & +b); \ 39 return (X) (+a & +b); \
37 } \ 40 } \
38 41
39 #define GR_DECL_BITFIELD_OPS_FRIENDS(X) \ 42 #define GR_DECL_BITFIELD_OPS_FRIENDS(X) \
40 friend X operator | (X a, X b); \ 43 friend X operator | (X a, X b); \
44 friend X& operator |= (X& a, X b); \
41 \ 45 \
42 friend X operator & (X a, X b); \ 46 friend X operator & (X a, X b); \
43 \ 47 \
44 template <typename T> \ 48 template <typename T> \
45 friend X operator & (T a, X b); \ 49 friend X operator & (T a, X b); \
46 \ 50 \
47 template <typename T> \ 51 template <typename T> \
48 friend X operator & (X a, T b); \ 52 friend X operator & (X a, T b); \
49 //////////////////////////////////////////////////////////////////////////////// 53 ////////////////////////////////////////////////////////////////////////////////
50 54
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 public: 619 public:
616 GrAutoMalloc() : INHERITED() {} 620 GrAutoMalloc() : INHERITED() {}
617 explicit GrAutoMalloc(size_t size) : INHERITED(size) {} 621 explicit GrAutoMalloc(size_t size) : INHERITED(size) {}
618 virtual ~GrAutoMalloc() {} 622 virtual ~GrAutoMalloc() {}
619 private: 623 private:
620 typedef GrAutoMallocBaseType INHERITED; 624 typedef GrAutoMallocBaseType INHERITED;
621 }; 625 };
622 626
623 #undef GrAutoMallocBaseType 627 #undef GrAutoMallocBaseType
624 #endif 628 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/effects/GrCustomXfermode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698