SkString fName;
public:
DecodeBench(SkColorType ct) : fPrefColorType(ct) {
- SkString fname = SkOSPath::SkBasename(FLAGS_decodeBenchFilename[0]);
+ SkString fname = SkOSPath::Basename(FLAGS_decodeBenchFilename[0]);
fName.printf("decode_%s_%s", sk_tool_utils::colortype_name(ct), fname.c_str());
}
, fFilename(filename)
, fStream()
, fValid(false) {
- fName.append(SkOSPath::SkBasename(filename));
+ fName.append(SkOSPath::Basename(filename));
}
virtual bool isSuitableFor(Backend backend) SK_OVERRIDE {
return;
}
- SkString fullPath = SkOSPath::SkPathJoin(resourcePath.c_str(),
- fFilename.c_str());
+ SkString fullPath = SkOSPath::Join(resourcePath.c_str(), fFilename.c_str());
SkFILEStream fileStream(fullPath.c_str());
fValid = fileStream.isValid() && fileStream.getLength() > 0;
if (fValid) {
SkString filename;
make_filename(name, &filename);
filename.appendf("_%s.png", config);
- SkString path = SkOSPath::SkPathJoin(dir, filename.c_str());
+ SkString path = SkOSPath::Join(dir, filename.c_str());
::remove(path.c_str());
SkFILEWStream stream(path.c_str());
SkString filename;
while (it.next(&filename)) {
if (!SkCommandLineFlags::ShouldSkip(FLAGS_match, filename.c_str())) {
- skps->push_back(
- SkOSPath::SkPathJoin(FLAGS_skps[0], filename.c_str()));
+ skps->push_back(SkOSPath::Join(FLAGS_skps[0], filename.c_str()));
}
}
}
exit(1);
}
- SkString filename = SkOSPath::SkBasename(skps[i].c_str());
+ SkString filename = SkOSPath::Basename(skps[i].c_str());
tasks->add(SkNEW_ARGS(DM::SKPTask, (reporter, tasks, pic, filename)));
tasks->add(SkNEW_ARGS(DM::PDFTask, (reporter, tasks, pic, filename,
RASTERIZE_PDF_PROC)));
#endif
this->makeDirOrFail(dir);
for (int i = 0; i < fSuffixes.count(); i++) {
- dir = SkOSPath::SkPathJoin(dir.c_str(), fSuffixes[i].c_str());
+ dir = SkOSPath::Join(dir.c_str(), fSuffixes[i].c_str());
this->makeDirOrFail(dir);
}
- SkString path = SkOSPath::SkPathJoin(dir.c_str(), fGmName.c_str());
+ SkString path = SkOSPath::Join(dir.c_str(), fGmName.c_str());
path.append(fExtension);
const bool ok = fData.get() ? save_data_to_file(fData, path.c_str())
SkASSERT(1 == suffixes.count());
// We'll look in root/suffix for images.
- const SkString dir = SkOSPath::SkPathJoin(root, suffixes[0].c_str());
+ const SkString dir = SkOSPath::Join(root, suffixes[0].c_str());
// Remove the suffix and tack on a .png.
filename.remove(filename.size() - suffixLength, suffixLength);
filename.append(".png");
- return SkOSPath::SkPathJoin(dir.c_str(), filename.c_str());
+ return SkOSPath::Join(dir.c_str(), filename.c_str());
}
bool WriteTask::Expectations::check(const Task& task, SkBitmap bitmap) const {
if (!is_image_file(filename.c_str())) {
continue;
}
- SkString fullname = SkOSPath::SkPathJoin(dir, filename.c_str());
+ SkString fullname = SkOSPath::Join(dir, filename.c_str());
decodeFileAndWrite(fullname.c_str());
}
} else if (sk_exists(readPath) && is_image_file(readPath)) {
static bool make_output_filepath(SkString* path, const SkString& dir,
const SkString& name,
int page) {
- *path = SkOSPath::SkPathJoin(dir.c_str(), name.c_str());
+ *path = SkOSPath::Join(dir.c_str(), name.c_str());
return add_page_and_replace_filename_extension(path, page,
PDF_FILE_EXTENSION,
PNG_FILE_EXTENSION);
static bool process_pdf(const SkString& inputPath, const SkString& outputDir) {
SkDebugf("Loading PDF: %s\n", inputPath.c_str());
- SkString inputFilename = SkOSPath::SkBasename(inputPath.c_str());
+ SkString inputFilename = SkOSPath::Basename(inputPath.c_str());
SkAutoTDelete<SkPdfRenderer> renderer(SkPdfRenderer::CreateFromFile(inputPath.c_str()));
if (NULL == renderer.get()) {
SkOSFile::Iter iter(input, PDF_FILE_EXTENSION);
SkString inputFilename;
while (iter.next(&inputFilename)) {
- SkString inputPath = SkOSPath::SkPathJoin(input, inputFilename.c_str());
+ SkString inputPath = SkOSPath::Join(input, inputFilename.c_str());
if (!process_pdf(inputPath, outputDir)) {
++failures;
}
// IndividualImageExpectationsSource class...
Expectations IndividualImageExpectationsSource::get(const char *testName) const {
- SkString path = SkOSPath::SkPathJoin(fRootDir.c_str(), testName);
+ SkString path = SkOSPath::Join(fRootDir.c_str(), testName);
SkBitmap referenceBitmap;
bool decodedReferenceBitmap =
SkImageDecoder::DecodeFile(path.c_str(), &referenceBitmap, kN32_SkColorType,
filename.append(renderModeDescriptor);
filename.appendUnichar('.');
filename.append(suffix);
- return SkOSPath::SkPathJoin(path, filename.c_str());
+ return SkOSPath::Join(path, filename.c_str());
}
/**
filename.append(bitmapDigest.getDigestValue());
filename.appendUnichar('.');
filename.append(kPNG_FileExtension);
- return SkOSPath::SkPathJoin(path, filename.c_str());
+ return SkOSPath::Join(path, filename.c_str());
} else {
return make_filename(path, shortName, configName, renderModeDescriptor,
kPNG_FileExtension);
*
* Uses SkPATH_SEPARATOR, to work on all platforms.
*/
- static SkString SkPathJoin(const char *rootPath, const char *relativePath);
+ static SkString Join(const char* rootPath, const char* relativePath);
/**
* Return the name of the file, ignoring the directory structure.
* @return SkString The basename of the file - anything beyond the
* final slash, or the full name if there is no slash.
*/
- static SkString SkBasename(const char* fullPath);
+ static SkString Basename(const char* fullPath);
};
+
#endif
SkString filename;
while (iter.next(&filename)) {
*fSamples.append() = new PictFileFactory(
- SkOSPath::SkPathJoin(FLAGS_pictureDir[0], filename.c_str()));
+ SkOSPath::Join(FLAGS_pictureDir[0], filename.c_str()));
}
}
if (!FLAGS_picture.isEmpty()) {
SkString filename;
while (iter.next(&filename)) {
*fSamples.append() = new PdfFileViewerFactory(
- SkOSPath::SkPathJoin(FLAGS_pictureDir[0], filename.c_str()));
+ SkOSPath::Join(FLAGS_pictureDir[0], filename.c_str()));
}
}
#endif
}
// Name, size of the file, and whether or not it is premultiplied.
- SkString header(SkOSPath::SkBasename(fCurrFile.c_str()));
+ SkString header(SkOSPath::Basename(fCurrFile.c_str()));
header.appendf(" [%dx%d] %s", fBitmap.width(), fBitmap.height(),
(fPremul ? "premultiplied" : "unpremultiplied"));
canvas->drawText(header.c_str(), header.size(), 0, height, paint);
return;
}
}
- fCurrFile = SkOSPath::SkPathJoin(fResPath.c_str(), basename.c_str());
+ fCurrFile = SkOSPath::Join(fResPath.c_str(), basename.c_str());
this->decodeCurrFile();
}
while (iter.next(&name, false)) {
SkString filename(
- SkOSPath::SkPathJoin(directory.c_str(), name.c_str()));
+ SkOSPath::Join(directory.c_str(), name.c_str()));
bool isFixedPitch;
SkString realname;
if (name.startsWith(".")) {
continue;
}
- SkString dirname(
- SkOSPath::SkPathJoin(directory.c_str(), name.c_str()));
+ SkString dirname(SkOSPath::Join(directory.c_str(), name.c_str()));
load_directory_fonts(dirname);
}
}
*/
#include "SkOSFile.h"
-SkString SkOSPath::SkPathJoin(const char *rootPath, const char *relativePath) {
+SkString SkOSPath::Join(const char *rootPath, const char *relativePath) {
SkString result(rootPath);
if (!result.endsWith(SkPATH_SEPARATOR)) {
result.appendUnichar(SkPATH_SEPARATOR);
return result;
}
-SkString SkOSPath::SkBasename(const char* fullPath) {
+SkString SkOSPath::Basename(const char* fullPath) {
if (!fullPath) {
return SkString();
}
return;
}
- SkString path = SkOSPath::SkPathJoin(tmpDir.c_str(), "data_test");
+ SkString path = SkOSPath::Join(tmpDir.c_str(), "data_test");
const char s[] = "abcdefghijklmnopqrstuvwxyz";
{
// allways, then all these tests will be disabled.
}
- SkString path = SkOSPath::SkPathJoin(tmpDir.c_str(), "aborted.pdf");
+ SkString path = SkOSPath::Join(tmpDir.c_str(), "aborted.pdf");
// Make sure doc's destructor is called to flush.
{
// allways, then all these tests will be disabled.
}
- SkString path = SkOSPath::SkPathJoin(tmpDir.c_str(), "file.pdf");
+ SkString path = SkOSPath::Join(tmpDir.c_str(), "file.pdf");
SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(path.c_str()));
SkDebugf("Could not run fontstream test because resourcePath not specified.");
return;
}
- SkString filename = SkOSPath::SkPathJoin(resourcePath.c_str(), "test.ttc");
+ SkString filename = SkOSPath::Join(resourcePath.c_str(), "test.ttc");
SkFILEStream stream(filename.c_str());
if (stream.isValid()) {
SkString basename;
if (iter.next(&basename)) {
do {
- SkString filename = SkOSPath::SkPathJoin(resourcePath.c_str(), basename.c_str());
+ SkString filename = SkOSPath::Join(resourcePath.c_str(), basename.c_str());
// SkDebugf("about to decode \"%s\"\n", filename.c_str());
compare_unpremul(reporter, filename);
} while (iter.next(&basename));
SkString basename;
if (iter.next(&basename)) {
do {
- SkString filename = SkOSPath::SkPathJoin(resourcePath.c_str(), basename.c_str());
+ SkString filename = SkOSPath::Join(resourcePath.c_str(), basename.c_str());
for (int truth = 0; truth <= 1; ++truth) {
test_alphaType(reporter, filename, SkToBool(truth));
}
for (size_t i = 0; i < SK_ARRAY_COUNT(suffixes); ++i) {
SkString basename = SkStringPrintf("%s%s", root, suffixes[i]);
- SkString fullName = SkOSPath::SkPathJoin(resourcePath.c_str(), basename.c_str());
+ SkString fullName = SkOSPath::Join(resourcePath.c_str(), basename.c_str());
SkBitmap bm;
SkFILEStream stream(fullName.c_str());
const bool useDataList[] = {true, false};
for (size_t fidx = 0; fidx < SK_ARRAY_COUNT(files); ++fidx) {
- SkString path = SkOSPath::SkPathJoin(resourceDir.c_str(), files[fidx]);
+ SkString path = SkOSPath::Join(resourceDir.c_str(), files[fidx]);
if (!sk_exists(path.c_str())) {
continue;
}
DEF_TEST(DiscardablePixelRef_SecondLockColorTableCheck, r) {
SkString resourceDir = GetResourcePath();
- SkString path = SkOSPath::SkPathJoin(resourceDir.c_str(), "randPixels.gif");
+ SkString path = SkOSPath::Join(resourceDir.c_str(), "randPixels.gif");
if (!sk_exists(path.c_str())) {
return;
}
#include "Test.h"
/**
- * Test SkPathJoin and SkBasename.
- * Will use SkPathJoin to append filename to dir, test that it works correctly,
- * and tests using SkBasename on the result.
+ * Test SkOSPath::Join and SkOSPath::Basename.
+ * Will use SkOSPath::Join to append filename to dir, test that it works correctly,
+ * and tests using SkOSPath::Basename on the result.
* @param reporter Reporter for test conditions.
* @param dir String representing the path to a folder. May or may not
* end with SkPATH_SEPARATOR.
// If filename contains SkPATH_SEPARATOR, the tests will fail.
SkASSERT(!filename.contains(SkPATH_SEPARATOR));
- // Tests for SkOSPath::SkPathJoin and SkOSPath::SkBasename
+ // Tests for SkOSPath::Join and SkOSPath::Basename
// fullName should be "dir<SkPATH_SEPARATOR>file"
- SkString fullName = SkOSPath::SkPathJoin(dir.c_str(), filename.c_str());
+ SkString fullName = SkOSPath::Join(dir.c_str(), filename.c_str());
// fullName should be the combined size of dir and file, plus one if
// dir did not include the final path separator.
}
REPORTER_ASSERT(reporter, fullName.size() == expectedSize);
- SkString basename = SkOSPath::SkBasename(fullName.c_str());
+ SkString basename = SkOSPath::Basename(fullName.c_str());
// basename should be the same as filename
REPORTER_ASSERT(reporter, basename.equals(filename));
REPORTER_ASSERT(reporter, !basename.contains(SkPATH_SEPARATOR));
// Now take the basename of filename, which should be the same as filename.
- basename = SkOSPath::SkBasename(filename.c_str());
+ basename = SkOSPath::Basename(filename.c_str());
REPORTER_ASSERT(reporter, basename.equals(filename));
}
// Basename of a directory with a path separator at the end is empty.
dir.appendUnichar(SkPATH_SEPARATOR);
- SkString baseOfDir = SkOSPath::SkBasename(dir.c_str());
+ SkString baseOfDir = SkOSPath::Basename(dir.c_str());
REPORTER_ASSERT(reporter, baseOfDir.size() == 0);
// Basename of NULL is an empty string.
- SkString empty = SkOSPath::SkBasename(NULL);
+ SkString empty = SkOSPath::Basename(NULL);
REPORTER_ASSERT(reporter, empty.size() == 0);
// Test that NULL can be used for the directory and filename.
- SkString emptyPath = SkOSPath::SkPathJoin(NULL, NULL);
+ SkString emptyPath = SkOSPath::Join(NULL, NULL);
REPORTER_ASSERT(reporter, emptyPath.size() == 1);
REPORTER_ASSERT(reporter, emptyPath.contains(SkPATH_SEPARATOR));
}
SkDebugf("Could not run fontstream test because resourcePath not specified.");
return;
}
- SkString filename = SkOSPath::SkPathJoin(resourcePath.c_str(), "test.ttc");
+ SkString filename = SkOSPath::Join(resourcePath.c_str(), "test.ttc");
SkTypeface* typeface = SkTypeface::CreateFromFile(filename.c_str());
if (!typeface) {
SkDebugf("Could not run fontstream test because test.ttc not found.");
}
static void test_filestreams(skiatest::Reporter* reporter, const char* tmpDir) {
- SkString path = SkOSPath::SkPathJoin(tmpDir, "wstream_test");
+ SkString path = SkOSPath::Join(tmpDir, "wstream_test");
const char s[] = "abcdefghijklmnopqrstuvwxyz";
// a bitmap directly.
// TODO: Share more common code with write() to do this, to properly
// write out the JSON summary, etc.
- SkString pathWithNumber = SkOSPath::SkPathJoin(fWritePath.c_str(),
- fInputFilename.c_str());
+ SkString pathWithNumber = SkOSPath::Join(fWritePath.c_str(),
+ fInputFilename.c_str());
pathWithNumber.remove(pathWithNumber.size() - 4, 4);
pathWithNumber.appendf("%i.png", i++);
SkBitmap copy;
SkAutoTUnref<SkPicture> picture(recorder.endRecording());
if (!fWritePath.isEmpty()) {
// Record the new picture as a new SKP with PNG encoded bitmaps.
- SkString skpPath = SkOSPath::SkPathJoin(fWritePath.c_str(), fInputFilename.c_str());
+ SkString skpPath = SkOSPath::Join(fWritePath.c_str(), fInputFilename.c_str());
SkFILEWStream stream(skpPath.c_str());
picture->serialize(&stream, &encode_bitmap_to_data);
return true;
DEFINE_string2(resourcePath, i, "resources", "Directory with test resources: images, fonts, etc.");
SkString GetResourcePath(const char* resource) {
- return SkOSPath::SkPathJoin(FLAGS_resourcePath[0], resource);
+ return SkOSPath::Join(FLAGS_resourcePath[0], resource);
}
void SetResourcePath(const char* resource) {
return false;
}
- SkString filename = SkOSPath::SkBasename(inputPath.c_str());
+ SkString filename = SkOSPath::Basename(inputPath.c_str());
gWriter.bench(filename.c_str(), picture->width(), picture->height());
int failures = 0;
if (iter.next(&inputFilename)) {
do {
- SkString inputPath = SkOSPath::SkPathJoin(input, inputFilename.c_str());
+ SkString inputPath = SkOSPath::Join(input, inputFilename.c_str());
if (!run_single_benchmark(inputPath, benchmark)) {
++failures;
}
continue;
}
- const SkString path = SkOSPath::SkPathJoin(FLAGS_skps[0], filename.c_str());
+ const SkString path = SkOSPath::Join(FLAGS_skps[0], filename.c_str());
SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(path.c_str()));
if (!stream) {
continue;
}
- const SkString path = SkOSPath::SkPathJoin(FLAGS_skps[0], filename.c_str());
+ const SkString path = SkOSPath::Join(FLAGS_skps[0], filename.c_str());
SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(path.c_str()));
if (!stream) {
if (iter.next(&inputFilename)) {
do {
- inFile = SkOSPath::SkPathJoin(inDir.c_str(), inputFilename.c_str());
+ inFile = SkOSPath::Join(inDir.c_str(), inputFilename.c_str());
if (!outDir.isEmpty()) {
- outFile = SkOSPath::SkPathJoin(outDir.c_str(), inputFilename.c_str());
+ outFile = SkOSPath::Join(outDir.c_str(), inputFilename.c_str());
}
SkDebugf("Executing %s\n", inputFilename.c_str());
filter_picture(inFile, outFile);
SkString filename;
SkOSFile::Iter iter(FLAGS_skpPath[i], "skp");
while(iter.next(&filename)) {
- paths.push_back() = SkOSPath::SkPathJoin(directory.c_str(), filename.c_str());
+ paths.push_back() = SkOSPath::Join(directory.c_str(), filename.c_str());
}
} else {
// Add this as an .skp itself.
const char *subdirOrNull, const SkString& baseName) {
SkString partialPath;
if (subdirOrNull) {
- partialPath = SkOSPath::SkPathJoin(dirPath.c_str(), subdirOrNull);
+ partialPath = SkOSPath::Join(dirPath.c_str(), subdirOrNull);
sk_mkdir(partialPath.c_str());
} else {
partialPath.set(dirPath);
}
- SkString fullPath = SkOSPath::SkPathJoin(partialPath.c_str(), baseName.c_str());
+ SkString fullPath = SkOSPath::Join(partialPath.c_str(), baseName.c_str());
if (SkImageEncoder::EncodeFile(fullPath.c_str(), bm, SkImageEncoder::kPNG_Type, 100)) {
return true;
} else {
*/
static bool make_output_filepath(SkString* path, const SkString& dir,
const SkString& name) {
- *path = SkOSPath::SkPathJoin(dir.c_str(), name.c_str());
+ *path = SkOSPath::Join(dir.c_str(), name.c_str());
return replace_filename_extension(path,
SKP_FILE_EXTENSION,
PDF_FILE_EXTENSION);
*/
static bool render_pdf(const SkString& inputPath, const SkString& outputDir,
sk_tools::PdfRenderer& renderer) {
- SkString inputFilename = SkOSPath::SkBasename(inputPath.c_str());
+ SkString inputFilename = SkOSPath::Basename(inputPath.c_str());
SkFILEStream inputStream;
inputStream.setPath(inputPath.c_str());
SkOSFile::Iter iter(input.c_str(), SKP_FILE_EXTENSION);
SkString inputFilename;
while (iter.next(&inputFilename)) {
- SkString inputPath = SkOSPath::SkPathJoin(input.c_str(), inputFilename.c_str());
+ SkString inputPath = SkOSPath::Join(input.c_str(), inputFilename.c_str());
if (!render_pdf(inputPath, outputDir, renderer)) {
++failures;
}
SkString name = SkStringPrintf("%s_%d%s", gInputFileName.c_str(), gImageNo++,
get_suffix_from_format(format));
SkString dir(FLAGS_writePath[0]);
- outPath = SkOSPath::SkPathJoin(dir.c_str(), name.c_str());
+ outPath = SkOSPath::Join(dir.c_str(), name.c_str());
SkFILEWStream fileStream(outPath.c_str());
if (!(fileStream.isValid() && fileStream.write(buffer, size))) {
SkDebugf("Failed to write encoded data to \"%s\"\n", outPath.c_str());
const SkString* mismatchPath,
sk_tools::PictureRenderer& renderer,
SkBitmap** out) {
- SkString inputFilename = SkOSPath::SkBasename(inputPath.c_str());
+ SkString inputFilename = SkOSPath::Basename(inputPath.c_str());
SkString writePathString;
if (NULL != writePath && writePath->size() > 0 && !FLAGS_writeEncodedImages) {
writePathString.set(*writePath);
if (FLAGS_writeWholeImage) {
sk_tools::force_all_opaque(*bitmap);
- SkString inputFilename = SkOSPath::SkBasename(inputPath.c_str());
+ SkString inputFilename = SkOSPath::Basename(inputPath.c_str());
SkString outputFilename(inputFilename);
sk_tools::replace_char(&outputFilename, '.', '_');
outputFilename.append(".png");
SkDebugf("process_input, %s\n", input);
if (iter.next(&inputFilename)) {
do {
- SkString inputPath = SkOSPath::SkPathJoin(input, inputFilename.c_str());
+ SkString inputPath = SkOSPath::Join(input, inputFilename.c_str());
if (!render_picture(inputPath, writePath, mismatchPath, renderer, jsonSummaryPtr)) {
++failures;
}
static void make_outname(SkString* dst, const char outDir[], const char src[],
const char suffix[]) {
- SkString basename = SkOSPath::SkBasename(src);
- dst->set(SkOSPath::SkPathJoin(outDir, basename.c_str()));
+ SkString basename = SkOSPath::Basename(src);
+ dst->set(SkOSPath::Join(outDir, basename.c_str()));
dst->append(suffix);
}
if (FLAGS_writeChecksumBasedFilenames) {
// First create the directory for the hashtype.
const SkString hashType = bitmapAndDigest.fDigest.getHashType();
- const SkString hashDir = SkOSPath::SkPathJoin(outDir, hashType.c_str());
+ const SkString hashDir = SkOSPath::Join(outDir, hashType.c_str());
if (!sk_mkdir(hashDir.c_str())) {
return false;
}
// Now create the name of the folder specific to this image.
- SkString basename = SkOSPath::SkBasename(src);
- const SkString imageDir = SkOSPath::SkPathJoin(hashDir.c_str(), basename.c_str());
+ SkString basename = SkOSPath::Basename(src);
+ const SkString imageDir = SkOSPath::Join(hashDir.c_str(), basename.c_str());
if (!sk_mkdir(imageDir.c_str())) {
return false;
}
SkString checksumBasedName = bitmapAndDigest.fDigest.getDigestValue();
checksumBasedName.append(".png");
- filename = SkOSPath::SkPathJoin(imageDir.c_str(), checksumBasedName.c_str());
+ filename = SkOSPath::Join(imageDir.c_str(), checksumBasedName.c_str());
} else {
make_outname(&filename, outDir, src, ".png");
}
subsetPath.set(writePath);
} else {
// Create a subdirectory to hold the results of decodeSubset.
- subsetPath = SkOSPath::SkPathJoin(writePath, "subsets");
+ subsetPath = SkOSPath::Join(writePath, "subsets");
if (!sk_mkdir(subsetPath.c_str())) {
gFailedSubsetDecodes.push_back().printf("Successfully decoded subset %s, but "
"failed to create a directory to write to.",
return false;
}
- SkString dirExtracted = SkOSPath::SkPathJoin(writePath, "extracted");
+ SkString dirExtracted = SkOSPath::Join(writePath, "extracted");
if (!sk_mkdir(dirExtracted.c_str())) {
gFailedSubsetDecodes.push_back().printf("Successfully decoded subset%s, but failed "
"to create a directory for extractSubset "
stream.rewind();
// Create a string representing just the filename itself, for use in json expectations.
- SkString basename = SkOSPath::SkBasename(srcPath);
+ SkString basename = SkOSPath::Basename(srcPath);
// Replace '_' with '-', so that the names can fit gm_json.py's IMAGE_FILENAME_PATTERN
replace_char(&basename, '_', '-');
// Replace '.' with '-', so the output filename can still retain the original file extension,
if (!is_image_file(filename.c_str())) {
continue;
}
- SkString fullname = SkOSPath::SkPathJoin(dir, filename.c_str());
+ SkString fullname = SkOSPath::Join(dir, filename.c_str());
decodeFileAndWrite(fullname.c_str(), outDirPtr);
}
} else if (sk_exists(readPath) && is_image_file(readPath)) {
fRecordMutex.release();
// compute the common name
- SkString baseName = SkOSPath::SkBasename(baselinePath);
- SkString testName = SkOSPath::SkBasename(testPath);
+ SkString baseName = SkOSPath::Basename(baselinePath);
+ SkString testName = SkOSPath::Basename(testPath);
newRecord->fCommonName = get_common_prefix(baseName, testName);
newRecord->fBaselinePath = baselinePath;
&& !diffData.fResult.poiAlphaMask.empty()
&& !newRecord->fCommonName.isEmpty()) {
- newRecord->fAlphaMaskPath = SkOSPath::SkPathJoin(fAlphaMaskDir.c_str(),
- newRecord->fCommonName.c_str());
+ newRecord->fAlphaMaskPath = SkOSPath::Join(fAlphaMaskDir.c_str(),
+ newRecord->fCommonName.c_str());
// compute the image diff and output it
SkBitmap copy;
newRecord->fMaxGreenDiff = diffData.fResult.maxGreenDiff;
newRecord->fMaxBlueDiff = diffData.fResult.maxBlueDiff;
- newRecord->fRgbDiffPath = SkOSPath::SkPathJoin(fRgbDiffDir.c_str(),
- newRecord->fCommonName.c_str());
+ newRecord->fRgbDiffPath = SkOSPath::Join(fRgbDiffDir.c_str(),
+ newRecord->fCommonName.c_str());
SkImageEncoder::EncodeFile(newRecord->fRgbDiffPath.c_str(),
diffData.fResult.rgbDiffBitmap,
SkImageEncoder::kPNG_Type, 100);
&& SkImageDiffer::RESULT_CORRECT != diffData.fResult.result
&& !diffData.fResult.whiteDiffBitmap.empty()
&& !newRecord->fCommonName.isEmpty()) {
- newRecord->fWhiteDiffPath = SkOSPath::SkPathJoin(fWhiteDiffDir.c_str(),
- newRecord->fCommonName.c_str());
+ newRecord->fWhiteDiffPath = SkOSPath::Join(fWhiteDiffDir.c_str(),
+ newRecord->fCommonName.c_str());
SkImageEncoder::EncodeFile(newRecord->fWhiteDiffPath.c_str(),
diffData.fResult.whiteDiffBitmap,
SkImageEncoder::kPNG_Type, 100);
const char* baseFilename = baselineEntries[x].c_str();
// Find the real location of each file to compare
- SkString baselineFile = SkOSPath::SkPathJoin(baselinePath, baseFilename);
- SkString testFile = SkOSPath::SkPathJoin(testPath, baseFilename);
+ SkString baselineFile = SkOSPath::Join(baselinePath, baseFilename);
+ SkString testFile = SkOSPath::Join(testPath, baseFilename);
// Check that the test file exists and is a file
if (sk_exists(testFile.c_str()) && !sk_isdir(testFile.c_str())) {
while ((entry = readdir(dir))) {
// dirent only gives relative paths, we need to join them to the base path to check if they
// are directories.
- SkString joinedPath = SkOSPath::SkPathJoin(path, entry->d_name);
+ SkString joinedPath = SkOSPath::Join(path, entry->d_name);
// We only care about files
if (!sk_isdir(joinedPath.c_str())) {