virtual SkScalar next(SkPath* dst, SkScalar distance, SkPathMeasure& ) { fMaker->setExtraPropertyCallBack(fDraw->fType, GetDistance, &distance); SkDrawPath* drawPath = NULL; if (fDraw->addPath->isPath()) { drawPath = (SkDrawPath*) fDraw->addPath; } else { SkApply* apply = (SkApply*) fDraw->addPath; apply->refresh(*fMaker); apply->activate(*fMaker); apply->interpolate(*fMaker, SkScalarMulRound(distance, 1000)); drawPath = (SkDrawPath*) apply->getScope(); } SkMatrix m; m.reset(); if (fDraw->addMatrix) { SkDrawMatrix* matrix; if (fDraw->addMatrix->getType() == SkType_Matrix) matrix = (SkDrawMatrix*) fDraw->addMatrix; else { SkApply* apply = (SkApply*) fDraw->addMatrix; apply->refresh(*fMaker); apply->activate(*fMaker); apply->interpolate(*fMaker, SkScalarMulRound(distance, 1000)); matrix = (SkDrawMatrix*) apply->getScope(); } } SkScalar result = 0; SkAnimatorScript::EvaluateFloat(*fMaker, NULL, fDraw->spacing.c_str(), &result); if (drawPath) dst->addPath(drawPath->getPath(), m); fMaker->clearExtraPropertyCallBack(fDraw->fType); return result; }
void SkApply::enableCreate(SkAnimateMaker& maker) { SkString newID; for (int step = 0; step <= steps; step++) { fLastTime = step * SK_MSec1; bool success = maker.computeID(scope, this, &newID); if (success == false) return; if (maker.find(newID.c_str(), NULL)) continue; SkApply* copy = (SkApply*) deepCopy(&maker); // work on copy of animator state if (mode == kMode_create) copy->mode = (Mode) -1; SkDrawable* copyScope = copy->scope = (SkDrawable*) scope->deepCopy(&maker); *fScopes.append() = copyScope; if (copyScope->resolveIDs(maker, scope, this)) { step = steps; // quit goto next; // resolveIDs failed } if (newID.size() > 0) maker.setID(copyScope, newID); if (copy->resolveIDs(maker, this, this)) { // fix up all fields, including target step = steps; // quit goto next; // resolveIDs failed } copy->activate(maker); copy->interpolate(maker, step * SK_MSec1); maker.removeActive(copy->fActive); next: delete copy; } }
void SkAnimateMaker::doDelayedEvent() { fEnableTime = getAppTime(); for (int index = 0; index < fDelayed.count(); ) { SkDisplayable* child = fDelayed[index]; SkASSERT(child->isApply()); SkApply* apply = (SkApply*) child; apply->interpolate(*this, fEnableTime); if (apply->hasDelayedAnimator()) index++; else fDelayed.remove(index); } }
virtual void next(const SkPoint& loc, int u, int v, SkPath* dst) { fLoc = loc; fU = u; fV = v; SkDrawPath* drawPath; fMaker->setExtraPropertyCallBack(fDraw->fType, Get2D, this); if (fDraw->addPath->isPath()) { drawPath = (SkDrawPath*) fDraw->addPath; } else { SkApply* apply = (SkApply*) fDraw->addPath; apply->refresh(*fMaker); apply->activate(*fMaker); apply->interpolate(*fMaker, v); drawPath = (SkDrawPath*) apply->getScope(); } if (drawPath == NULL) goto clearCallBack; if (fDraw->matrix) { SkDrawMatrix* matrix; if (fDraw->matrix->getType() == SkType_Matrix) matrix = (SkDrawMatrix*) fDraw->matrix; else { SkApply* apply = (SkApply*) fDraw->matrix; apply->activate(*fMaker); apply->interpolate(*fMaker, v); matrix = (SkDrawMatrix*) apply->getScope(); } if (matrix) { dst->addPath(drawPath->getPath(), matrix->getMatrix()); goto clearCallBack; } } dst->addPath(drawPath->getPath()); clearCallBack: fMaker->clearExtraPropertyCallBack(fDraw->fType); }