aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar tfarina <tfarina@chromium.org>2014-07-28 19:26:58 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-07-28 19:26:58 -0700
commita8e2e1504b9af6ba791637f228debaa23953064a (patch)
treec4dc50d10bb27a4bfd263f877cb7d602f6779afc /tools
parent2bff230d835fbc84f0ce8b2e7a399fe8416ec7c8 (diff)
Cleanup: Rename SkOSPath functions.
Mostly for brevity and matches better with Python: Python | Old C++ | New C++ os.path.join | SkOSPath::SkPathJoin | SkOSPath::Join os.path.basename | SkOSPath::SkBasename | SkOSPath::Basename BUG=None TEST=make all R=mtklein@google.com, bsalomon@google.com Author: tfarina@chromium.org Review URL: https://codereview.chromium.org/428443002
Diffstat (limited to 'tools')
-rw-r--r--tools/CopyTilesRenderer.cpp4
-rw-r--r--tools/PictureRenderer.cpp2
-rw-r--r--tools/Resources.cpp2
-rw-r--r--tools/bench_pictures_main.cpp4
-rw-r--r--tools/bench_playback.cpp2
-rw-r--r--tools/bench_record.cpp2
-rw-r--r--tools/filtermain.cpp4
-rw-r--r--tools/lua/lua_pictures.cpp2
-rw-r--r--tools/picture_utils.cpp4
-rw-r--r--tools/render_pdfs_main.cpp6
-rw-r--r--tools/render_pictures_main.cpp8
-rw-r--r--tools/skimage_main.cpp20
-rw-r--r--tools/skpdiff/SkDiffContext.cpp20
-rw-r--r--tools/skpdiff/skpdiff_util.cpp2
14 files changed, 41 insertions, 41 deletions
diff --git a/tools/CopyTilesRenderer.cpp b/tools/CopyTilesRenderer.cpp
index 7e6f8a8226..509dd0e595 100644
--- a/tools/CopyTilesRenderer.cpp
+++ b/tools/CopyTilesRenderer.cpp
@@ -72,8 +72,8 @@ namespace sk_tools {
// 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;
diff --git a/tools/PictureRenderer.cpp b/tools/PictureRenderer.cpp
index 3793b85461..dd4cea481d 100644
--- a/tools/PictureRenderer.cpp
+++ b/tools/PictureRenderer.cpp
@@ -363,7 +363,7 @@ bool RecordPictureRenderer::render(SkBitmap** out) {
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;
diff --git a/tools/Resources.cpp b/tools/Resources.cpp
index 0efd66b246..606c5c4968 100644
--- a/tools/Resources.cpp
+++ b/tools/Resources.cpp
@@ -13,7 +13,7 @@
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) {
diff --git a/tools/bench_pictures_main.cpp b/tools/bench_pictures_main.cpp
index f6cd8e9bd7..b740877cce 100644
--- a/tools/bench_pictures_main.cpp
+++ b/tools/bench_pictures_main.cpp
@@ -197,7 +197,7 @@ static bool run_single_benchmark(const SkString& inputPath,
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());
@@ -376,7 +376,7 @@ static int process_input(const char* input,
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;
}
diff --git a/tools/bench_playback.cpp b/tools/bench_playback.cpp
index 5343191974..a4f3a6a394 100644
--- a/tools/bench_playback.cpp
+++ b/tools/bench_playback.cpp
@@ -106,7 +106,7 @@ int tool_main(int argc, char** argv) {
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) {
diff --git a/tools/bench_record.cpp b/tools/bench_record.cpp
index 545731900b..4f928ee6dc 100644
--- a/tools/bench_record.cpp
+++ b/tools/bench_record.cpp
@@ -149,7 +149,7 @@ int tool_main(int argc, char** argv) {
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) {
diff --git a/tools/filtermain.cpp b/tools/filtermain.cpp
index 0830c80e30..9df6c078e7 100644
--- a/tools/filtermain.cpp
+++ b/tools/filtermain.cpp
@@ -816,9 +816,9 @@ int tool_main(int argc, char** argv) {
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);
diff --git a/tools/lua/lua_pictures.cpp b/tools/lua/lua_pictures.cpp
index 2985bf64c3..e19b7a314a 100644
--- a/tools/lua/lua_pictures.cpp
+++ b/tools/lua/lua_pictures.cpp
@@ -132,7 +132,7 @@ int tool_main(int argc, char** argv) {
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.
diff --git a/tools/picture_utils.cpp b/tools/picture_utils.cpp
index 597fd4878f..6a35dd1d70 100644
--- a/tools/picture_utils.cpp
+++ b/tools/picture_utils.cpp
@@ -55,12 +55,12 @@ namespace sk_tools {
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 {
diff --git a/tools/render_pdfs_main.cpp b/tools/render_pdfs_main.cpp
index 5e337009c6..6e1d609cde 100644
--- a/tools/render_pdfs_main.cpp
+++ b/tools/render_pdfs_main.cpp
@@ -111,7 +111,7 @@ static SkData* encode_to_dct_data(size_t*, const SkBitmap& bitmap) {
*/
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);
@@ -149,7 +149,7 @@ static SkWStream* open_stream(const SkString& outputDir,
*/
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());
@@ -197,7 +197,7 @@ static int process_input(const SkString& input, const SkString& outputDir,
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;
}
diff --git a/tools/render_pictures_main.cpp b/tools/render_pictures_main.cpp
index c2c7875b28..e2f772908f 100644
--- a/tools/render_pictures_main.cpp
+++ b/tools/render_pictures_main.cpp
@@ -123,7 +123,7 @@ static bool write_image_to_file(const void* buffer, size_t size, SkBitmap* bitma
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());
@@ -142,7 +142,7 @@ static bool render_picture_internal(const SkString& inputPath, const SkString* w
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);
@@ -345,7 +345,7 @@ static bool render_picture(const SkString& inputPath, const SkString* 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");
@@ -379,7 +379,7 @@ static int process_input(const char* input, const SkString* writePath,
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;
}
diff --git a/tools/skimage_main.cpp b/tools/skimage_main.cpp
index cd58eacd59..60bdd05485 100644
--- a/tools/skimage_main.cpp
+++ b/tools/skimage_main.cpp
@@ -80,8 +80,8 @@ static SkImageDecoder::Format guess_format_from_suffix(const char suffix[]) {
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);
}
@@ -138,14 +138,14 @@ static bool write_bitmap(const char outDir[], const char src[],
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;
}
@@ -154,7 +154,7 @@ static bool write_bitmap(const char outDir[], const char src[],
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");
}
@@ -358,7 +358,7 @@ static bool write_subset(const char* writePath, const SkString& subsetName,
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.",
@@ -385,7 +385,7 @@ static bool write_subset(const char* writePath, const SkString& subsetName,
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 "
@@ -502,7 +502,7 @@ static void decodeFileAndWrite(const char srcPath[], const SkString* writePath)
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,
@@ -796,7 +796,7 @@ int tool_main(int argc, char** argv) {
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)) {
diff --git a/tools/skpdiff/SkDiffContext.cpp b/tools/skpdiff/SkDiffContext.cpp
index 26898c92f3..ea44c90da1 100644
--- a/tools/skpdiff/SkDiffContext.cpp
+++ b/tools/skpdiff/SkDiffContext.cpp
@@ -98,8 +98,8 @@ void SkDiffContext::addDiff(const char* baselinePath, const char* testPath) {
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;
@@ -134,8 +134,8 @@ void SkDiffContext::addDiff(const char* baselinePath, const char* testPath) {
&& !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;
@@ -163,8 +163,8 @@ void SkDiffContext::addDiff(const char* baselinePath, const char* testPath) {
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);
@@ -176,8 +176,8 @@ void SkDiffContext::addDiff(const char* baselinePath, const char* testPath) {
&& 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);
@@ -223,8 +223,8 @@ void SkDiffContext::diffDirectories(const char baselinePath[], const char testPa
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())) {
diff --git a/tools/skpdiff/skpdiff_util.cpp b/tools/skpdiff/skpdiff_util.cpp
index 983bee20b3..4a92f5e3f7 100644
--- a/tools/skpdiff/skpdiff_util.cpp
+++ b/tools/skpdiff/skpdiff_util.cpp
@@ -117,7 +117,7 @@ bool get_directory(const char path[], SkTArray<SkString>* entries) {
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())) {