aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gyp/tests.gypi1
-rw-r--r--tests/PictureUtilsTest.cpp19
-rw-r--r--tools/CopyTilesRenderer.cpp4
-rw-r--r--tools/bench_pictures_main.cpp3
-rw-r--r--tools/filtermain.cpp4
-rw-r--r--tools/lua/lua_pictures.cpp2
-rw-r--r--tools/picture_utils.cpp9
-rw-r--r--tools/picture_utils.h5
-rw-r--r--tools/render_pdfs_main.cpp5
-rw-r--r--tools/render_pictures_main.cpp6
10 files changed, 10 insertions, 48 deletions
diff --git a/gyp/tests.gypi b/gyp/tests.gypi
index d06d0d7d79..cf56d53d6e 100644
--- a/gyp/tests.gypi
+++ b/gyp/tests.gypi
@@ -134,7 +134,6 @@
'../tests/PictureTest.cpp',
'../tests/PictureShaderTest.cpp',
'../tests/PictureStateTreeTest.cpp',
- '../tests/PictureUtilsTest.cpp',
'../tests/PixelRefTest.cpp',
'../tests/PointTest.cpp',
'../tests/PremulAlphaRoundTripTest.cpp',
diff --git a/tests/PictureUtilsTest.cpp b/tests/PictureUtilsTest.cpp
deleted file mode 100644
index 9214d07cff..0000000000
--- a/tests/PictureUtilsTest.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "picture_utils.h"
-
-#include "SkString.h"
-#include "Test.h"
-
-DEF_TEST(PictureUtils, reporter) {
- SkString result;
- SkString filename("test");
- SkString dir("test/path");
- sk_tools::make_filepath(&result, dir, filename);
- REPORTER_ASSERT(reporter, result.equals("test/path/test"));
-}
diff --git a/tools/CopyTilesRenderer.cpp b/tools/CopyTilesRenderer.cpp
index 245685568a..ebd33d8851 100644
--- a/tools/CopyTilesRenderer.cpp
+++ b/tools/CopyTilesRenderer.cpp
@@ -71,8 +71,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;
- make_filepath(&pathWithNumber, fWritePath, fInputFilename);
+ SkString pathWithNumber = SkOSPath::SkPathJoin(fWritePath.c_str(),
+ fInputFilename.c_str());
pathWithNumber.remove(pathWithNumber.size() - 4, 4);
pathWithNumber.appendf("%i.png", i++);
SkBitmap copy;
diff --git a/tools/bench_pictures_main.cpp b/tools/bench_pictures_main.cpp
index 4d4116db01..c267c4cb9b 100644
--- a/tools/bench_pictures_main.cpp
+++ b/tools/bench_pictures_main.cpp
@@ -374,8 +374,7 @@ static int process_input(const char* input,
int failures = 0;
if (iter.next(&inputFilename)) {
do {
- SkString inputPath;
- sk_tools::make_filepath(&inputPath, inputAsSkString, inputFilename);
+ SkString inputPath = SkOSPath::SkPathJoin(input, inputFilename.c_str());
if (!run_single_benchmark(inputPath, benchmark)) {
++failures;
}
diff --git a/tools/filtermain.cpp b/tools/filtermain.cpp
index 36b9f925c5..a67f744983 100644
--- a/tools/filtermain.cpp
+++ b/tools/filtermain.cpp
@@ -818,9 +818,9 @@ int tool_main(int argc, char** argv) {
if (iter.next(&inputFilename)) {
do {
- sk_tools::make_filepath(&inFile, inDir, inputFilename);
+ inFile = SkOSPath::SkPathJoin(inDir.c_str(), inputFilename.c_str());
if (!outDir.isEmpty()) {
- sk_tools::make_filepath(&outFile, outDir, inputFilename);
+ outFile = SkOSPath::SkPathJoin(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 f1c5ce920f..2985bf64c3 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)) {
- sk_tools::make_filepath(&paths.push_back(), directory, filename);
+ paths.push_back() = SkOSPath::SkPathJoin(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 850e21f8e7..d88d922af9 100644
--- a/tools/picture_utils.cpp
+++ b/tools/picture_utils.cpp
@@ -41,15 +41,6 @@ namespace sk_tools {
}
}
- void make_filepath(SkString* path, const SkString& dir, const SkString& name) {
- size_t len = dir.size();
- path->set(dir);
- if (0 < len && '/' != dir[len - 1]) {
- path->append("/");
- }
- path->append(name);
- }
-
bool is_percentage(const char* const string) {
SkString skString(string);
return skString.endsWith("%");
diff --git a/tools/picture_utils.h b/tools/picture_utils.h
index 2e1af7b78c..b2a387de62 100644
--- a/tools/picture_utils.h
+++ b/tools/picture_utils.h
@@ -33,11 +33,6 @@ namespace sk_tools {
*/
void replace_char(SkString* str, const char oldChar, const char newChar);
- // Creates a posix style filepath by concatenating name onto dir with a
- // forward slash into path.
- // TODO(epoger): delete in favor of SkOSPath::SkPathJoin()?
- void make_filepath(SkString* path, const SkString&, const SkString& name);
-
// Returns true if the string ends with %
bool is_percentage(const char* const string);
diff --git a/tools/render_pdfs_main.cpp b/tools/render_pdfs_main.cpp
index fd078d3901..5e337009c6 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) {
- sk_tools::make_filepath(path, dir, name);
+ *path = SkOSPath::SkPathJoin(dir.c_str(), name.c_str());
return replace_filename_extension(path,
SKP_FILE_EXTENSION,
PDF_FILE_EXTENSION);
@@ -197,8 +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;
- sk_tools::make_filepath(&inputPath, input, inputFilename);
+ SkString inputPath = SkOSPath::SkPathJoin(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 8a5c7713a2..ec21cb7da3 100644
--- a/tools/render_pictures_main.cpp
+++ b/tools/render_pictures_main.cpp
@@ -124,7 +124,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]);
- sk_tools::make_filepath(&outPath, dir, name);
+ outPath = SkOSPath::SkPathJoin(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());
@@ -386,9 +386,7 @@ static int process_input(const char* input, const SkString* writePath,
SkDebugf("process_input, %s\n", input);
if (iter.next(&inputFilename)) {
do {
- SkString inputPath;
- SkString inputAsSkString(input);
- sk_tools::make_filepath(&inputPath, inputAsSkString, inputFilename);
+ SkString inputPath = SkOSPath::SkPathJoin(input, inputFilename.c_str());
if (!render_picture(inputPath, writePath, mismatchPath, renderer, jsonSummaryPtr)) {
++failures;
}