diff --git a/dm/DM.cpp b/dm/DM.cpp index bcd3272920..7d45e2ec35 100644 --- a/dm/DM.cpp +++ b/dm/DM.cpp @@ -77,8 +77,6 @@ DEFINE_string(blacklist, "", "'--blacklist ~8888 svg _ svgparse_' blocks non-8888 SVGs that contain \"svgparse_\" in " "the name."); -DEFINE_string2(readPath, r, "", "If set check for equality with golden results in this directory."); - DEFINE_string(uninterestingHashesFile, "", "File containing a list of uninteresting hashes. If a result hashes to something in " "this list, no image is written for that result."); @@ -298,42 +296,6 @@ static void find_culprit() { /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ -struct Gold : public SkString { - Gold() : SkString("") {} - Gold(const SkString& sink, const SkString& src, - const SkString& srcOptions, const SkString& name, - const SkString& md5) - : SkString("") { - this->append(sink); - this->append(src); - this->append(srcOptions); - this->append(name); - this->append(md5); - } - struct Hash { - uint32_t operator()(const Gold& g) const { - return SkGoodHash()((const SkString&)g); - } - }; -}; -static SkTHashSet gGold; - -static void add_gold(JsonWriter::BitmapResult r) { - gGold.add(Gold(r.config, r.sourceType, r.sourceOptions, r.name, r.md5)); -} - -static void gather_gold() { - if (!FLAGS_readPath.isEmpty()) { - SkString path(FLAGS_readPath[0]); - path.append("/dm.json"); - if (!JsonWriter::ReadJson(path.c_str(), add_gold)) { - fail(SkStringPrintf("Couldn't read %s for golden results.", path.c_str())); - } - } -} - -/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ - #if defined(SK_BUILD_FOR_WIN) static const char* kNewline = "\r\n"; #else @@ -1133,7 +1095,7 @@ struct Task { std::unique_ptr ownedData(data); SkString md5; - if (!FLAGS_writePath.isEmpty() || !FLAGS_readPath.isEmpty()) { + if (!FLAGS_writePath.isEmpty()) { SkMD5 hash; if (data->getLength()) { hash.writeStream(data, data->getLength()); @@ -1159,18 +1121,6 @@ struct Task { } } - if (!FLAGS_readPath.isEmpty() && - !gGold.contains(Gold(task.sink.tag, task.src.tag, - task.src.options, name, md5))) { - fail(SkStringPrintf("%s not found for %s %s %s %s in %s", - md5.c_str(), - task.sink.tag.c_str(), - task.src.tag.c_str(), - task.src.options.c_str(), - name.c_str(), - FLAGS_readPath[0])); - } - if (!FLAGS_writePath.isEmpty()) { const char* ext = task.sink->fileExtension(); if (ext && !FLAGS_dont_write.contains(ext)) { @@ -1364,7 +1314,6 @@ int main(int argc, char** argv) { if (nullptr == GetResourceAsData("images/color_wheel.png")) { info("Some resources are missing. Do you need to set --resourcePath?\n"); } - gather_gold(); gather_uninteresting_hashes(); if (!gather_srcs()) { diff --git a/dm/DMJsonWriter.cpp b/dm/DMJsonWriter.cpp index 65b0698a0f..749abdf104 100644 --- a/dm/DMJsonWriter.cpp +++ b/dm/DMJsonWriter.cpp @@ -9,14 +9,11 @@ #include "ProcStats.h" #include "SkCommonFlags.h" -#include "SkData.h" -#include "SkJSONCPP.h" #include "SkJSONWriter.h" #include "SkMutex.h" #include "SkOSFile.h" #include "SkOSPath.h" #include "SkStream.h" -#include "SkTArray.h" namespace DM { @@ -116,36 +113,4 @@ void JsonWriter::DumpJson() { stream.flush(); } -bool JsonWriter::ReadJson(const char* path, void(*callback)(BitmapResult)) { - sk_sp json(SkData::MakeFromFileName(path)); - if (!json) { - return false; - } - - Json::Reader reader; - Json::Value root; - const char* data = (const char*)json->data(); - if (!reader.parse(data, data+json->size(), root)) { - return false; - } - - const Json::Value& results = root["results"]; - BitmapResult br; - for (unsigned i = 0; i < results.size(); i++) { - const Json::Value& r = results[i]; - br.name = r["key"]["name"].asCString(); - br.config = r["key"]["config"].asCString(); - br.sourceType = r["key"]["source_type"].asCString(); - br.ext = r["options"]["ext"].asCString(); - br.gammaCorrect = 0 == strcmp("yes", r["options"]["gamma_correct"].asCString()); - br.md5 = r["md5"].asCString(); - - if (!r["key"]["source_options"].isNull()) { - br.sourceOptions = r["key"]["source_options"].asCString(); - } - callback(br); - } - return true; -} - } // namespace DM diff --git a/dm/DMJsonWriter.h b/dm/DMJsonWriter.h index 68e27a54b1..3eaf45448f 100644 --- a/dm/DMJsonWriter.h +++ b/dm/DMJsonWriter.h @@ -46,12 +46,6 @@ public: * Write all collected results to the file FLAGS_writePath[0]/dm.json. */ static void DumpJson(); - - /** - * Read JSON file at path written by DumpJson, calling callback for each - * BitmapResult recorded in the file. Return success. - */ - static bool ReadJson(const char* path, void(*callback)(BitmapResult)); };