OLD | NEW |
1 #include "DMSerializeTask.h" | 1 #include "DMSerializeTask.h" |
2 #include "DMUtil.h" | 2 #include "DMUtil.h" |
3 #include "DMWriteTask.h" | 3 #include "DMWriteTask.h" |
4 | 4 |
5 #include "SkCommandLineFlags.h" | 5 #include "SkCommandLineFlags.h" |
6 #include "SkPicture.h" | 6 #include "SkPicture.h" |
7 #include "SkPixelRef.h" | 7 #include "SkPixelRef.h" |
8 | 8 |
9 DEFINE_bool(serialize, true, "If true, run picture serialization tests."); | 9 DEFINE_bool(serialize, true, "If true, run picture serialization tests."); |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 void SerializeTask::draw() { | 22 void SerializeTask::draw() { |
23 SkPicture recorded; | 23 SkPicture recorded; |
24 RecordPicture(fGM.get(), &recorded); | 24 RecordPicture(fGM.get(), &recorded); |
25 | 25 |
26 SkDynamicMemoryWStream wStream; | 26 SkDynamicMemoryWStream wStream; |
27 recorded.serialize(&wStream, NULL); | 27 recorded.serialize(&wStream, NULL); |
28 SkAutoTUnref<SkStream> rStream(wStream.detachAsStream()); | 28 SkAutoTUnref<SkStream> rStream(wStream.detachAsStream()); |
29 SkAutoTUnref<SkPicture> reconstructed(SkPicture::CreateFromStream(rStream)); | 29 SkAutoTUnref<SkPicture> reconstructed(SkPicture::CreateFromStream(rStream)); |
30 | 30 |
31 SkBitmap bitmap; | 31 SkBitmap bitmap; |
32 SetupBitmap(fReference.config(), fGM.get(), &bitmap); | 32 SetupBitmap(fReference.colorType(), fGM.get(), &bitmap); |
33 DrawPicture(reconstructed, &bitmap); | 33 DrawPicture(reconstructed, &bitmap); |
34 if (!BitmapsEqual(bitmap, fReference)) { | 34 if (!BitmapsEqual(bitmap, fReference)) { |
35 this->fail(); | 35 this->fail(); |
36 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap))); | 36 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap))); |
37 } | 37 } |
38 } | 38 } |
39 | 39 |
40 bool SerializeTask::shouldSkip() const { | 40 bool SerializeTask::shouldSkip() const { |
41 return !FLAGS_serialize || fGM->getFlags() & skiagm::GM::kSkipPicture_Flag; | 41 return !FLAGS_serialize || fGM->getFlags() & skiagm::GM::kSkipPicture_Flag; |
42 } | 42 } |
43 | 43 |
44 } // namespace DM | 44 } // namespace DM |
OLD | NEW |