本文整理汇总了C++中SkString::appendU64方法的典型用法代码示例。如果您正苦于以下问题:C++ SkString::appendU64方法的具体用法?C++ SkString::appendU64怎么用?C++ SkString::appendU64使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkString
的用法示例。
在下文中一共展示了SkString::appendU64方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getDigestValue
SkString GmResultDigest::getDigestValue() const {
// TODO(epoger): The current implementation assumes that the
// result digest is always of type kJsonKey_Hashtype_Bitmap_64bitMD5
SkString retval;
retval.appendU64(fHashDigest);
return retval;
}
示例2: write
/**
* Write the canvas to an image file and/or JSON summary.
*
* @param canvas Must be non-null. Canvas to be written to a file.
* @param writePath If nonempty, write the binary image to a file within this directory.
* @param mismatchPath If nonempty, write the binary image to a file within this directory,
* but only if the image does not match expectations.
* @param inputFilename If we are writing out a binary image, use this to build its filename.
* @param jsonSummaryPtr If not null, add image results (checksum) to this summary.
* @param useChecksumBasedFilenames If true, use checksum-based filenames when writing to disk.
* @param tileNumberPtr If not null, which tile number this image contains.
*
* @return bool True if the operation completed successfully.
*/
static bool write(SkCanvas* canvas, const SkString& writePath, const SkString& mismatchPath,
const SkString& inputFilename, ImageResultsAndExpectations *jsonSummaryPtr,
bool useChecksumBasedFilenames, const int* tileNumberPtr=NULL) {
SkASSERT(canvas != NULL);
if (NULL == canvas) {
return false;
}
SkBitmap bitmap;
SkISize size = canvas->getDeviceSize();
setup_bitmap(&bitmap, size.width(), size.height());
canvas->readPixels(&bitmap, 0, 0);
force_all_opaque(bitmap);
BitmapAndDigest bitmapAndDigest(bitmap);
SkString escapedInputFilename(inputFilename);
replace_char(&escapedInputFilename, '.', '_');
// TODO(epoger): what about including the config type within outputFilename? That way,
// we could combine results of different config types without conflicting filenames.
SkString outputFilename;
const char *outputSubdirPtr = NULL;
if (useChecksumBasedFilenames) {
ImageDigest *imageDigestPtr = bitmapAndDigest.getImageDigestPtr();
outputSubdirPtr = escapedInputFilename.c_str();
outputFilename.set(imageDigestPtr->getHashType());
outputFilename.append("_");
outputFilename.appendU64(imageDigestPtr->getHashValue());
} else {
outputFilename.set(escapedInputFilename);
if (tileNumberPtr) {
outputFilename.append("-tile");
outputFilename.appendS32(*tileNumberPtr);
}
}
outputFilename.append(".png");
if (jsonSummaryPtr) {
ImageDigest *imageDigestPtr = bitmapAndDigest.getImageDigestPtr();
SkString outputRelativePath;
if (outputSubdirPtr) {
outputRelativePath.set(outputSubdirPtr);
outputRelativePath.append("/"); // always use "/", even on Windows
outputRelativePath.append(outputFilename);
} else {
outputRelativePath.set(outputFilename);
}
jsonSummaryPtr->add(inputFilename.c_str(), outputRelativePath.c_str(),
*imageDigestPtr, tileNumberPtr);
if (!mismatchPath.isEmpty() &&
!jsonSummaryPtr->getExpectation(inputFilename.c_str(),
tileNumberPtr).matches(*imageDigestPtr)) {
if (!write_bitmap_to_disk(bitmap, mismatchPath, outputSubdirPtr, outputFilename)) {
return false;
}
}
}
if (writePath.isEmpty()) {
return true;
} else {
return write_bitmap_to_disk(bitmap, writePath, outputSubdirPtr, outputFilename);
}
}