1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/include/svg/SkSVGAttribute.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,42 @@ 1.4 + 1.5 +/* 1.6 + * Copyright 2006 The Android Open Source Project 1.7 + * 1.8 + * Use of this source code is governed by a BSD-style license that can be 1.9 + * found in the LICENSE file. 1.10 + */ 1.11 + 1.12 + 1.13 +#ifndef SkSVGAttribute_DEFINED 1.14 +#define SkSVGAttribute_DEFINED 1.15 + 1.16 +#include "SkTypes.h" 1.17 + 1.18 +struct SkSVGAttribute { 1.19 + const char* fName; 1.20 +#ifdef SK_DEBUG 1.21 + size_t fOffset; 1.22 +#endif 1.23 +}; 1.24 + 1.25 +#ifndef SK_OFFSETOF 1.26 +#define SK_OFFSETOF(a, b) (((size_t) (&(((a*) 1)->b)))-1) 1.27 +#endif 1.28 + 1.29 +#ifdef SK_DEBUG 1.30 +#define SVG_ATTRIBUTE(attr) { #attr, SK_OFFSETOF(BASE_CLASS, f_##attr) } 1.31 +#define SVG_LITERAL_ATTRIBUTE(svgAttr, cAttr) { #svgAttr, SK_OFFSETOF(BASE_CLASS, cAttr) } 1.32 +#else 1.33 +#define SVG_ATTRIBUTE(attr) { #attr } 1.34 +#define SVG_LITERAL_ATTRIBUTE(svgAttr, cAttr) { #svgAttr } 1.35 +#endif 1.36 + 1.37 +#define SVG_ADD_ATTRIBUTE(attr) \ 1.38 + if (f_##attr.size() > 0) \ 1.39 + parser._addAttributeLen(#attr, f_##attr.c_str(), f_##attr.size()) 1.40 + 1.41 +#define SVG_ADD_ATTRIBUTE_ALIAS(attr, alias) \ 1.42 + if (f_##alias.size() > 0) \ 1.43 + parser._addAttributeLen(#attr, f_##alias.c_str(), f_##alias.size()) 1.44 + 1.45 +#endif // SkSVGAttribute_DEFINED