1ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com 2ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com/* 3ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Copyright 2006 The Android Open Source Project 4ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * 5ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Use of this source code is governed by a BSD-style license that can be 6ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * found in the LICENSE file. 7ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com */ 8ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com 98a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef SkDisplayType_DEFINED 118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define SkDisplayType_DEFINED 128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkMath.h" 148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkScalar.h" 158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifdef SK_DEBUG 177886ad3de1aa523d5c71f1fa9f355dfcb2412d1dreed@google.com #define SK_DUMP_ENABLED 188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #ifdef SK_BUILD_FOR_MAC 198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #define SK_FIND_LEAKS 208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com #endif 218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define SK_LITERAL_STR_EQUAL(str, token, len) (sizeof(str) - 1 == len \ 248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com && strncmp(str, token, sizeof(str) - 1) == 0) 258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass SkAnimateMaker; 278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass SkDisplayable; 288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comstruct SkMemberInfo; 298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comenum SkDisplayTypes { 318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Unknown, 328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Math, // for ecmascript compatible Math functions and constants 338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Number, // for for ecmascript compatible Number functions and constants 348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Add, 358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_AddCircle, 368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_AddGeom, 378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_AddMode, 388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_AddOval, 398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_AddPath, 408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_AddRect, // path part 418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_AddRoundRect, 428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Align, 438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Animate, 448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_AnimateBase, // base type for animate, set 458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Apply, 468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_ApplyMode, 478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_ApplyTransition, 488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Array, 498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_ARGB, 508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Base64, 518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_BaseBitmap, 528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_BaseClassInfo, 538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Bitmap, 548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_BitmapEncoding, 558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_BitmapFormat, 568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_BitmapShader, 578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Blur, 588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Boolean, // can have values -1 (uninitialized), 0, 1 598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Boundable, 608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Bounds, 618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Cap, 628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Clear, 638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Clip, 648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Close, 658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Color, 668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_CubicTo, 678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Dash, 688d0b5770f8fcfdeb8ad9808e58c49116f14b6190reed@google.com SkType_DataInput, 698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Discrete, 708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Displayable, 718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Drawable, 728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_DrawTo, 738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Dump, 748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_DynamicString, // evaluate at draw time 758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Emboss, 768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Event, 778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_EventCode, 788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_EventKind, 798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_EventMode, 808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_FillType, 818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_FilterType, 828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Float, 838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_FontStyle, 848a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_FromPath, 858a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_FromPathMode, 868a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Full, 8799547767e9cdabcdae6a575f0f6bfde01d809865rileya@google.com SkType_DrawGradient, 888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Group, 898a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_HitClear, 908a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_HitTest, 91bdae027bd86b7900d1874ad77f0ec9e31f6cbcabreed@google.com SkType_ImageBaseBitmap, 928a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Include, 938a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Input, 948a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Int, 958a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Join, 968a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Line, // simple line primitive 978a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_LineTo, // used as part of path construction 9899547767e9cdabcdae6a575f0f6bfde01d809865rileya@google.com SkType_DrawLinearGradient, 998a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_MaskFilter, 1008a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_MaskFilterBlurStyle, 1018a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_MaskFilterLight, 1028a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Matrix, 1038a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_MemberFunction, 1048a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_MemberProperty, 1058a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Move, 1068a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_MoveTo, 1078a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Movie, 1088a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_MSec, 1098a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Oval, 1108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Paint, 1118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Path, 1128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_PathDirection, 1138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_PathEffect, 1148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Point, // used inside other structures, no vtable 1158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_DrawPoint, // used to draw points, has a vtable 1168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_PolyToPoly, 1178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Polygon, 1188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Polyline, 1198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Post, 1208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_QuadTo, 1218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_RCubicTo, 1228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_RLineTo, 1238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_RMoveTo, 1248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_RQuadTo, 12599547767e9cdabcdae6a575f0f6bfde01d809865rileya@google.com SkType_DrawRadialGradient, 1268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Random, 1278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Rect, 1288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_RectToRect, 1298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Remove, 1308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Replace, 1318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Rotate, 1328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_RoundRect, 1338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Save, 1348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_SaveLayer, 1358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Scale, 1368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Screenplay, 1378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Set, 1388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Shader, 1398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Skew, 1408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_3D_Camera, 1418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_3D_Patch, 1428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_3D_Point, 1438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Snapshot, 1448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_String, // pointer to SkString 1458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Style, 1468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Text, 1478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_TextBox, 1488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_TextBoxAlign, 1498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_TextBoxMode, 1508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_TextOnPath, 1518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_TextToPath, 1528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_TileMode, 1538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Translate, 1548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_TransparentShader, 1558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Typeface, 1568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkType_Xfermode, 1578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com kNumberOfTypes 1588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}; 1598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comstruct TypeNames { 1618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com const char* fName; 1628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDisplayTypes fType; 1638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#if defined SK_DEBUG || defined SK_BUILD_CONDENSED 1648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com bool fDrawPrefix; 1658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com bool fDisplayPrefix; 1668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 1678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}; 1688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifdef SK_DEBUG 1708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comtypedef SkDisplayTypes SkFunctionParamType; 1718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#else 1728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comtypedef unsigned char SkFunctionParamType; 1738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 1748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comextern const TypeNames gTypeNames[]; 1768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comextern const int kTypeNamesSize; 1778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass SkDisplayType { 1798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.compublic: 1808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com static SkDisplayTypes Find(SkAnimateMaker* , const SkMemberInfo* ); 1818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com static const SkMemberInfo* GetMember(SkAnimateMaker* , SkDisplayTypes , const char** ); 1828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com static const SkMemberInfo* GetMembers(SkAnimateMaker* , SkDisplayTypes , int* infoCountPtr); 1838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com static SkDisplayTypes GetParent(SkAnimateMaker* , SkDisplayTypes ); 1848a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com static bool IsDisplayable(SkAnimateMaker* , SkDisplayTypes ); 1858a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com static bool IsEnum(SkAnimateMaker* , SkDisplayTypes ); 1868a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com static bool IsStruct(SkAnimateMaker* , SkDisplayTypes ); 1878a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com static SkDisplayTypes RegisterNewType(); 1888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com static SkDisplayTypes Resolve(const char[] , const SkMemberInfo** ); 1898a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifdef SK_DEBUG 190d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com static bool IsAnimate(SkDisplayTypes type ) { return type == SkType_Animate || 1918a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com type == SkType_Set; } 1928a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com static const char* GetName(SkAnimateMaker* , SkDisplayTypes ); 1938a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 1948a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifdef SK_SUPPORT_UNITTEST 1958a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com static void UnitTest(); 1968a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 1978a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#if defined SK_DEBUG || defined SK_BUILD_CONDENSED 1988a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com static void BuildCondensedInfo(SkAnimateMaker* ); 1998a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 2008a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com static SkDisplayTypes GetType(SkAnimateMaker* , const char[] , size_t len); 2018a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com static SkDisplayable* CreateInstance(SkAnimateMaker* , SkDisplayTypes ); 2028a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comprivate: 2038a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com static SkDisplayTypes gNewTypes; 2048a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}; 2058a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 2068a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif // SkDisplayType_DEFINED 207