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 10 matching lines...) Expand all Loading... |
21 | 21 |
22 void SerializeTask::draw() { | 22 void SerializeTask::draw() { |
23 SkAutoTUnref<SkPicture> recorded(RecordPicture(fGM.get())); | 23 SkAutoTUnref<SkPicture> recorded(RecordPicture(fGM.get())); |
24 | 24 |
25 SkDynamicMemoryWStream wStream; | 25 SkDynamicMemoryWStream wStream; |
26 recorded->serialize(&wStream, NULL); | 26 recorded->serialize(&wStream, NULL); |
27 SkAutoTUnref<SkStream> rStream(wStream.detachAsStream()); | 27 SkAutoTUnref<SkStream> rStream(wStream.detachAsStream()); |
28 SkAutoTUnref<SkPicture> reconstructed(SkPicture::CreateFromStream(rStream)); | 28 SkAutoTUnref<SkPicture> reconstructed(SkPicture::CreateFromStream(rStream)); |
29 | 29 |
30 SkBitmap bitmap; | 30 SkBitmap bitmap; |
31 SetupBitmap(fReference.colorType(), fGM.get(), &bitmap); | 31 AllocatePixels(fReference, &bitmap); |
32 DrawPicture(reconstructed, &bitmap); | 32 DrawPicture(reconstructed, &bitmap); |
33 if (!BitmapsEqual(bitmap, fReference)) { | 33 if (!BitmapsEqual(bitmap, fReference)) { |
34 this->fail(); | 34 this->fail(); |
35 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap))); | 35 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap))); |
36 } | 36 } |
37 } | 37 } |
38 | 38 |
39 bool SerializeTask::shouldSkip() const { | 39 bool SerializeTask::shouldSkip() const { |
40 return !FLAGS_serialize || fGM->getFlags() & skiagm::GM::kSkipPicture_Flag; | 40 return !FLAGS_serialize || fGM->getFlags() & skiagm::GM::kSkipPicture_Flag; |
41 } | 41 } |
42 | 42 |
43 } // namespace DM | 43 } // namespace DM |
OLD | NEW |