Remove picture_utils

More pointless hoop-jumping

Change-Id: I0123e0a1e27140a82ffe08ad88e0d115c060436d
Reviewed-on: https://skia-review.googlesource.com/146449
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
This commit is contained in:
Brian Osman 2018-08-09 09:46:53 -04:00 committed by Skia Commit-Bot
parent 93fa10fbbc
commit e581aaad4d
9 changed files with 3 additions and 81 deletions

View File

@ -1357,7 +1357,6 @@ if (skia_enable_tools) {
"tools/fonts/SkTestTypeface.cpp",
"tools/fonts/SkTestTypeface.h",
"tools/fonts/sk_tool_utils_font.cpp",
"tools/picture_utils.cpp",
"tools/random_parse_path.cpp",
"tools/sk_tool_utils.cpp",
"tools/timer/Timer.cpp",
@ -1786,7 +1785,6 @@ if (skia_enable_tools) {
"tools/debugger/SkDebugCanvas.cpp",
"tools/debugger/SkDrawCommand.cpp",
"tools/debugger/SkJsonWriteBuffer.cpp",
"tools/picture_utils.cpp",
]
deps = [
":flags",
@ -2195,7 +2193,6 @@ if (skia_enable_tools) {
"tools/mdbviz/MainWindow.cpp",
"tools/mdbviz/Model.cpp",
"tools/mdbviz/main.cpp",
"tools/picture_utils.cpp",
# generated files
"$target_gen_dir/mdbviz/MainWindow_moc.cpp",

View File

@ -43,7 +43,6 @@
#include "Test.h"
#include "Timer.h"
#include "ios_utils.h"
#include "picture_utils.h"
#include "sk_tool_utils.h"
#include <vector>

View File

@ -483,8 +483,6 @@ DM_SRCS_ALL = struct(
"tools/fonts/test_font_index.inc",
"tools/gpu/**/*.cpp",
"tools/gpu/**/*.h",
"tools/picture_utils.cpp",
"tools/picture_utils.h",
"tools/random_parse_path.cpp",
"tools/random_parse_path.h",
"tools/sk_pixel_iter.h",

View File

@ -24,7 +24,6 @@
#include "SkTHash.h"
#include "SkTypeface.h"
#include "SkWriteBuffer.h"
#include "picture_utils.h"
#include "SkClipOpPriv.h"
#include <SkLatticeIter.h>
#include <SkShadowFlags.h>

View File

@ -12,7 +12,6 @@
#include "SkGraphics.h"
#include "SkStream.h"
#include "SkData.h"
#include "picture_utils.h"
#include "SkOSFile.h"
#include "SkOSPath.h"

View File

@ -1,36 +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 "SkBitmap.h"
#include "SkOSFile.h"
#include "SkOSPath.h"
#include "SkString.h"
#include "sk_tool_utils.h"
namespace sk_tools {
bool write_bitmap_to_disk(const SkBitmap& bm, const SkString& dirPath,
const char *subdirOrNull, const SkString& baseName) {
SkString partialPath;
if (subdirOrNull) {
partialPath = SkOSPath::Join(dirPath.c_str(), subdirOrNull);
sk_mkdir(partialPath.c_str());
} else {
partialPath.set(dirPath);
}
SkString fullPath = SkOSPath::Join(partialPath.c_str(), baseName.c_str());
if (sk_tool_utils::EncodeImageToFile(fullPath.c_str(), bm, SkEncodedImageFormat::kPNG, 100)) {
return true;
} else {
SkDebugf("Failed to write the bitmap to %s.\n", fullPath.c_str());
return false;
}
}
} // namespace sk_tools

View File

@ -1,30 +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.
*/
#ifndef picture_utils_DEFINED
#define picture_utils_DEFINED
class SkBitmap;
class SkString;
namespace sk_tools {
/**
* Write a bitmap file to disk.
*
* @param bm the bitmap to record
* @param dirPath directory within which to write the image file
* @param subdirOrNull subdirectory within dirPath, or nullptr to just write into dirPath
* @param baseName last part of the filename
*
* @return true if written out successfully
*/
bool write_bitmap_to_disk(const SkBitmap& bm, const SkString& dirPath,
const char *subdirOrNull, const SkString& baseName);
} // namespace sk_tools
#endif // picture_utils_DEFINED

View File

@ -9,7 +9,6 @@
#include "SkPictureRecorder.h"
#include "SkPM4fPriv.h"
#include "picture_utils.h"
#include "sk_tool_utils.h"
using namespace sk_gpu_test;

View File

@ -34,7 +34,6 @@
#include "SkTaskGroup.h"
#include "flags/SkCommandLineFlags.h"
#include "flags/SkCommonFlagsConfig.h"
#include "picture_utils.h"
#include "sk_tool_utils.h"
#ifdef SK_XML
@ -470,12 +469,10 @@ int main(int argc, char** argv) {
if (!surface->getCanvas()->readPixels(bmp, 0, 0)) {
exitf(ExitErr::kUnavailable, "failed to read canvas pixels for png");
}
const SkString &dirname = SkOSPath::Dirname(FLAGS_png[0]),
&basename = SkOSPath::Basename(FLAGS_png[0]);
if (!mkdir_p(dirname)) {
exitf(ExitErr::kIO, "failed to create directory \"%s\" for png", dirname.c_str());
if (!mkdir_p(SkOSPath::Dirname(FLAGS_png[0]))) {
exitf(ExitErr::kIO, "failed to create directory for png \"%s\"", FLAGS_png[0]);
}
if (!sk_tools::write_bitmap_to_disk(bmp, dirname, nullptr, basename)) {
if (!sk_tool_utils::EncodeImageToFile(FLAGS_png[0], bmp, SkEncodedImageFormat::kPNG, 100)) {
exitf(ExitErr::kIO, "failed to save png to \"%s\"", FLAGS_png[0]);
}
}