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

Side by Side Diff: include/svg/parser/SkSVGAttribute.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 | « include/private/SkTemplates.h ('k') | src/animator/SkDisplayInclude.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 SkSVGAttribute_DEFINED 10 #ifndef SkSVGAttribute_DEFINED
11 #define SkSVGAttribute_DEFINED 11 #define SkSVGAttribute_DEFINED
12 12
13 #include "SkTypes.h" 13 #include "SkTypes.h"
14 14
15 struct SkSVGAttribute { 15 struct SkSVGAttribute {
16 const char* fName; 16 const char* fName;
17 #ifdef SK_DEBUG 17 #ifdef SK_DEBUG
18 size_t fOffset; 18 size_t fOffset;
19 #endif 19 #endif
20 }; 20 };
21 21
22 #ifndef SK_OFFSETOF 22 #ifndef SK_OFFSETOF
23 #define SK_OFFSETOF(a, b) (((size_t) (&(((a*) 1)->b)))-1) 23 // This is offsetof for types which are not standard layout.
24 #define SK_OFFSETOF(type, field) (size_t)((char*)&(((type*)1024)->field) - ( char*)1024)
24 #endif 25 #endif
25 26
26 #ifdef SK_DEBUG 27 #ifdef SK_DEBUG
27 #define SVG_ATTRIBUTE(attr) { #attr, SK_OFFSETOF(BASE_CLASS, f_##attr) } 28 #define SVG_ATTRIBUTE(attr) { #attr, SK_OFFSETOF(BASE_CLASS, f_##attr) }
28 #define SVG_LITERAL_ATTRIBUTE(svgAttr, cAttr) { #svgAttr, SK_OFFSETOF(BASE_CLASS , cAttr) } 29 #define SVG_LITERAL_ATTRIBUTE(svgAttr, cAttr) { #svgAttr, SK_OFFSETOF(BASE_CLASS , cAttr) }
29 #else 30 #else
30 #define SVG_ATTRIBUTE(attr) { #attr } 31 #define SVG_ATTRIBUTE(attr) { #attr }
31 #define SVG_LITERAL_ATTRIBUTE(svgAttr, cAttr) { #svgAttr } 32 #define SVG_LITERAL_ATTRIBUTE(svgAttr, cAttr) { #svgAttr }
32 #endif 33 #endif
33 34
34 #define SVG_ADD_ATTRIBUTE(attr) \ 35 #define SVG_ADD_ATTRIBUTE(attr) \
35 if (f_##attr.size() > 0) \ 36 if (f_##attr.size() > 0) \
36 parser._addAttributeLen(#attr, f_##attr.c_str(), f_##attr.size()) 37 parser._addAttributeLen(#attr, f_##attr.c_str(), f_##attr.size())
37 38
38 #define SVG_ADD_ATTRIBUTE_ALIAS(attr, alias) \ 39 #define SVG_ADD_ATTRIBUTE_ALIAS(attr, alias) \
39 if (f_##alias.size() > 0) \ 40 if (f_##alias.size() > 0) \
40 parser._addAttributeLen(#attr, f_##alias.c_str(), f_##alias.size()) 41 parser._addAttributeLen(#attr, f_##alias.c_str(), f_##alias.size())
41 42
42 #endif // SkSVGAttribute_DEFINED 43 #endif // SkSVGAttribute_DEFINED
OLDNEW
« no previous file with comments | « include/private/SkTemplates.h ('k') | src/animator/SkDisplayInclude.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698