本文整理汇总了C++中SkDrawable类的典型用法代码示例。如果您正苦于以下问题:C++ SkDrawable类的具体用法?C++ SkDrawable怎么用?C++ SkDrawable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SkDrawable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SearchForMatch
int SkDisplayList::SearchForMatch(SkDrawable* match, SkTDDrawableArray** list,
SkGroup** parent, SkGroup** found, SkTDDrawableArray**grandList) {
*found = NULL;
for (int index = 0; index < (*list)->count(); index++) {
SkDrawable* draw = (**list)[index];
if (draw == match)
return index;
if (draw->isApply()) {
SkApply* apply = (SkApply*) draw;
if (apply->scope == match)
return index;
if (apply->scope->isGroup() && SearchGroupForMatch(apply->scope, match, list, parent, found, grandList, index))
return index;
if (apply->mode == SkApply::kMode_create) {
for (SkDrawable** ptr = apply->fScopes.begin(); ptr < apply->fScopes.end(); ptr++) {
SkDrawable* scope = *ptr;
if (scope == match)
return index;
//perhaps should call SearchGroupForMatch here as well (on scope)
}
}
}
if (draw->isGroup() && SearchGroupForMatch(draw, match, list, parent, found, grandList, index))
return index;
}
return -1;
}
示例2: initialize
void SkGroup::initialize() {
for (SkDrawable** ptr = fChildren.begin(); ptr < fChildren.end(); ptr++) {
SkDrawable* drawable = *ptr;
if (drawable->isDrawable() == false)
continue;
drawable->initialize();
}
}
示例3: setSteps
void SkGroup::setSteps(int steps) {
for (SkDrawable** ptr = fChildren.begin(); ptr < fChildren.end(); ptr++) {
SkDrawable* drawable = *ptr;
if (drawable->isDrawable() == false)
continue;
drawable->setSteps(steps);
}
}
示例4: contains
bool SkGroup::contains(SkDisplayable* match) {
for (SkDrawable** ptr = fChildren.begin(); ptr < fChildren.end(); ptr++) {
SkDrawable* drawable = *ptr;
if (drawable == match || drawable->contains(match))
return true;
}
return false;
}
示例5: reset
void SkDisplayList::reset() {
for (int index = 0; index < fDrawList.count(); index++) {
SkDrawable* draw = fDrawList[index];
if (draw->isApply() == false)
continue;
SkApply* apply = (SkApply*) draw;
apply->reset();
}
}
示例6: reset
bool SkGroup::enable(SkAnimateMaker& maker ) {
reset();
for (SkDrawable** ptr = fChildren.begin(); ptr < fChildren.end(); ptr++) {
SkDrawable* drawable = *ptr;
if (ifCondition(maker, drawable, enableCondition) == false)
continue;
drawable->enable(maker);
}
return true; // skip add; already added so that scope is findable by children
}
示例7: doEvent
bool SkGroup::doEvent(SkDisplayEvent::Kind kind, SkEventState* state) {
bool handled = false;
for (SkDrawable** ptr = fChildren.begin(); ptr < fChildren.end(); ptr++) {
SkDrawable* drawable = *ptr;
if (drawable->isDrawable() == false)
continue;
handled |= drawable->doEvent(kind, state);
}
return handled;
}
示例8: while
bool SkGroup::resolveIDs(SkAnimateMaker& maker, SkDisplayable* orig, SkApply* apply) {
SkGroup* original = (SkGroup*) orig;
SkTDDrawableArray& originalChildren = original->fChildren;
SkDrawable** originalPtr = originalChildren.begin();
SkDrawable** ptr = fChildren.begin();
SkDrawable** end = fChildren.end();
SkDrawable** origChild = ((SkGroup*) orig)->fChildren.begin();
while (ptr < end) {
SkDrawable* drawable = *ptr++;
maker.resolveID(drawable, *origChild++);
if (drawable->resolveIDs(maker, *originalPtr++, apply) == true)
return true; // failed
}
return false;
}
示例9: ifCondition
bool SkGroup::draw(SkAnimateMaker& maker) {
bool conditionTrue = ifCondition(maker, this, condition);
bool result = false;
for (SkDrawable** ptr = fChildren.begin(); ptr < fChildren.end(); ptr++) {
SkDrawable* drawable = *ptr;
if (drawable->isDrawable() == false)
continue;
if (conditionTrue == false) {
if (drawable->isApply())
((SkApply*) drawable)->disable();
continue;
}
maker.validate();
result |= drawable->draw(maker);
maker.validate();
}
return result;
}
示例10: findGroup
int SkGroup::findGroup(SkDrawable* match, SkTDDrawableArray** list,
SkGroup** parent, SkGroup** found, SkTDDrawableArray** grandList) {
*list = &fChildren;
for (SkDrawable** ptr = fChildren.begin(); ptr < fChildren.end(); ptr++) {
SkDrawable* drawable = *ptr;
if (drawable->isGroup()) {
SkGroup* childGroup = (SkGroup*) drawable;
if (childGroup->fOriginal == match)
goto foundMatch;
}
if (drawable == match) {
foundMatch:
*parent = this;
return (int) (ptr - fChildren.begin());
}
}
*grandList = &fChildren;
return SkDisplayList::SearchForMatch(match, list, parent, found, grandList);
}
示例11: immediate
bool SkActive::immediate(bool enable) {
SkMSec time = 0;
bool result = false;
SkDrawable* drawable = fApply.scope;
SkMSec final = fMaxTime;
do {
bool applied = fAnimators.count() == 0;
fApply.fLastTime = time;
fApply.refresh(fMaker);
for (int index = 0; index < fAnimators.count(); index++) {
SkAnimateBase* animate = fAnimators[index];
SkState& state = fState[index];
if (state.fMode != SkApply::kMode_immediate)
continue;
if (state.fBegin > time)
continue;
if (time > state.fBegin + state.fDuration)
continue;
applied = true;
SkOperandInterpolator& interpolator = *fInterpolators[index];
int count = animate->components();
if (animate->formula.size() > 0) {
SkTDOperandArray values;
values.setCount(count);
bool success = animate->fFieldInfo->setValue(fMaker, &values, 0, 0, NULL,
animate->getValuesType(), animate->formula);
SkASSERT(success);
fApply.applyValues(index, values.begin(), count, animate->getValuesType(), time);
} else {
SkAutoSTMalloc<16, SkOperand> values(count);
interpolator.timeToValues(time, values.get());
fApply.applyValues(index, values.get(), count, animate->getValuesType(), time);
}
}
if (enable)
drawable->enable(fMaker);
else if (applied)
result |= drawable->draw(fMaker);
time += SK_MSec1;
} while (time <= final);
return result;
}
示例12: DEF_TEST
DEF_TEST(FlattenDrawable, r) {
// Create and serialize the test drawable
sk_sp<SkDrawable> drawable(new IntDrawable(1, 2, 3, 4));
SkPaint paint;
paint.setColor(SK_ColorBLUE);
sk_sp<RootDrawable> root(new RootDrawable(5, 6, 7, 8, paint, 9, 10, 11, 12, drawable.get()));
SkBinaryWriteBuffer writeBuffer;
writeBuffer.writeFlattenable(root.get());
// Copy the contents of the write buffer into a read buffer
sk_sp<SkData> data = SkData::MakeUninitialized(writeBuffer.bytesWritten());
writeBuffer.writeToMemory(data->writable_data());
SkReadBuffer readBuffer(data->data(), data->size());
register_test_drawables(readBuffer);
// Deserialize and verify the drawable
sk_sp<SkDrawable> out((SkDrawable*)readBuffer.readFlattenable(SkFlattenable::kSkDrawable_Type));
REPORTER_ASSERT(r, out);
REPORTER_ASSERT(r, !strcmp("RootDrawable", out->getTypeName()));
RootDrawable* rootOut = (RootDrawable*) out.get();
REPORTER_ASSERT(r, 5 == rootOut->compoundDrawable()->intDrawable()->a());
REPORTER_ASSERT(r, 6 == rootOut->compoundDrawable()->intDrawable()->b());
REPORTER_ASSERT(r, 7 == rootOut->compoundDrawable()->intDrawable()->c());
REPORTER_ASSERT(r, 8 == rootOut->compoundDrawable()->intDrawable()->d());
REPORTER_ASSERT(r, SK_ColorBLUE ==
rootOut->compoundDrawable()->paintDrawable()->paint().getColor());
REPORTER_ASSERT(r, 9 == rootOut->intDrawable()->a());
REPORTER_ASSERT(r, 10 == rootOut->intDrawable()->b());
REPORTER_ASSERT(r, 11 == rootOut->intDrawable()->c());
REPORTER_ASSERT(r, 12 == rootOut->intDrawable()->d());
// Note that we can still recognize the generic drawable as an IntDrawable
SkDrawable* generic = rootOut->drawable();
REPORTER_ASSERT(r, !strcmp("IntDrawable", generic->getTypeName()));
IntDrawable* integer = (IntDrawable*) generic;
REPORTER_ASSERT(r, 1 == integer->a());
REPORTER_ASSERT(r, 2 == integer->b());
REPORTER_ASSERT(r, 3 == integer->c());
REPORTER_ASSERT(r, 4 == integer->d());
}
示例13: SkDebugf
void SkGroup::dumpDrawables(SkAnimateMaker* maker) {
SkDisplayList::fIndent += 4;
int save = SkDisplayList::fDumpIndex;
SkDisplayList::fDumpIndex = 0;
bool closedYet = false;
for (SkDrawable** ptr = fChildren.begin(); ptr < fChildren.end(); ptr++) {
if (closedYet == false) {
closedYet = true;
SkDebugf(">\n");
}
SkDrawable* drawable = *ptr;
drawable->dump(maker);
SkDisplayList::fDumpIndex++;
}
SkDisplayList::fIndent -= 4;
SkDisplayList::fDumpIndex = save;
if (closedYet) //we had children, now it's time to close the group
dumpEnd(maker);
else //no children
SkDebugf("/>\n");
}
示例14: validate
bool SkDisplayList::draw(SkAnimateMaker& maker, SkMSec inTime) {
validate();
fInTime = inTime;
bool result = false;
fInvalBounds.setEmpty();
if (fDrawList.count()) {
for (SkActive** activePtr = fActiveList.begin(); activePtr < fActiveList.end(); activePtr++) {
SkActive* active = *activePtr;
active->reset();
}
for (int index = 0; index < fDrawList.count(); index++) {
SkDrawable* draw = fDrawList[index];
draw->initialize(); // allow matrices to reset themselves
SkASSERT(draw->isDrawable());
validate();
result |= draw->draw(maker);
}
}
validate();
return result;
}
示例15: validate
void SkGroup::validate() {
for (SkDrawable** ptr = fChildren.begin(); ptr < fChildren.end(); ptr++) {
SkDrawable* drawable = *ptr;
drawable->validate();
}
}