Index: src/animator/SkMemberInfo.h |
diff --git a/src/animator/SkMemberInfo.h b/src/animator/SkMemberInfo.h |
index e07c32270d2ab65393bb7ffdf4a9dd35a0bda9c5..3588da2515b09ffc228714477ed95c62f1c2330a 100644 |
--- a/src/animator/SkMemberInfo.h |
+++ b/src/animator/SkMemberInfo.h |
@@ -104,13 +104,18 @@ struct SkMemberInfo { |
// static bool SetValue(void* value, const char* name, SkDisplayTypes , int count); |
}; |
+#ifndef SK_OFFSETOF |
+ // This is offsetof for types which are not standard layout. |
+ #define SK_OFFSETOF(type, field) (size_t)((char*)&(((type*)1024)->field) - (char*)1024) |
+#endif |
+ |
#define SK_MEMBER(_member, _type) \ |
{ #_member, SK_OFFSETOF(BASE_CLASS, _member), SkType_##_type, \ |
- sizeof(((BASE_CLASS*) 1)->_member) / sizeof(SkScalar) } |
+ sizeof(skstd::declval<BASE_CLASS>()._member) / sizeof(SkScalar) } |
#define SK_MEMBER_ALIAS(_member, _alias, _type) \ |
{ #_member, SK_OFFSETOF(BASE_CLASS, _alias), SkType_##_type, \ |
- sizeof(((BASE_CLASS*) 1)->_alias) / sizeof(SkScalar) } |
+ sizeof(skstd::declval<BASE_CLASS>()._alias) / sizeof(SkScalar) } |
#define SK_MEMBER_ARRAY(_member, _type) \ |
{ #_member, SK_OFFSETOF(BASE_CLASS, _member), SkType_Array, \ |