OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "CrashHandler.h" | 8 #include "CrashHandler.h" |
9 #include "DMJsonWriter.h" | 9 #include "DMJsonWriter.h" |
10 #include "DMSrcSink.h" | 10 #include "DMSrcSink.h" |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 auto timerStart = now_ms(); | 808 auto timerStart = now_ms(); |
809 if (!FLAGS_dryRun && note.isEmpty()) { | 809 if (!FLAGS_dryRun && note.isEmpty()) { |
810 SkBitmap bitmap; | 810 SkBitmap bitmap; |
811 SkDynamicMemoryWStream stream; | 811 SkDynamicMemoryWStream stream; |
812 if (FLAGS_pre_log) { | 812 if (FLAGS_pre_log) { |
813 SkDebugf("\nRunning %s->%s", name.c_str(), task->sink.tag.c_str(
)); | 813 SkDebugf("\nRunning %s->%s", name.c_str(), task->sink.tag.c_str(
)); |
814 } | 814 } |
815 start(task->sink.tag.c_str(), task->src.tag, task->src.options, name
.c_str()); | 815 start(task->sink.tag.c_str(), task->src.tag, task->src.options, name
.c_str()); |
816 Error err = task->sink->draw(*task->src, &bitmap, &stream, &log); | 816 Error err = task->sink->draw(*task->src, &bitmap, &stream, &log); |
817 if (!err.isEmpty()) { | 817 if (!err.isEmpty()) { |
818 auto elapsed = now_ms() - timerStart; | |
819 if (err.isFatal()) { | 818 if (err.isFatal()) { |
820 fail(SkStringPrintf("%s %s %s %s: %s", | 819 fail(SkStringPrintf("%s %s %s %s: %s", |
821 task->sink.tag.c_str(), | 820 task->sink.tag.c_str(), |
822 task->src.tag.c_str(), | 821 task->src.tag.c_str(), |
823 task->src.options.c_str(), | 822 task->src.options.c_str(), |
824 name.c_str(), | 823 name.c_str(), |
825 err.c_str())); | 824 err.c_str())); |
826 } else { | 825 } else { |
827 note.appendf(" (skipped: %s)", err.c_str()); | 826 note.appendf(" (skipped: %s)", err.c_str()); |
| 827 auto elapsed = now_ms() - timerStart; |
| 828 done(elapsed, task->sink.tag.c_str(), task->src.tag, task->s
rc.options, |
| 829 name, note, log); |
| 830 return; |
828 } | 831 } |
829 done(elapsed, task->sink.tag.c_str(), task->src.tag, task->src.o
ptions, | |
830 name, note, log); | |
831 return; | |
832 } | 832 } |
833 | 833 |
834 // We're likely switching threads here, so we must capture by value,
[=] or [foo,bar]. | 834 // We're likely switching threads here, so we must capture by value,
[=] or [foo,bar]. |
835 SkStreamAsset* data = stream.detachAsStream(); | 835 SkStreamAsset* data = stream.detachAsStream(); |
836 gDefinitelyThreadSafeWork.add([task,name,bitmap,data]{ | 836 gDefinitelyThreadSafeWork.add([task,name,bitmap,data]{ |
837 SkAutoTDelete<SkStreamAsset> ownedData(data); | 837 SkAutoTDelete<SkStreamAsset> ownedData(data); |
838 | 838 |
839 // Why doesn't the copy constructor do this when we have pre-loc
ked pixels? | 839 // Why doesn't the copy constructor do this when we have pre-loc
ked pixels? |
840 bitmap.lockPixels(); | 840 bitmap.lockPixels(); |
841 | 841 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 const char* ext = task->sink->fileExtension(); | 881 const char* ext = task->sink->fileExtension(); |
882 if (data->getLength()) { | 882 if (data->getLength()) { |
883 WriteToDisk(*task, md5, ext, data, data->getLength(), nu
llptr); | 883 WriteToDisk(*task, md5, ext, data, data->getLength(), nu
llptr); |
884 SkASSERT(bitmap.drawsNothing()); | 884 SkASSERT(bitmap.drawsNothing()); |
885 } else if (!bitmap.drawsNothing()) { | 885 } else if (!bitmap.drawsNothing()) { |
886 WriteToDisk(*task, md5, ext, nullptr, 0, &bitmap); | 886 WriteToDisk(*task, md5, ext, nullptr, 0, &bitmap); |
887 } | 887 } |
888 } | 888 } |
889 }); | 889 }); |
890 } | 890 } |
891 done(now_ms()-timerStart, task->sink.tag.c_str(), task->src.tag.c_str(),
task->src.options.c_str(), | 891 auto elapsed = now_ms() - timerStart; |
| 892 done(elapsed, task->sink.tag.c_str(), task->src.tag.c_str(), task->src.o
ptions.c_str(), |
892 name, note, log); | 893 name, note, log); |
893 } | 894 } |
894 | 895 |
895 static void WriteToDisk(const Task& task, | 896 static void WriteToDisk(const Task& task, |
896 SkString md5, | 897 SkString md5, |
897 const char* ext, | 898 const char* ext, |
898 SkStream* data, size_t len, | 899 SkStream* data, size_t len, |
899 const SkBitmap* bitmap) { | 900 const SkBitmap* bitmap) { |
900 JsonWriter::BitmapResult result; | 901 JsonWriter::BitmapResult result; |
901 result.name = task.src->name(); | 902 result.name = task.src->name(); |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1243 Reporter* reporter, | 1244 Reporter* reporter, |
1244 GrContextFactory* fac
tory); | 1245 GrContextFactory* fac
tory); |
1245 } // namespace skiatest | 1246 } // namespace skiatest |
1246 | 1247 |
1247 #if !defined(SK_BUILD_FOR_IOS) | 1248 #if !defined(SK_BUILD_FOR_IOS) |
1248 int main(int argc, char** argv) { | 1249 int main(int argc, char** argv) { |
1249 SkCommandLineFlags::Parse(argc, argv); | 1250 SkCommandLineFlags::Parse(argc, argv); |
1250 return dm_main(); | 1251 return dm_main(); |
1251 } | 1252 } |
1252 #endif | 1253 #endif |
OLD | NEW |