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 via S
kPictureData."); | 9 DEFINE_bool(serialize, true, "If true, run picture serialization tests via S
kPictureData."); |
10 DEFINE_bool(serialize_skr, true, "If true, run picture serialization tests via S
kRecord."); | 10 DEFINE_bool(serialize_skr, true, "If true, run picture serialization tests via S
kRecord."); |
(...skipping 21 matching lines...) Expand all Loading... |
32 SkDynamicMemoryWStream wStream; | 32 SkDynamicMemoryWStream wStream; |
33 recorded->serialize(&wStream, NULL); | 33 recorded->serialize(&wStream, NULL); |
34 SkAutoTUnref<SkStream> rStream(wStream.detachAsStream()); | 34 SkAutoTUnref<SkStream> rStream(wStream.detachAsStream()); |
35 SkAutoTUnref<SkPicture> reconstructed(SkPicture::CreateFromStream(rStream)); | 35 SkAutoTUnref<SkPicture> reconstructed(SkPicture::CreateFromStream(rStream)); |
36 | 36 |
37 SkBitmap bitmap; | 37 SkBitmap bitmap; |
38 AllocatePixels(fReference, &bitmap); | 38 AllocatePixels(fReference, &bitmap); |
39 DrawPicture(*reconstructed, &bitmap); | 39 DrawPicture(*reconstructed, &bitmap); |
40 if (!BitmapsEqual(bitmap, fReference)) { | 40 if (!BitmapsEqual(bitmap, fReference)) { |
41 this->fail(); | 41 this->fail(); |
42 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap))); | 42 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, "GM", bitmap))); |
43 } | 43 } |
44 } | 44 } |
45 | 45 |
46 bool SerializeTask::shouldSkip() const { | 46 bool SerializeTask::shouldSkip() const { |
47 if (fGM->getFlags() & skiagm::GM::kSkipPicture_Flag) { | 47 if (fGM->getFlags() & skiagm::GM::kSkipPicture_Flag) { |
48 return true; | 48 return true; |
49 } | 49 } |
50 return !*kEnabled[fMode]; | 50 return !*kEnabled[fMode]; |
51 } | 51 } |
52 | 52 |
53 } // namespace DM | 53 } // namespace DM |
OLD | NEW |