本文整理汇总了C++中SkString::prepend方法的典型用法代码示例。如果您正苦于以下问题:C++ SkString::prepend方法的具体用法?C++ SkString::prepend怎么用?C++ SkString::prepend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkString
的用法示例。
在下文中一共展示了SkString::prepend方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setInnerError
void SkDisplayXMLParserError::setInnerError(SkAnimateMaker* parent, const SkString& src) {
SkString inner;
getErrorString(&inner);
inner.prepend(": ");
inner.prependS32(getLineNumber());
inner.prepend(", line ");
inner.prepend(src);
parent->setErrorNoun(inner);
}
示例2: updateTitle
void SampleWindow::updateTitle() {
SkString title;
SkView::F2BIter iter(this);
SkView* view = iter.next();
SkEvent evt(gTitleEvtName);
if (view->doQuery(&evt)) {
title.set(evt.findString(gTitleEvtName));
}
if (title.size() == 0) {
title.set("<unknown>");
}
title.prepend(gCanvasTypePrefix[fCanvasType]);
title.prepend(" ");
title.prepend(configToString(this->getBitmap().config()));
if (fAnimating) {
title.prepend("<A> ");
}
if (fScale) {
title.prepend("<S> ");
}
if (fRotate) {
title.prepend("<R> ");
}
if (fNClip) {
title.prepend("<C> ");
}
this->setTitle(title.c_str());
}
示例3: HandleMessage
virtual void HandleMessage(const pp::Var& var_message) {
// Receive a message from javascript.
if (var_message.is_string()) {
SkString msg(var_message.AsString().c_str());
if (msg.startsWith("init")) {
} else if (msg.startsWith("LoadSKP")) {
size_t startIndex = strlen("LoadSKP");
size_t dataSize = msg.size()/sizeof(char) - startIndex;
SkBase64 decodedData;
decodedData.decode(msg.c_str() + startIndex, dataSize);
size_t decodedSize = 3 * (dataSize / 4);
SkDebugf("Got size: %d\n", decodedSize);
if (!decodedData.getData()) {
SkDebugf("Failed to decode SKP\n");
return;
}
SkMemoryStream pictureStream(decodedData.getData(), decodedSize);
SkPicture* picture = SkPicture::CreateFromStream(&pictureStream);
if (NULL == picture) {
SkDebugf("Failed to create SKP.\n");
return;
}
fDebugger.loadPicture(picture);
picture->unref();
// Set up the command list.
SkTArray<SkString>* commands = fDebugger.getDrawCommandsAsStrings();
PostMessage("ClearCommands");
for (int i = 0; i < commands->count(); ++i) {
SkString addCommand("AddCommand:");
addCommand.append((*commands)[i]);
PostMessage(addCommand.c_str());
}
PostMessage("UpdateCommands");
// Set the overview text.
SkString overviewText;
fDebugger.getOverviewText(NULL, 0.0, &overviewText, 1);
overviewText.prepend("SetOverview:");
PostMessage(overviewText.c_str());
// Draw the SKP.
if (!fFlushLoopRunning) {
Paint();
}
} else if (msg.startsWith("CommandSelected:")) {
size_t startIndex = strlen("CommandSelected:");
int index = atoi(msg.c_str() + startIndex);
fDebugger.setIndex(index);
if (!fFlushLoopRunning) {
Paint();
}
} else if (msg.startsWith("Rewind")) {
fCanvas->clear(SK_ColorWHITE);
fDebugger.setIndex(0);
if (!fFlushLoopRunning) {
Paint();
}
} else if (msg.startsWith("StepBack")) {
fCanvas->clear(SK_ColorWHITE);
int currentIndex = fDebugger.index();
if (currentIndex > 1) {
fDebugger.setIndex(currentIndex - 1);
if (!fFlushLoopRunning) {
Paint();
}
}
} else if (msg.startsWith("Pause")) {
// TODO(borenet)
} else if (msg.startsWith("StepForward")) {
int currentIndex = fDebugger.index();
if (currentIndex < fDebugger.getSize() -1) {
fDebugger.setIndex(currentIndex + 1);
if (!fFlushLoopRunning) {
Paint();
}
}
} else if (msg.startsWith("Play")) {
fDebugger.setIndex(fDebugger.getSize() - 1);
if (!fFlushLoopRunning) {
Paint();
}
}
}
}