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#include "SkDisplayType.h"
118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkAnimateMaker.h"
128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkAnimateSet.h"
138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDisplayAdd.h"
148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDisplayApply.h"
158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDisplayBounds.h"
168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDisplayEvent.h"
178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDisplayInclude.h"
188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifdef SK_DEBUG
198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDisplayList.h"
208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif
218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDisplayMath.h"
228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDisplayMovie.h"
238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDisplayNumber.h"
248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDisplayPost.h"
258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDisplayRandom.h"
268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDisplayTypes.h"
278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDraw3D.h"
288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDrawBitmap.h"
298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDrawClip.h"
308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDrawDash.h"
318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDrawDiscrete.h"
328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDrawEmboss.h"
338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDrawFull.h"
348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDrawGradient.h"
358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDrawLine.h"
368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDrawMatrix.h"
378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDrawOval.h"
388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDrawPaint.h"
398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDrawPath.h"
408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDrawPoint.h"
418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDrawSaveLayer.h"
428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDrawText.h"
438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDrawTextBox.h"
448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDrawTo.h"
458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDrawTransparentShader.h"
468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDump.h"
478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkExtras.h"
488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkHitClear.h"
498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkHitTest.h"
508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkMatrixParts.h"
518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkPathParts.h"
528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkPostParts.h"
538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkSnapshot.h"
548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkTextOnPath.h"
558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkTextToPath.h"
568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkTSearch.h"
578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define CASE_NEW(_class) \
598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    case SkType_##_class: result = new Sk##_class(); break
608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define CASE_DRAW_NEW(_class) \
618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    case SkType_##_class: result = new SkDraw##_class(); break
628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define CASE_DISPLAY_NEW(_class) \
638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    case SkType_##_class: result = new SkDisplay##_class(); break
648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifdef SK_DEBUG
658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    #define CASE_DEBUG_RETURN_NIL(_class) \
668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_##_class: return NULL
678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#else
688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    #define CASE_DEBUG_RETURN_NIL(_class)
698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif
70d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com
718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comSkDisplayTypes SkDisplayType::gNewTypes = kNumberOfTypes;
738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comSkDisplayable* SkDisplayType::CreateInstance(SkAnimateMaker* maker, SkDisplayTypes type) {
758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkDisplayable* result = NULL;
768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    switch (type) {
778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // unknown
788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DISPLAY_NEW(Math);
798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DISPLAY_NEW(Number);
808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(Add);
818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(AddCircle);
828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // addgeom
838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DEBUG_RETURN_NIL(AddMode);
848a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(AddOval);
858a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(AddPath);
868a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(AddRect);
878a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(AddRoundRect);
888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DEBUG_RETURN_NIL(Align);
898a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(Animate);
908a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // animatebase
918a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(Apply);
928a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DEBUG_RETURN_NIL(ApplyMode);
938a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DEBUG_RETURN_NIL(ApplyTransition);
948a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DISPLAY_NEW(Array);
958a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // argb
968a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // base64
978a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // basebitmap
988a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // baseclassinfo
998a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DRAW_NEW(Bitmap);
1008a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // bitmapencoding
1018a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // bitmapformat
1028a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DRAW_NEW(BitmapShader);
1038a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DRAW_NEW(Blur);
1048a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DISPLAY_NEW(Boolean);
1058a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // boundable
1068a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DISPLAY_NEW(Bounds);
1078a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DEBUG_RETURN_NIL(Cap);
1088a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(Clear);
1098a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DRAW_NEW(Clip);
1108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(Close);
1118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DRAW_NEW(Color);
1128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(CubicTo);
1138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(Dash);
1148d0b5770f8fcfdeb8ad9808e58c49116f14b6190reed@google.com        CASE_NEW(DataInput);
1158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(Discrete);
1168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // displayable
1178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // drawable
1188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(DrawTo);
1198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(Dump);
1208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // dynamicstring
1218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DRAW_NEW(Emboss);
1228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DISPLAY_NEW(Event);
1238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DEBUG_RETURN_NIL(EventCode);
1248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DEBUG_RETURN_NIL(EventKind);
1258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DEBUG_RETURN_NIL(EventMode);
1268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // filltype
1278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // filtertype
1288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DISPLAY_NEW(Float);
1298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(FromPath);
1308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DEBUG_RETURN_NIL(FromPathMode);
1318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(Full);
1328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // gradient
1338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(Group);
1348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(HitClear);
1358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(HitTest);
136bdae027bd86b7900d1874ad77f0ec9e31f6cbcabreed@google.com        CASE_NEW(ImageBaseBitmap);
1378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(Include);
1388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(Input);
1398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DISPLAY_NEW(Int);
1408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DEBUG_RETURN_NIL(Join);
1418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(Line);
1428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(LineTo);
14399547767e9cdabcdae6a575f0f6bfde01d809865rileya@google.com        CASE_NEW(DrawLinearGradient);
1448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DRAW_NEW(MaskFilter);
1458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DEBUG_RETURN_NIL(MaskFilterBlurStyle);
1468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // maskfilterlight
1478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DRAW_NEW(Matrix);
1488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // memberfunction
1498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // memberproperty
1508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(Move);
1518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(MoveTo);
1528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DISPLAY_NEW(Movie);
1538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // msec
1548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(Oval);
1558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DRAW_NEW(Paint);
1568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DRAW_NEW(Path);
1578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // pathdirection
1588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DRAW_NEW(PathEffect);
1598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // point
1608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(DrawPoint);
1618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(PolyToPoly);
1628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(Polygon);
1638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(Polyline);
1648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(Post);
1658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(QuadTo);
1668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(RCubicTo);
1678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(RLineTo);
1688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(RMoveTo);
1698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(RQuadTo);
17099547767e9cdabcdae6a575f0f6bfde01d809865rileya@google.com        CASE_NEW(DrawRadialGradient);
1718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DISPLAY_NEW(Random);
1728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DRAW_NEW(Rect);
1738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(RectToRect);
1748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(Remove);
1758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(Replace);
1768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(Rotate);
1778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(RoundRect);
1788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(Save);
1798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(SaveLayer);
1808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(Scale);
1818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // screenplay
1828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(Set);
1838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DRAW_NEW(Shader);
1848a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(Skew);
1858a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(3D_Camera);
1868a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(3D_Patch);
1878a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // 3dpoint
1888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(Snapshot);
1898a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DISPLAY_NEW(String);
1908a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // style
1918a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(Text);
1928a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DRAW_NEW(TextBox);
1938a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // textboxalign
1948a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // textboxmode
1958a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(TextOnPath);
1968a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(TextToPath);
1978a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DEBUG_RETURN_NIL(TileMode);
1988a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_NEW(Translate);
1998a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DRAW_NEW(TransparentShader);
2008a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DRAW_NEW(Typeface);
2018a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_DEBUG_RETURN_NIL(Xfermode);
2028a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        default:
2038a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            SkExtras** end = maker->fExtras.end();
2048a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            for (SkExtras** extraPtr = maker->fExtras.begin(); extraPtr < end; extraPtr++) {
2058a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                if ((result = (*extraPtr)->createInstance(type)) != NULL)
2068a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                    return result;
2078a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            }
2088a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            SkASSERT(0);
2098a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
2108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    return result;
2118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}
2128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#undef CASE_NEW
2148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#undef CASE_DRAW_NEW
2158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#undef CASE_DISPLAY_NEW
2168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#if SK_USE_CONDENSED_INFO == 0
2188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define CASE_GET_INFO(_class) case SkType_##_class: \
2208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    info = Sk##_class::fInfo; infoCount = Sk##_class::fInfoCount; break
2218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define CASE_GET_DRAW_INFO(_class) case SkType_##_class: \
2228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    info = SkDraw##_class::fInfo; infoCount = SkDraw##_class::fInfoCount; break
2238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define CASE_GET_DISPLAY_INFO(_class) case SkType_##_class: \
2248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    info = SkDisplay##_class::fInfo; infoCount = SkDisplay##_class::fInfoCount; \
2258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    break
2268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
227d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.comconst SkMemberInfo* SkDisplayType::GetMembers(SkAnimateMaker* maker,
2288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        SkDisplayTypes type, int* infoCountPtr) {
2298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    const SkMemberInfo* info = NULL;
2308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    int infoCount = 0;
2318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    switch (type) {
2328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // unknown
2338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_DISPLAY_INFO(Math);
2348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_DISPLAY_INFO(Number);
2358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(Add);
2368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(AddCircle);
2378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(AddGeom);
2388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // addmode
2398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(AddOval);
2408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(AddPath);
2418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(AddRect);
2428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(AddRoundRect);
2438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // align
2448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(Animate);
2458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(AnimateBase);
2468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(Apply);
2478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // applymode
2488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // applytransition
2498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_DISPLAY_INFO(Array);
2508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // argb
2518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // base64
2528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(BaseBitmap);
2538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // baseclassinfo
2548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_DRAW_INFO(Bitmap);
2558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // bitmapencoding
2568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // bitmapformat
2578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_DRAW_INFO(BitmapShader);
2588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_DRAW_INFO(Blur);
2598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_DISPLAY_INFO(Boolean);
2608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // boundable
2618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_DISPLAY_INFO(Bounds);
2628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // cap
2638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // clear
2648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_DRAW_INFO(Clip);
2658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // close
2668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_DRAW_INFO(Color);
2678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(CubicTo);
2688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(Dash);
2698d0b5770f8fcfdeb8ad9808e58c49116f14b6190reed@google.com        CASE_GET_INFO(DataInput);
2708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(Discrete);
2718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // displayable
2728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // drawable
2738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(DrawTo);
2748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(Dump);
2758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // dynamicstring
2768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_DRAW_INFO(Emboss);
2778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_DISPLAY_INFO(Event);
2788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // eventcode
2798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // eventkind
2808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // eventmode
2818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // filltype
2828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // filtertype
2838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_DISPLAY_INFO(Float);
2848a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(FromPath);
2858a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // frompathmode
2868a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // full
28799547767e9cdabcdae6a575f0f6bfde01d809865rileya@google.com        CASE_GET_INFO(DrawGradient);
2888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(Group);
2898a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(HitClear);
2908a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(HitTest);
291bdae027bd86b7900d1874ad77f0ec9e31f6cbcabreed@google.com        CASE_GET_INFO(ImageBaseBitmap);
2928a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(Include);
2938a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(Input);
2948a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_DISPLAY_INFO(Int);
2958a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // join
2968a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(Line);
2978a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(LineTo);
29899547767e9cdabcdae6a575f0f6bfde01d809865rileya@google.com        CASE_GET_INFO(DrawLinearGradient);
2998a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // maskfilter
3008a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // maskfilterblurstyle
3018a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // maskfilterlight
3028a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_DRAW_INFO(Matrix);
3038a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // memberfunction
3048a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // memberproperty
3058a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(Move);
3068a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(MoveTo);
3078a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_DISPLAY_INFO(Movie);
3088a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // msec
3098a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(Oval);
3108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_DRAW_INFO(Path);
3118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_DRAW_INFO(Paint);
3128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // pathdirection
3138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // patheffect
3148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Point: info = Sk_Point::fInfo; infoCount = Sk_Point::fInfoCount; break; // no virtual flavor
3158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(DrawPoint); // virtual flavor
3168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(PolyToPoly);
3178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(Polygon);
3188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(Polyline);
3198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(Post);
3208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(QuadTo);
3218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(RCubicTo);
3228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(RLineTo);
3238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(RMoveTo);
3248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(RQuadTo);
32599547767e9cdabcdae6a575f0f6bfde01d809865rileya@google.com        CASE_GET_INFO(DrawRadialGradient);
3268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_DISPLAY_INFO(Random);
3278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_DRAW_INFO(Rect);
3288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(RectToRect);
3298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(Remove);
3308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(Replace);
3318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(Rotate);
3328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(RoundRect);
3338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(Save);
3348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(SaveLayer);
3358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(Scale);
3368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // screenplay
3378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(Set);
3388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_DRAW_INFO(Shader);
3398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(Skew);
3408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(3D_Camera);
3418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(3D_Patch);
3428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(3D_Point);
3438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(Snapshot);
3448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_DISPLAY_INFO(String);
3458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // style
3468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(Text);
3478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_DRAW_INFO(TextBox);
3488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // textboxalign
3498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // textboxmode
3508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(TextOnPath);
3518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(TextToPath);
3528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // tilemode
3538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_INFO(Translate);
3548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // transparentshader
3558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        CASE_GET_DRAW_INFO(Typeface);
3568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // xfermode
3578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        // knumberoftypes
358d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com        default:
3598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            if (maker) {
3608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                SkExtras** end = maker->fExtras.end();
3618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                for (SkExtras** extraPtr = maker->fExtras.begin(); extraPtr < end; extraPtr++) {
3628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                    if ((info = (*extraPtr)->getMembers(type, infoCountPtr)) != NULL)
3638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                        return info;
3648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                }
3658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            }
3668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            return NULL;
3678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
3688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    if (infoCountPtr)
3698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        *infoCountPtr = infoCount;
3708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    return info;
3718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}
3728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
373d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.comconst SkMemberInfo* SkDisplayType::GetMember(SkAnimateMaker* maker,
3748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        SkDisplayTypes type, const char** matchPtr ) {
3754324c3ba707a567d45628b80073c2e44d2d0e4e4commit-bot@chromium.org    int infoCount = 0;  // Initialize to remove a warning.
3768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    const SkMemberInfo* info = GetMembers(maker, type, &infoCount);
3778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    info = SkMemberInfo::Find(info, infoCount, matchPtr);
3788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com//  SkASSERT(info);
3798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    return info;
3808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}
3818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
3828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#undef CASE_GET_INFO
3838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#undef CASE_GET_DRAW_INFO
3848a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#undef CASE_GET_DISPLAY_INFO
3858a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
3868a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif // SK_USE_CONDENSED_INFO == 0
3878a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
3888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#if defined SK_DEBUG || defined SK_BUILD_CONDENSED
3898a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    #define DRAW_NAME(_name, _type) {_name, _type, true, false }
3908a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    #define DISPLAY_NAME(_name, _type) {_name, _type, false, true }
3918a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    #define INIT_BOOL_FIELDS    , false, false
3928a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#else
3938a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    #define DRAW_NAME(_name, _type) {_name, _type }
3948a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    #define DISPLAY_NAME(_name, _type) {_name, _type }
3958a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    #define INIT_BOOL_FIELDS
3968a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif
3978a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
3988a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comconst TypeNames gTypeNames[] = {
3998a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // unknown
4008a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "Math", SkType_Math                       INIT_BOOL_FIELDS },
4018a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "Number", SkType_Number                   INIT_BOOL_FIELDS },
4028a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "add", SkType_Add                         INIT_BOOL_FIELDS },
4038a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "addCircle", SkType_AddCircle             INIT_BOOL_FIELDS },
4048a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // addgeom
4058a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // addmode
4068a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "addOval", SkType_AddOval                 INIT_BOOL_FIELDS },
4078a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "addPath", SkType_AddPath                 INIT_BOOL_FIELDS },
4088a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "addRect", SkType_AddRect                 INIT_BOOL_FIELDS },
4098a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "addRoundRect", SkType_AddRoundRect       INIT_BOOL_FIELDS },
4108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // align
4118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "animate", SkType_Animate                 INIT_BOOL_FIELDS },
4128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // animateBase
4138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "apply", SkType_Apply                     INIT_BOOL_FIELDS },
4148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // applymode
4158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // applytransition
4168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "array", SkType_Array                     INIT_BOOL_FIELDS },
4178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // argb
4188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // base64
4198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // basebitmap
4208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // baseclassinfo
4218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    DRAW_NAME("bitmap", SkType_Bitmap),
4228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // bitmapencoding
4238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // bitmapformat
4248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    DRAW_NAME("bitmapShader", SkType_BitmapShader),
4258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    DRAW_NAME("blur", SkType_Blur),
4268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "boolean", SkType_Boolean                 INIT_BOOL_FIELDS },
4278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // boundable
4288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    DISPLAY_NAME("bounds", SkType_Bounds),
4298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // cap
4308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "clear", SkType_Clear                     INIT_BOOL_FIELDS },
4318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    DRAW_NAME("clip", SkType_Clip),
4328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "close", SkType_Close                     INIT_BOOL_FIELDS },
4338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    DRAW_NAME("color", SkType_Color),
4348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "cubicTo", SkType_CubicTo                 INIT_BOOL_FIELDS },
4358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "dash", SkType_Dash                       INIT_BOOL_FIELDS },
4368d0b5770f8fcfdeb8ad9808e58c49116f14b6190reed@google.com    { "data", SkType_DataInput                  INIT_BOOL_FIELDS },
4378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "discrete", SkType_Discrete               INIT_BOOL_FIELDS },
4388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // displayable
4398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // drawable
4408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "drawTo", SkType_DrawTo                   INIT_BOOL_FIELDS },
4418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "dump", SkType_Dump                       INIT_BOOL_FIELDS },
4428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // dynamicstring
4438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    DRAW_NAME("emboss", SkType_Emboss),
4448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    DISPLAY_NAME("event", SkType_Event),
4458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // eventcode
4468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // eventkind
4478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // eventmode
4488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // filltype
4498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // filtertype
4508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "float", SkType_Float                     INIT_BOOL_FIELDS },
4518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "fromPath", SkType_FromPath               INIT_BOOL_FIELDS },
4528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // frompathmode
4538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "full", SkType_Full                       INIT_BOOL_FIELDS },
4548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // gradient
4558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "group", SkType_Group                     INIT_BOOL_FIELDS },
4568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "hitClear", SkType_HitClear               INIT_BOOL_FIELDS },
4578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "hitTest", SkType_HitTest                 INIT_BOOL_FIELDS },
458bdae027bd86b7900d1874ad77f0ec9e31f6cbcabreed@google.com    { "image", SkType_ImageBaseBitmap           INIT_BOOL_FIELDS },
4598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "include", SkType_Include                 INIT_BOOL_FIELDS },
4608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "input", SkType_Input                     INIT_BOOL_FIELDS },
4618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "int", SkType_Int                         INIT_BOOL_FIELDS },
4628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // join
4638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "line", SkType_Line                       INIT_BOOL_FIELDS },
4648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "lineTo", SkType_LineTo                   INIT_BOOL_FIELDS },
46599547767e9cdabcdae6a575f0f6bfde01d809865rileya@google.com    { "linearGradient", SkType_DrawLinearGradient   INIT_BOOL_FIELDS },
4668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "maskFilter", SkType_MaskFilter           INIT_BOOL_FIELDS },
4678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // maskfilterblurstyle
4688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // maskfilterlight
4698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    DRAW_NAME("matrix", SkType_Matrix),
4708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // memberfunction
4718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // memberproperty
4728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "move", SkType_Move                       INIT_BOOL_FIELDS },
4738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "moveTo", SkType_MoveTo                   INIT_BOOL_FIELDS },
4748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "movie", SkType_Movie                     INIT_BOOL_FIELDS },
4758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // msec
4768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "oval", SkType_Oval                       INIT_BOOL_FIELDS },
4778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    DRAW_NAME("paint", SkType_Paint),
4788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    DRAW_NAME("path", SkType_Path),
4798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // pathdirection
4808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "pathEffect", SkType_PathEffect           INIT_BOOL_FIELDS },
4818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // point
4828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    DRAW_NAME("point", SkType_DrawPoint),
4838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "polyToPoly", SkType_PolyToPoly           INIT_BOOL_FIELDS },
4848a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "polygon", SkType_Polygon                 INIT_BOOL_FIELDS },
4858a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "polyline", SkType_Polyline               INIT_BOOL_FIELDS },
4868a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "post", SkType_Post                       INIT_BOOL_FIELDS },
4878a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "quadTo", SkType_QuadTo                   INIT_BOOL_FIELDS },
4888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "rCubicTo", SkType_RCubicTo               INIT_BOOL_FIELDS },
4898a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "rLineTo", SkType_RLineTo                 INIT_BOOL_FIELDS },
4908a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "rMoveTo", SkType_RMoveTo                 INIT_BOOL_FIELDS },
4918a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "rQuadTo", SkType_RQuadTo                 INIT_BOOL_FIELDS },
49299547767e9cdabcdae6a575f0f6bfde01d809865rileya@google.com    { "radialGradient", SkType_DrawRadialGradient   INIT_BOOL_FIELDS },
4938a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    DISPLAY_NAME("random", SkType_Random),
4948a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "rect", SkType_Rect                       INIT_BOOL_FIELDS },
4958a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "rectToRect", SkType_RectToRect           INIT_BOOL_FIELDS },
4968a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "remove", SkType_Remove                   INIT_BOOL_FIELDS },
4978a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "replace", SkType_Replace                 INIT_BOOL_FIELDS },
4988a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "rotate", SkType_Rotate                   INIT_BOOL_FIELDS },
4998a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "roundRect", SkType_RoundRect             INIT_BOOL_FIELDS },
5008a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "save", SkType_Save                       INIT_BOOL_FIELDS },
5018a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "saveLayer", SkType_SaveLayer             INIT_BOOL_FIELDS },
5028a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "scale", SkType_Scale                     INIT_BOOL_FIELDS },
5038a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // screenplay
5048a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "set", SkType_Set                         INIT_BOOL_FIELDS },
5058a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "shader", SkType_Shader                   INIT_BOOL_FIELDS },
5068a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "skew", SkType_Skew                       INIT_BOOL_FIELDS },
5078a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "skia3d:camera", SkType_3D_Camera         INIT_BOOL_FIELDS },
5088a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "skia3d:patch", SkType_3D_Patch           INIT_BOOL_FIELDS },
5098a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // point
5108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "snapshot", SkType_Snapshot               INIT_BOOL_FIELDS },
5118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "string", SkType_String                   INIT_BOOL_FIELDS },
5128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // style
5138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "text", SkType_Text                       INIT_BOOL_FIELDS },
5148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "textBox", SkType_TextBox                 INIT_BOOL_FIELDS },
5158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // textboxalign
5168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // textboxmode
5178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "textOnPath", SkType_TextOnPath           INIT_BOOL_FIELDS },
5188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "textToPath", SkType_TextToPath           INIT_BOOL_FIELDS },
5198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // tilemode
5208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "translate", SkType_Translate             INIT_BOOL_FIELDS },
5218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    DRAW_NAME("transparentShader", SkType_TransparentShader),
5228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    { "typeface", SkType_Typeface               INIT_BOOL_FIELDS }
5238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // xfermode
5248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // knumberoftypes
5258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com};
5268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
5278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comconst int kTypeNamesSize = SK_ARRAY_COUNT(gTypeNames);
5288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
5298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comSkDisplayTypes SkDisplayType::Find(SkAnimateMaker* maker, const SkMemberInfo* match) {
5308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    for (int index = 0; index < kTypeNamesSize; index++) {
5318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        SkDisplayTypes type = gTypeNames[index].fType;
5328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        const SkMemberInfo* info = SkDisplayType::GetMembers(maker, type, NULL);
5338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        if (info == match)
5348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            return type;
5358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
5368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    return (SkDisplayTypes) -1;
5378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}
5388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
5398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// !!! optimize this by replacing function with a byte-sized lookup table
5408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comSkDisplayTypes SkDisplayType::GetParent(SkAnimateMaker* maker, SkDisplayTypes base) {
5418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    if (base == SkType_Group || base == SkType_Save || base == SkType_SaveLayer)        //!!! cheat a little until we have a lookup table
5428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        return SkType_Displayable;
5438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    if (base == SkType_Set)
5448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        return SkType_Animate;  // another cheat until we have a lookup table
5458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    const SkMemberInfo* info = GetMembers(maker, base, NULL); // get info for this type
5468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkASSERT(info);
5478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    if (info->fType != SkType_BaseClassInfo)
5488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        return SkType_Unknown; // if no base, done
549d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com    // !!! could change SK_MEMBER_INHERITED macro to take type, stuff in offset, so that
5508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // this (and table builder) could know type without the following steps:
5518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    const SkMemberInfo* inherited = info->getInherited();
5528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkDisplayTypes result = (SkDisplayTypes) (SkType_Unknown + 1);
5538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    for (; result <= SkType_Xfermode; result = (SkDisplayTypes) (result + 1)) {
5548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        const SkMemberInfo* match = GetMembers(maker, result, NULL);
5558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        if (match == inherited)
5568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            break;
5578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
5588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkASSERT(result <= SkType_Xfermode);
5598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    return result;
5608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}
5618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
5628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comSkDisplayTypes SkDisplayType::GetType(SkAnimateMaker* maker, const char match[], size_t len ) {
563d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com    int index = SkStrSearch(&gTypeNames[0].fName, kTypeNamesSize, match,
5648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        len, sizeof(gTypeNames[0]));
5658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    if (index >= 0 && index < kTypeNamesSize)
5668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        return gTypeNames[index].fType;
5678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkExtras** end = maker->fExtras.end();
5688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    for (SkExtras** extraPtr = maker->fExtras.begin(); extraPtr < end; extraPtr++) {
5698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        SkDisplayTypes result = (*extraPtr)->getType(match, len);
5708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        if (result != SkType_Unknown)
5718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            return result;
5728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
5738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    return (SkDisplayTypes) -1;
5748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}
5758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
5768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.combool SkDisplayType::IsEnum(SkAnimateMaker* , SkDisplayTypes type) {
5778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    switch (type) {
5788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_AddMode:
5798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Align:
5808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_ApplyMode:
5818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_ApplyTransition:
5828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_BitmapEncoding:
5838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_BitmapFormat:
5848a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Boolean:
5858a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Cap:
5868a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_EventCode:
5878a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_EventKind:
5888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_EventMode:
5898a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_FillType:
5908a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_FilterType:
5918a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_FontStyle:
5928a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_FromPathMode:
5938a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Join:
5948a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_MaskFilterBlurStyle:
5958a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_PathDirection:
5968a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Style:
5978a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_TextBoxAlign:
5988a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_TextBoxMode:
5998a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_TileMode:
6008a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Xfermode:
6018a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            return true;
6028a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        default:    // to avoid warnings
6038a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            break;
6048a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
6058a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    return false;
6068a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}
6078a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
6088a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.combool SkDisplayType::IsDisplayable(SkAnimateMaker* , SkDisplayTypes type) {
6098a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    switch (type) {
6108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Add:
6118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_AddCircle:
6128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_AddOval:
6138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_AddPath:
6148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_AddRect:
6158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_AddRoundRect:
6168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Animate:
6178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_AnimateBase:
6188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Apply:
6198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_BaseBitmap:
6208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Bitmap:
6218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_BitmapShader:
6228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Blur:
6238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Clear:
6248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Clip:
6258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Close:
6268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Color:
6278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_CubicTo:
6288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Dash:
6298d0b5770f8fcfdeb8ad9808e58c49116f14b6190reed@google.com        case SkType_DataInput:
6308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Discrete:
6318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Displayable:
6328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Drawable:
6338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_DrawTo:
6348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Emboss:
6358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Event:
6368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_FromPath:
6378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Full:
6388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Group:
639bdae027bd86b7900d1874ad77f0ec9e31f6cbcabreed@google.com        case SkType_ImageBaseBitmap:
6408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Input:
6418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Line:
6428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_LineTo:
64399547767e9cdabcdae6a575f0f6bfde01d809865rileya@google.com        case SkType_DrawLinearGradient:
6448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Matrix:
6458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Move:
6468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_MoveTo:
6478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Movie:
6488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Oval:
6498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Paint:
6508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Path:
6518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_PolyToPoly:
6528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Polygon:
6538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Polyline:
6548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Post:
6558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_QuadTo:
6568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_RCubicTo:
6578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_RLineTo:
6588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_RMoveTo:
6598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_RQuadTo:
66099547767e9cdabcdae6a575f0f6bfde01d809865rileya@google.com        case SkType_DrawRadialGradient:
6618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Random:
6628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Rect:
6638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_RectToRect:
6648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Remove:
6658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Replace:
6668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Rotate:
6678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_RoundRect:
6688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Save:
6698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_SaveLayer:
6708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Scale:
6718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Set:
6728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Shader:
6738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Skew:
6748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_3D_Camera:
6758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_3D_Patch:
6768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Snapshot:
6778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Text:
6788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_TextBox:
6798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_TextOnPath:
6808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_TextToPath:
6818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Translate:
6828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_TransparentShader:
6838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            return true;
6848a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        default:    // to avoid warnings
6858a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            break;
6868a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
6878a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    return false;
6888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}
6898a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
6908a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.combool SkDisplayType::IsStruct(SkAnimateMaker* , SkDisplayTypes type) {
6918a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    switch (type) {
6928a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_Point:
6938a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        case SkType_3D_Point:
6948a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            return true;
6958a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        default:    // to avoid warnings
6968a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            break;
6978a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
6988a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    return false;
6998a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}
7008a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
7018a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
7028a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comSkDisplayTypes SkDisplayType::RegisterNewType() {
7038a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    gNewTypes = (SkDisplayTypes) (gNewTypes + 1);
7048a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    return gNewTypes;
7058a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}
7068a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
7078a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
7088a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
7098a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifdef SK_DEBUG
7108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comconst char* SkDisplayType::GetName(SkAnimateMaker* maker, SkDisplayTypes type) {
7118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    for (int index = 0; index < kTypeNamesSize - 1; index++) {
7128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        if (gTypeNames[index].fType == type)
7138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            return gTypeNames[index].fName;
7148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
7158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkExtras** end = maker->fExtras.end();
7168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    for (SkExtras** extraPtr = maker->fExtras.begin(); extraPtr < end; extraPtr++) {
7178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        const char* result = (*extraPtr)->getName(type);
7188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        if (result != NULL)
7198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            return result;
7208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
7218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    return NULL;
7228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}
7238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif
7248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
7258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifdef SK_SUPPORT_UNITTEST
7268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid SkDisplayType::UnitTest() {
7278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkAnimator animator;
7288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkAnimateMaker* maker = animator.fMaker;
7298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    int index;
7308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    for (index = 0; index < kTypeNamesSize - 1; index++) {
7318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        SkASSERT(strcmp(gTypeNames[index].fName, gTypeNames[index + 1].fName) < 0);
7328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        SkASSERT(gTypeNames[index].fType < gTypeNames[index + 1].fType);
7338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
7348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    for (index = 0; index < kTypeNamesSize; index++) {
7358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        SkDisplayable* test = CreateInstance(maker, gTypeNames[index].fType);
7368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        if (test == NULL)
7378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            continue;
7388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#if defined _WIN32 && _MSC_VER >= 1300  && defined _INC_CRTDBG // only on windows, only if using "crtdbg.h"
7398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // we know that crtdbg puts 0xfdfdfdfd at the end of the block
7408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // look for unitialized memory, signature 0xcdcdcdcd prior to that
7418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        int* start = (int*) test;
7428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        while (*start != 0xfdfdfdfd) {
7438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            SkASSERT(*start != 0xcdcdcdcd);
7448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            start++;
7458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        }
7468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif
7478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        delete test;
7488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
7498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    for (index = 0; index < kTypeNamesSize; index++) {
7508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        int infoCount;
7518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        const SkMemberInfo* info = GetMembers(maker, gTypeNames[index].fType, &infoCount);
7528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        if (info == NULL)
7538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            continue;
7548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#if SK_USE_CONDENSED_INFO == 0
7558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        for (int inner = 0; inner < infoCount - 1; inner++) {
7568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            if (info[inner].fType == SkType_BaseClassInfo)
7578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                continue;
7588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            SkASSERT(strcmp(info[inner].fName, info[inner + 1].fName) < 0);
7598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        }
7608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif
7618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
7628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#if defined SK_DEBUG || defined SK_BUILD_CONDENSED
7638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    BuildCondensedInfo(maker);
7648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif
7658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}
7668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif
767