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

Side by Side Diff: src/animator/SkMemberInfo.h

Issue 1309523003: Remove SK_OFFSETOF from SkTypes, clean up offsetof usage. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Speling Created 5 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 unified diff | Download patch
« no previous file with comments | « src/animator/SkDisplayInclude.cpp ('k') | src/core/SkMatrix.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 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
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 9
10 #ifndef SkMemberInfo_DEFINED 10 #ifndef SkMemberInfo_DEFINED
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 static const SkMemberInfo* Find(const SkMemberInfo [], int count, int* index ); 97 static const SkMemberInfo* Find(const SkMemberInfo [], int count, int* index );
98 static const SkMemberInfo* Find(const SkMemberInfo [], int count, const char ** name); 98 static const SkMemberInfo* Find(const SkMemberInfo [], int count, const char ** name);
99 #else 99 #else
100 static const SkMemberInfo* Find(SkDisplayTypes type, int* index); 100 static const SkMemberInfo* Find(SkDisplayTypes type, int* index);
101 static const SkMemberInfo* Find(SkDisplayTypes type, const char** name); 101 static const SkMemberInfo* Find(SkDisplayTypes type, const char** name);
102 #endif 102 #endif
103 static size_t GetSize(SkDisplayTypes type); // size of simple types only 103 static size_t GetSize(SkDisplayTypes type); // size of simple types only
104 // static bool SetValue(void* value, const char* name, SkDisplayTypes , int cou nt); 104 // static bool SetValue(void* value, const char* name, SkDisplayTypes , int cou nt);
105 }; 105 };
106 106
107 #ifndef SK_OFFSETOF
108 // This is offsetof for types which are not standard layout.
109 #define SK_OFFSETOF(type, field) (size_t)((char*)&(((type*)1024)->field) - ( char*)1024)
110 #endif
111
107 #define SK_MEMBER(_member, _type) \ 112 #define SK_MEMBER(_member, _type) \
108 { #_member, SK_OFFSETOF(BASE_CLASS, _member), SkType_##_type, \ 113 { #_member, SK_OFFSETOF(BASE_CLASS, _member), SkType_##_type, \
109 sizeof(((BASE_CLASS*) 1)->_member) / sizeof(SkScalar) } 114 sizeof(skstd::declval<BASE_CLASS>()._member) / sizeof(SkScalar) }
110 115
111 #define SK_MEMBER_ALIAS(_member, _alias, _type) \ 116 #define SK_MEMBER_ALIAS(_member, _alias, _type) \
112 { #_member, SK_OFFSETOF(BASE_CLASS, _alias), SkType_##_type, \ 117 { #_member, SK_OFFSETOF(BASE_CLASS, _alias), SkType_##_type, \
113 sizeof(((BASE_CLASS*) 1)->_alias) / sizeof(SkScalar) } 118 sizeof(skstd::declval<BASE_CLASS>()._alias) / sizeof(SkScalar) }
114 119
115 #define SK_MEMBER_ARRAY(_member, _type) \ 120 #define SK_MEMBER_ARRAY(_member, _type) \
116 { #_member, SK_OFFSETOF(BASE_CLASS, _member), SkType_Array, \ 121 { #_member, SK_OFFSETOF(BASE_CLASS, _member), SkType_Array, \
117 (int) SkType_##_type } 122 (int) SkType_##_type }
118 123
119 #define SK_MEMBER_INHERITED \ 124 #define SK_MEMBER_INHERITED \
120 { (const char*) INHERITED::fInfo, 0, SkType_BaseClassInfo, INHERITED::fInfoC ount } 125 { (const char*) INHERITED::fInfo, 0, SkType_BaseClassInfo, INHERITED::fInfoC ount }
121 126
122 // #define SK_MEMBER_KEY_TYPE(_member, _type) 127 // #define SK_MEMBER_KEY_TYPE(_member, _type)
123 // {#_member, (size_t) -1, SkType_##_type, 0} 128 // {#_member, (size_t) -1, SkType_##_type, 0}
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 #define DECLARE_NO_VIRTUALS_MEMBER_INFO(_type) \ 266 #define DECLARE_NO_VIRTUALS_MEMBER_INFO(_type) \
262 public: \ 267 public: \
263 typedef Sk##_type BASE_CLASS 268 typedef Sk##_type BASE_CLASS
264 269
265 #define DEFINE_GET_MEMBER(_class) 270 #define DEFINE_GET_MEMBER(_class)
266 #define DEFINE_NO_VIRTUALS_GET_MEMBER(_class) 271 #define DEFINE_NO_VIRTUALS_GET_MEMBER(_class)
267 272
268 #endif 273 #endif
269 274
270 #endif // SkMemberInfo_DEFINED 275 #endif // SkMemberInfo_DEFINED
OLDNEW
« no previous file with comments | « src/animator/SkDisplayInclude.cpp ('k') | src/core/SkMatrix.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698