| OLD | NEW |
| 1 #include "DMUtil.h" | 1 #include "DMUtil.h" |
| 2 | 2 |
| 3 #include "SkPicture.h" | 3 #include "SkPicture.h" |
| 4 | 4 |
| 5 namespace DM { | 5 namespace DM { |
| 6 | 6 |
| 7 SkString UnderJoin(const char* a, const char* b) { | 7 SkString UnderJoin(const char* a, const char* b) { |
| 8 SkString s; | 8 SkString s; |
| 9 s.appendf("%s_%s", a, b); | 9 s.appendf("%s_%s", a, b); |
| 10 return s; | 10 return s; |
| 11 } | 11 } |
| 12 | 12 |
| 13 SkString Png(SkString s) { | |
| 14 s.appendf(".png"); | |
| 15 return s; | |
| 16 } | |
| 17 | |
| 18 void RecordPicture(skiagm::GM* gm, SkPicture* picture, uint32_t recordFlags) { | 13 void RecordPicture(skiagm::GM* gm, SkPicture* picture, uint32_t recordFlags) { |
| 19 const SkISize size = gm->getISize(); | 14 const SkISize size = gm->getISize(); |
| 20 SkCanvas* canvas = picture->beginRecording(size.width(), size.height(), reco
rdFlags); | 15 SkCanvas* canvas = picture->beginRecording(size.width(), size.height(), reco
rdFlags); |
| 21 canvas->concat(gm->getInitialTransform()); | 16 canvas->concat(gm->getInitialTransform()); |
| 22 gm->draw(canvas); | 17 gm->draw(canvas); |
| 23 canvas->flush(); | 18 canvas->flush(); |
| 24 picture->endRecording(); | 19 picture->endRecording(); |
| 25 } | 20 } |
| 26 | 21 |
| 27 void SetupBitmap(const SkBitmap::Config config, skiagm::GM* gm, SkBitmap* bitmap
) { | 22 void SetupBitmap(const SkBitmap::Config config, skiagm::GM* gm, SkBitmap* bitmap
) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 38 canvas.drawPicture(*picture); | 33 canvas.drawPicture(*picture); |
| 39 canvas.flush(); | 34 canvas.flush(); |
| 40 } | 35 } |
| 41 | 36 |
| 42 bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b) { | 37 bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b) { |
| 43 const SkAutoLockPixels lockA(a), lockB(b); | 38 const SkAutoLockPixels lockA(a), lockB(b); |
| 44 return a.getSize() == b.getSize() && 0 == memcmp(a.getPixels(), b.getPixels(
), b.getSize()); | 39 return a.getSize() == b.getSize() && 0 == memcmp(a.getPixels(), b.getPixels(
), b.getSize()); |
| 45 } | 40 } |
| 46 | 41 |
| 47 } // namespace DM | 42 } // namespace DM |
| OLD | NEW |