| OLD | NEW |
| 1 #include "DMUtil.h" | 1 #include "DMUtil.h" |
| 2 | 2 |
| 3 #include "SkPicture.h" | 3 #include "SkPicture.h" |
| 4 #include "SkPictureRecorder.h" | 4 #include "SkPictureRecorder.h" |
| 5 | 5 |
| 6 namespace DM { | 6 namespace DM { |
| 7 | 7 |
| 8 SkString UnderJoin(const char* a, const char* b) { | 8 SkString UnderJoin(const char* a, const char* b) { |
| 9 SkString s; | 9 SkString s; |
| 10 s.appendf("%s_%s", a, b); | 10 s.appendf("%s_%s", a, b); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 } | 27 } |
| 28 | 28 |
| 29 void SetupBitmap(const SkColorType ct, skiagm::GM* gm, SkBitmap* bitmap) { | 29 void SetupBitmap(const SkColorType ct, skiagm::GM* gm, SkBitmap* bitmap) { |
| 30 setup_bitmap(ct, gm->getISize().width(), gm->getISize().height(), bitmap); | 30 setup_bitmap(ct, gm->getISize().width(), gm->getISize().height(), bitmap); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void SetupBitmap(const SkColorType ct, SkBenchmark* bench, SkBitmap* bitmap) { | 33 void SetupBitmap(const SkColorType ct, SkBenchmark* bench, SkBitmap* bitmap) { |
| 34 setup_bitmap(ct, bench->getSize().x(), bench->getSize().y(), bitmap); | 34 setup_bitmap(ct, bench->getSize().x(), bench->getSize().y(), bitmap); |
| 35 } | 35 } |
| 36 | 36 |
| 37 void SetupBitmap(const SkColorType ct, const SkPicture& pic, SkBitmap* bitmap) { |
| 38 setup_bitmap(ct, pic.width(), pic.height(), bitmap); |
| 39 } |
| 40 |
| 37 void DrawPicture(SkPicture* picture, SkBitmap* bitmap) { | 41 void DrawPicture(SkPicture* picture, SkBitmap* bitmap) { |
| 38 SkASSERT(picture != NULL); | 42 SkASSERT(picture != NULL); |
| 39 SkASSERT(bitmap != NULL); | 43 SkASSERT(bitmap != NULL); |
| 40 SkCanvas canvas(*bitmap); | 44 SkCanvas canvas(*bitmap); |
| 41 canvas.drawPicture(*picture); | 45 canvas.drawPicture(*picture); |
| 42 canvas.flush(); | 46 canvas.flush(); |
| 43 } | 47 } |
| 44 | 48 |
| 45 bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b) { | 49 bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b) { |
| 46 const SkAutoLockPixels lockA(a), lockB(b); | 50 const SkAutoLockPixels lockA(a), lockB(b); |
| 47 return a.getSize() == b.getSize() && 0 == memcmp(a.getPixels(), b.getPixels(
), b.getSize()); | 51 return a.getSize() == b.getSize() && 0 == memcmp(a.getPixels(), b.getPixels(
), b.getSize()); |
| 48 } | 52 } |
| 49 | 53 |
| 50 } // namespace DM | 54 } // namespace DM |
| OLD | NEW |