| OLD | NEW |
| 1 #include "DMWriteTask.h" | 1 #include "DMWriteTask.h" |
| 2 | 2 |
| 3 #include "DMUtil.h" | 3 #include "DMUtil.h" |
| 4 #include "SkColorPriv.h" | 4 #include "SkColorPriv.h" |
| 5 #include "SkCommandLineFlags.h" | 5 #include "SkCommonFlags.h" |
| 6 #include "SkImageEncoder.h" | 6 #include "SkImageEncoder.h" |
| 7 #include "SkMallocPixelRef.h" | 7 #include "SkMallocPixelRef.h" |
| 8 #include "SkStream.h" | 8 #include "SkStream.h" |
| 9 #include "SkString.h" | 9 #include "SkString.h" |
| 10 | 10 |
| 11 DEFINE_string2(writePath, w, "", "If set, write GMs here as .pngs."); | 11 DEFINE_string2(writePath, w, "", "If set, write GMs here as .pngs."); |
| 12 DEFINE_bool(writePngOnly, false, "If true, don't encode raw bitmap after .png da
ta. " | 12 DEFINE_bool(writePngOnly, false, "If true, don't encode raw bitmap after .png da
ta. " |
| 13 "This means -r won't work, but skdiff will stil
l work fine."); | 13 "This means -r won't work, but skdiff will stil
l work fine."); |
| 14 | 14 |
| 15 namespace DM { | 15 namespace DM { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 SkDebugf("Can't write %s.\n", path); | 122 SkDebugf("Can't write %s.\n", path); |
| 123 return false; | 123 return false; |
| 124 } | 124 } |
| 125 return true; | 125 return true; |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace | 128 } // namespace |
| 129 | 129 |
| 130 void WriteTask::draw() { | 130 void WriteTask::draw() { |
| 131 SkString dir(FLAGS_writePath[0]); | 131 SkString dir(FLAGS_writePath[0]); |
| 132 #if SK_BUILD_FOR_IOS |
| 133 if (dir.equals("@")) { |
| 134 dir.set(FLAGS_resourcePath[0]); |
| 135 } |
| 136 #endif |
| 132 this->makeDirOrFail(dir); | 137 this->makeDirOrFail(dir); |
| 133 for (int i = 0; i < fSuffixes.count(); i++) { | 138 for (int i = 0; i < fSuffixes.count(); i++) { |
| 134 dir = SkOSPath::SkPathJoin(dir.c_str(), fSuffixes[i].c_str()); | 139 dir = SkOSPath::SkPathJoin(dir.c_str(), fSuffixes[i].c_str()); |
| 135 this->makeDirOrFail(dir); | 140 this->makeDirOrFail(dir); |
| 136 } | 141 } |
| 137 | 142 |
| 138 SkString path = SkOSPath::SkPathJoin(dir.c_str(), fGmName.c_str()); | 143 SkString path = SkOSPath::SkPathJoin(dir.c_str(), fGmName.c_str()); |
| 139 path.append(fExtension); | 144 path.append(fExtension); |
| 140 | 145 |
| 141 const bool ok = fData.get() ? save_data_to_file(fData, path.c_str()) | 146 const bool ok = fData.get() ? save_data_to_file(fData, path.c_str()) |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 const SkString path = path_to_expected_image(fRoot, task); | 191 const SkString path = path_to_expected_image(fRoot, task); |
| 187 SkBitmap expected; | 192 SkBitmap expected; |
| 188 if (!PngAndRaw::Decode(path.c_str(), bitmap.info(), &expected)) { | 193 if (!PngAndRaw::Decode(path.c_str(), bitmap.info(), &expected)) { |
| 189 return false; | 194 return false; |
| 190 } | 195 } |
| 191 | 196 |
| 192 return BitmapsEqual(expected, bitmap); | 197 return BitmapsEqual(expected, bitmap); |
| 193 } | 198 } |
| 194 | 199 |
| 195 } // namespace DM | 200 } // namespace DM |
| OLD | NEW |