mtklein@google.com | d36522d | 2013-10-16 13:02:15 +0000 | [diff] [blame] | 1 | #ifndef DMUtil_DEFINED |
| 2 | #define DMUtil_DEFINED |
| 3 | |
commit-bot@chromium.org | 66bb3d1 | 2013-10-16 19:13:38 +0000 | [diff] [blame] | 4 | #include "SkBitmap.h" |
mtklein@google.com | d36522d | 2013-10-16 13:02:15 +0000 | [diff] [blame] | 5 | #include "SkString.h" |
| 6 | #include "gm_expectations.h" |
| 7 | |
| 8 | // Small free functions used in more than one place in DM. |
| 9 | |
| 10 | namespace DM { |
| 11 | |
commit-bot@chromium.org | 192cbf6 | 2013-10-21 18:40:25 +0000 | [diff] [blame] | 12 | // UnderJoin("a", "b") -> "a_b" |
| 13 | SkString UnderJoin(const char* a, const char* b); |
mtklein@google.com | d36522d | 2013-10-16 13:02:15 +0000 | [diff] [blame] | 14 | |
commit-bot@chromium.org | 192cbf6 | 2013-10-21 18:40:25 +0000 | [diff] [blame] | 15 | // Png("a") -> "a.png" |
| 16 | SkString Png(SkString s); |
mtklein@google.com | d36522d | 2013-10-16 13:02:15 +0000 | [diff] [blame] | 17 | |
commit-bot@chromium.org | 66bb3d1 | 2013-10-16 19:13:38 +0000 | [diff] [blame] | 18 | // Roughly, expectations.match(GmResultDigest(bitmap)), but calculates the digest lazily. |
commit-bot@chromium.org | 192cbf6 | 2013-10-21 18:40:25 +0000 | [diff] [blame] | 19 | bool MeetsExpectations(const skiagm::Expectations& expectations, const SkBitmap bitmap); |
| 20 | |
commit-bot@chromium.org | c136242 | 2013-10-30 20:45:28 +0000 | [diff] [blame] | 21 | // Draw gm to picture. Passes recordFlags to SkPicture::beginRecording(). |
| 22 | void RecordPicture(skiagm::GM* gm, SkPicture* picture, uint32_t recordFlags = 0); |
commit-bot@chromium.org | 192cbf6 | 2013-10-21 18:40:25 +0000 | [diff] [blame] | 23 | |
| 24 | // Prepare bitmap to have gm draw into it with this config. |
| 25 | void SetupBitmap(const SkBitmap::Config config, skiagm::GM* gm, SkBitmap* bitmap); |
| 26 | |
| 27 | // Draw picture to bitmap. |
| 28 | void DrawPicture(SkPicture* picture, SkBitmap* bitmap); |
| 29 | |
| 30 | // Are these identical bitmaps? |
| 31 | bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b); |
mtklein@google.com | d36522d | 2013-10-16 13:02:15 +0000 | [diff] [blame] | 32 | |
| 33 | } // namespace DM |
| 34 | |
| 35 | #endif // DMUtil_DEFINED |