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 "SkDisplayable.h" 118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDisplayApply.h" 128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkParse.h" 138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifdef SK_DEBUG 148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDisplayList.h" 158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDisplayTypes.h" 178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifdef SK_FIND_LEAKS 198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// int SkDisplayable::fAllocationCount; 208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comSkTDDisplayableArray SkDisplayable::fAllocations; 218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifdef SK_DEBUG 24d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.comSkDisplayable::SkDisplayable() { 258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com id = _id.c_str(); 268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifdef SK_FIND_LEAKS 278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com // fAllocationCount++; 288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com *fAllocations.append() = this; 298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comSkDisplayable::~SkDisplayable() { 348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifdef SK_FIND_LEAKS 358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com // fAllocationCount--; 368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com int index = fAllocations.find(this); 378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkASSERT(index >= 0); 388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com fAllocations.remove(index); 398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 421d3c411f5e4d2ad31bc92b3a85957004329ac00dtfarina@chromium.orgbool SkDisplayable::addChild(SkAnimateMaker& , SkDisplayable* child) { 43d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com return false; 448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 46d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com//void SkDisplayable::apply(SkAnimateMaker& , const SkMemberInfo* , 47d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com// SkDisplayable* , SkScalar [], int count) { 48d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com// SkASSERT(0); 498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com//} 508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.combool SkDisplayable::canContainDependents() const { 52d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com return false; 538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 54d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com 55d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.combool SkDisplayable::childrenNeedDisposing() const { 56d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com return false; 578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid SkDisplayable::clearBounder() { 608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.combool SkDisplayable::contains(SkDisplayable* ) { 638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com return false; 648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comSkDisplayable* SkDisplayable::contains(const SkString& ) { 678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com return NULL; 688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comSkDisplayable* SkDisplayable::deepCopy(SkAnimateMaker* maker) { 718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDisplayTypes type = getType(); 728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (type == SkType_Unknown) { 738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkASSERT(0); 748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com return NULL; 758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDisplayable* copy = SkDisplayType::CreateInstance(maker, type); 778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com int index = -1; 788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com int propIndex = 0; 798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com const SkMemberInfo* info; 808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com do { 818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com info = copy->getMember(++index); 828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (info == NULL) 838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 848a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (info->fType == SkType_MemberProperty) { 858a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkScriptValue value; 868a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (getProperty(propIndex, &value)) 878a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com copy->setProperty(propIndex, value); 888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com propIndex++; 898a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com continue; 908a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 918a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (info->fType == SkType_MemberFunction) 928a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com continue; 938a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (info->fType == SkType_Array) { 948a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkTDOperandArray* array = (SkTDOperandArray*) info->memberData(this); 958a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com int arrayCount; 968a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (array == NULL || (arrayCount = array->count()) == 0) 978a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com continue; 988a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkTDOperandArray* copyArray = (SkTDOperandArray*) info->memberData(copy); 998a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com copyArray->setCount(arrayCount); 1008a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDisplayTypes elementType; 1018a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (type == SkType_Array) { 1028a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDisplayArray* dispArray = (SkDisplayArray*) this; 1038a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com elementType = dispArray->values.getType(); 1048a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } else 1058a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com elementType = info->arrayType(); 1068a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com size_t elementSize = SkMemberInfo::GetSize(elementType); 1078a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com size_t byteSize = elementSize * arrayCount; 1088a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com memcpy(copyArray->begin(), array->begin(), byteSize); 1098a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com continue; 1108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 1118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (SkDisplayType::IsDisplayable(maker, info->fType)) { 1128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDisplayable** displayable = (SkDisplayable**) info->memberData(this); 1138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (*displayable == NULL || *displayable == (SkDisplayable*) -1) 1148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com continue; 1158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDisplayable* deeper = (*displayable)->deepCopy(maker); 1168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com info->setMemberData(copy, deeper, sizeof(deeper)); 1178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com continue; 1188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 1198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (info->fType == SkType_String || info->fType == SkType_DynamicString) { 1208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkString* string; 1218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com info->getString(this, &string); 1228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com info->setString(copy, string); 1238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com continue; 1248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 1258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com void* data = info->memberData(this); 1268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com size_t size = SkMemberInfo::GetSize(info->fType); 1278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com info->setMemberData(copy, data, size); 1288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } while (true); 1298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com copy->dirty(); 1308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com return copy; 1318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 1328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid SkDisplayable::dirty() { 1348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 1358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifdef SK_DUMP_ENABLED 1378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid SkDisplayable::dump(SkAnimateMaker* maker) { 1388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com dumpBase(maker); 1398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#if SK_USE_CONDENSED_INFO == 0 1408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com this->dumpAttrs(maker); 1418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com this->dumpChildren(maker); 1428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 1438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 1448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid SkDisplayable::dumpAttrs(SkAnimateMaker* maker) { 1468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDisplayTypes type = getType(); 1478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (type == SkType_Unknown) { 1488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com //SkDebugf("/>\n"); 1498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com return; 1508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 1518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDisplayable* blankCopy = SkDisplayType::CreateInstance(maker, type); 1528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com int index = -1; 1548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com int propIndex = 0; 1558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com const SkMemberInfo* info; 1568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com const SkMemberInfo* blankInfo; 1578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkScriptValue value; 1588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkScriptValue blankValue; 1598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkOperand values[2]; 1608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkOperand blankValues[2]; 1618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com do { 1628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com info = this->getMember(++index); 1638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (NULL == info) { 1648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com //SkDebugf("\n"); 1658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 1668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 1678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (SkType_MemberProperty == info->fType) { 1688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (getProperty(propIndex, &value)) { 1698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com blankCopy->getProperty(propIndex, &blankValue); 1708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com //last two are dummies 1718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com dumpValues(info, value.fType, value.fOperand, blankValue.fOperand, value.fOperand, blankValue.fOperand); 1728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 173d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com 1748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com propIndex++; 1758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com continue; 1768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 1778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (SkDisplayType::IsDisplayable(maker, info->fType)) { 1788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com continue; 1798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 180d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com 1818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (info->fType == SkType_MemberFunction) 1828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com continue; 183d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com 184d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com 1858a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (info->fType == SkType_Array) { 1868a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkTDOperandArray* array = (SkTDOperandArray*) info->memberData(this); 1878a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com int arrayCount; 1888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (array == NULL || (arrayCount = array->count()) == 0) 1898a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com continue; 1908a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDisplayTypes elementType; 1918a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (type == SkType_Array) { 1928a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDisplayArray* dispArray = (SkDisplayArray*) this; 1938a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com elementType = dispArray->values.getType(); 1948a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } else 1958a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com elementType = info->arrayType(); 1968a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com bool firstElem = true; 1978a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf("%s=\"[", info->fName); 1988a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com for (SkOperand* op = array->begin(); op < array->end(); op++) { 1998a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (!firstElem) SkDebugf(","); 2008a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com switch (elementType) { 2018a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SkType_Displayable: 2028a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf("%s", op->fDisplayable->id); 2038a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 204d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com case SkType_Int: 2058a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf("%d", op->fS32); 2068a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 2078a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SkType_Float: 2088a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf("%g", SkScalarToFloat(op->fScalar)); 2098a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 2108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SkType_String: 211d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com case SkType_DynamicString: 2128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf("%s", op->fString->c_str()); 2138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 2148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com default: 2158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 2168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 2178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com firstElem = false; 2188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 2198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf("]\" "); 2208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com continue; 2218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 222d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com 2238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (info->fType == SkType_String || info->fType == SkType_DynamicString) { 2248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkString* string; 2258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com info->getString(this, &string); 2268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (string->isEmpty() == false) 227d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com SkDebugf("%s=\"%s\"\t", info->fName, string->c_str()); 2288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com continue; 2298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 230d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com 231d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com 2328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com blankInfo = blankCopy->getMember(index); 2338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com int i = info->fCount; 2348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com info->getValue(this, values, i); 2358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com blankInfo->getValue(blankCopy, blankValues, i); 2368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com dumpValues(info, info->fType, values[0], blankValues[0], values[1], blankValues[1]); 2378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } while (true); 2388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com delete blankCopy; 2398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 2408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 2418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid SkDisplayable::dumpBase(SkAnimateMaker* maker) { 2428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDisplayTypes type = getType(); 2438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com const char* elementName = "(unknown)"; 2448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (type != SkType_Unknown && type != SkType_Screenplay) 2458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com elementName = SkDisplayType::GetName(maker, type); 2468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf("%*s", SkDisplayList::fIndent, ""); 2478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (SkDisplayList::fDumpIndex != 0 && SkDisplayList::fIndent == 0) 2488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf("%d: ", SkDisplayList::fDumpIndex); 2498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf("<%s ", elementName); 2508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (strcmp(id,"") != 0) 2518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf("id=\"%s\" ", id); 2528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 2538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 2548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid SkDisplayable::dumpChildren(SkAnimateMaker* maker, bool closedAngle) { 255d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com 2568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com int index = -1; 2578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com const SkMemberInfo* info; 2588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com index = -1; 2598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDisplayList::fIndent += 4; 2608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com do { 2618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com info = this->getMember(++index); 2628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (NULL == info) { 2638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 2648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 2658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (SkDisplayType::IsDisplayable(maker, info->fType)) { 2668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDisplayable** displayable = (SkDisplayable**) info->memberData(this); 2678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (*displayable == NULL || *displayable == (SkDisplayable*) -1) 2688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com continue; 2698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (closedAngle == false) { 2708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf(">\n"); 2718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com closedAngle = true; 2728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 2738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com (*displayable)->dump(maker); 2748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 2758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } while (true); 2768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDisplayList::fIndent -= 4; 2778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (closedAngle) 2788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com dumpEnd(maker); 2798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com else 2808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf("/>\n"); 2818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 2828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 2838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid SkDisplayable::dumpEnd(SkAnimateMaker* maker) { 2848a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDisplayTypes type = getType(); 2858a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com const char* elementName = "(unknown)"; 2868a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (type != SkType_Unknown && type != SkType_Screenplay) 2878a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com elementName = SkDisplayType::GetName(maker, type); 2888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf("%*s", SkDisplayList::fIndent, ""); 2898a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf("</%s>\n", elementName); 2908a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 2918a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 2928a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid SkDisplayable::dumpEvents() { 2938a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 2948a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 2958a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid SkDisplayable::dumpValues(const SkMemberInfo* info, SkDisplayTypes type, SkOperand op, SkOperand blankOp, 2968a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkOperand op2, SkOperand blankOp2) { 2978a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com switch (type) { 2988a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SkType_BitmapEncoding: 2998a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com switch (op.fS32) { 3008a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case 0 : SkDebugf("type=\"jpeg\" "); 3018a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 3028a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case 1 : SkDebugf("type=\"png\" "); 3038a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 3048a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com default: SkDebugf("type=\"UNDEFINED\" "); 3058a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 3068a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 3078a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com //should make this a separate case in dump attrs, rather than make dump values have a larger signature 3088a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SkType_Point: 3098a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (op.fScalar != blankOp.fScalar || op2.fScalar != blankOp.fScalar) { 3108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf("%s=\"[%g,%g]\" ", info->fName, SkScalarToFloat(op.fScalar), SkScalarToFloat(op2.fScalar)); 3118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 3128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 3138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SkType_FromPathMode: 3148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com switch (op.fS32) { 3158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case 0: 3168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com //don't want to print anything for 0, just adding it to remove it from default: 3178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 3188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case 1: 3198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf("%s=\"%s\" ", info->fName, "angle"); 3208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 3218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case 2: 3228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf("%s=\"%s\" ", info->fName, "position"); 3238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 3248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com default: 3258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf("%s=\"INVALID\" ", info->fName); 3268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 3278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 3288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SkType_MaskFilterBlurStyle: 3298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com switch (op.fS32) { 3308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case 0: 3318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 3328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case 1: 3338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf("%s=\"%s\" ", info->fName, "solid"); 3348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 3358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case 2: 3368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf("%s=\"%s\" ", info->fName, "outer"); 3378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 3388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case 3: 3398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf("%s=\"%s\" ", info->fName, "inner"); 3408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 3418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com default: 3428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf("%s=\"INVALID\" ", info->fName); 3438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 3448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 3458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SkType_FilterType: 3468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (op.fS32 == 1) 3478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf("%s=\"%s\" ", info->fName, "bilinear"); 3488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 3498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SkType_PathDirection: 3508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf("%s=\"%s\" ", info->fName, op.fS32 == 0 ? "cw" : "ccw"); 3518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 3528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SkType_FillType: 3538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf("%s=\"%s\" ", info->fName, op.fS32 == 0 ? "winding" : "evenOdd"); 3548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 3558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SkType_TileMode: 3568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com //correct to look at the S32? 357d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com if (op.fS32 != blankOp.fS32) 3588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf("%s=\"%s\" ", info->fName, op.fS32 == 0 ? "clamp" : op.fS32 == 1 ? "repeat" : "mirror"); 3598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 3608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SkType_Boolean: 3618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (op.fS32 != blankOp.fS32) 3628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf("%s=\"%s\" ", info->fName, op.fS32 == 0 ? "false" : "true"); 3638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 3648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SkType_Int: 3658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (op.fS32 != blankOp.fS32) 3668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf(" %s=\"%d\" ", info->fName, op.fS32); 3678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 3688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SkType_Float: 3698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (op.fScalar != blankOp.fScalar) { //or /65536? 3708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf("%s=\"%g\" ", info->fName, SkScalarToFloat(op.fScalar)); 3718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 3728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 3738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SkType_String: 3748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SkType_DynamicString: 375d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com if (op.fString->size() > 0) 3768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf("%s=\"%s\" ", info->fName, op.fString->c_str()); 3778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com break; 3788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com case SkType_MSec: 3798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (op.fS32 != blankOp.fS32) { 38080ea19ca4bdd68c1493666a5fe7e4ce9d43ded8breed SkDebugf(" %s=\"%g\" ", info->fName, op.fS32 * 0.001); 3818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 3828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com default: 3838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDebugf(""); 384d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com } 3858a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 3868a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 3878a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 3888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 389d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.combool SkDisplayable::enable( SkAnimateMaker& ) { 3908a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com return false; 3918a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 3928a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 3938a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid SkDisplayable::enableBounder() { 3948a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 3958a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 396d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.comvoid SkDisplayable::executeFunction(SkDisplayable* , int index, 3978a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkTDArray<SkScriptValue>& , SkDisplayTypes, SkScriptValue* ) { 398d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com SkASSERT(0); 3998a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 4008a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 401d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.comvoid SkDisplayable::executeFunction(SkDisplayable* target, 4028a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com const SkMemberInfo* info, SkTypedArray* values, SkScriptValue* value) { 4038a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkTDArray<SkScriptValue> typedValues; 4048a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com for (SkOperand* op = values->begin(); op < values->end(); op++) { 4058a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkScriptValue temp; 4068a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com temp.fType = values->getType(); 4078a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com temp.fOperand = *op; 4088a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com *typedValues.append() = temp; 4098a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 4108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com executeFunction(target, info->functionIndex(), typedValues, info->getType(), value); 4118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 4128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 413d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.comvoid SkDisplayable::executeFunction2(SkDisplayable* , int index, 4148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkOpArray* params, SkDisplayTypes, SkOperand2* ) { 415d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com SkASSERT(0); 4168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 4178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 4188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid SkDisplayable::getBounds(SkRect* rect) { 4198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkASSERT(rect); 4208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com rect->fLeft = rect->fTop = SK_ScalarMax; 4218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com rect->fRight= rect->fBottom = -SK_ScalarMax; 4228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 4238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 4248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comconst SkFunctionParamType* SkDisplayable::getFunctionsParameters() { 4258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com return NULL; 4268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 4278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 428d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.comconst SkMemberInfo* SkDisplayable::getMember(int index) { 429d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com return NULL; 4308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 4318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 432d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.comconst SkMemberInfo* SkDisplayable::getMember(const char name[]) { 433d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com return NULL; 4348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 4358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 436d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.comconst SkFunctionParamType* SkDisplayable::getParameters(const SkMemberInfo* info, 4378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com int* paramCount) { 4388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com const SkFunctionParamType* params = getFunctionsParameters(); 4398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkASSERT(params != NULL); 4408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com int funcIndex = info->functionIndex(); 4418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com // !!! eventually break traversing params into an external function (maybe this whole function) 4428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com int index = funcIndex; 4438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com int offset = 0; 4448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com while (--index >= 0) { 4458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com while (params[offset] != 0) 4468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com offset++; 4478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com offset++; 4488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 4498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com int count = 0; 4508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com while (params[offset] != 0) { 4518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com count++; 4528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com offset++; 4538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 4548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com *paramCount = count; 4558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com return ¶ms[offset - count]; 4568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 4578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 4588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comSkDisplayable* SkDisplayable::getParent() const { 4598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com return NULL; 4608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 4618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 4628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.combool SkDisplayable::getProperty(int index, SkScriptValue* ) const { 463d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com// SkASSERT(0); 464d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com return false; 4658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 4668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 4678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.combool SkDisplayable::getProperty2(int index, SkOperand2* value) const { 468d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com SkASSERT(0); 469d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com return false; 4708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 4718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 472d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.comSkDisplayTypes SkDisplayable::getType() const { 473d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com return SkType_Unknown; 4748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 4758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 4768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.combool SkDisplayable::hasEnable() const { 4778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com return false; 4788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 4798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 4808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.combool SkDisplayable::isDrawable() const { 481d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com return false; 4828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 4838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 4848a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid SkDisplayable::onEndElement(SkAnimateMaker& ) {} 4858a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 4868a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comconst SkMemberInfo* SkDisplayable::preferredChild(SkDisplayTypes type) { 4878a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com return NULL; 4888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 4898a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 4908a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.combool SkDisplayable::resolveIDs(SkAnimateMaker& maker, SkDisplayable* original, SkApply* apply) { 4918a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com return false; 4928a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 4938a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 494d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com//SkDisplayable* SkDisplayable::resolveTarget(SkAnimateMaker& ) { 495d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com// return this; 4968a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com//} 4978a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 4988a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid SkDisplayable::setChildHasID() { 4998a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 5008a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 5018a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.combool SkDisplayable::setParent(SkDisplayable* ) { 5028a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com return false; 5038a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 5048a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 5058a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.combool SkDisplayable::setProperty(int index, SkScriptValue& ) { 506d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com //SkASSERT(0); 507d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com return false; 5088a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 5098a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 5108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid SkDisplayable::setReference(const SkMemberInfo* info, SkDisplayable* displayable) { 5118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if (info->fType == SkType_MemberProperty) { 5128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkScriptValue scriptValue; 5138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com scriptValue.fOperand.fDisplayable = displayable; 5148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com scriptValue.fType = displayable->getType(); 5158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com setProperty(info->propertyIndex(), scriptValue); 5168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } else if (info->fType == SkType_Array) { 5178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkASSERT(displayable->getType() == SkType_Array); 5188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDisplayArray* dispArray = (SkDisplayArray*) displayable; 5198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkTDScalarArray* array = (SkTDScalarArray* ) info->memberData(this); 5208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com array->setCount(dispArray->values.count()); 5218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com memcpy(array->begin(), dispArray->values.begin(), dispArray->values.count() * sizeof(int)); 5228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com // 5238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 5248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com // !!! need a way for interpreter engine to own array 5258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com // !!! probably need to replace all scriptable arrays with single bigger array 5268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com // that has operand and type on every element -- or 5278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com // when array is dirtied, need to get parent to reparse to local array 5288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } else { 5298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com void* storage = info->memberData(this); 5308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com memcpy(storage, &displayable, sizeof(SkDisplayable*)); 5318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 5328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// !!! unclear why displayable is dirtied here 5338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// if this is called, this breaks fromPath.xml 5348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// displayable->dirty(); 5358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 5368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 5378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifdef SK_DEBUG 5388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid SkDisplayable::validate() { 5398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 5408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 541