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 | |
commit-bot@chromium.org | 5fb2ce3 | 2014-04-17 23:35:06 +0000 | [diff] [blame] | 8 | class SkBBHFactory; |
robertphillips@google.com | 84b18c7 | 2014-04-13 19:09:42 +0000 | [diff] [blame] | 9 | |
mtklein@google.com | d36522d | 2013-10-16 13:02:15 +0000 | [diff] [blame] | 10 | // Small free functions used in more than one place in DM. |
| 11 | |
| 12 | namespace DM { |
| 13 | |
commit-bot@chromium.org | 192cbf6 | 2013-10-21 18:40:25 +0000 | [diff] [blame] | 14 | // UnderJoin("a", "b") -> "a_b" |
| 15 | SkString UnderJoin(const char* a, const char* b); |
mtklein@google.com | d36522d | 2013-10-16 13:02:15 +0000 | [diff] [blame] | 16 | |
mtklein | e4d3e60 | 2014-06-06 09:28:43 -0700 | [diff] [blame] | 17 | // "foo_bar.skp" -> "foo-bar_skp" |
| 18 | SkString FileToTaskName(SkString); |
| 19 | |
mtklein | 7373456 | 2014-06-24 12:28:34 -0700 | [diff] [blame] | 20 | // Draw gm to picture. If skr is true, uses EXPERIMENTAL_beginRecording(). |
skia.committer@gmail.com | 5199701 | 2014-04-14 03:04:57 +0000 | [diff] [blame] | 21 | SkPicture* RecordPicture(skiagm::GM* gm, |
mtklein | 7373456 | 2014-06-24 12:28:34 -0700 | [diff] [blame] | 22 | SkBBHFactory* factory = NULL, |
| 23 | bool skr = false); |
commit-bot@chromium.org | 192cbf6 | 2013-10-21 18:40:25 +0000 | [diff] [blame] | 24 | |
commit-bot@chromium.org | 2664207 | 2014-05-15 17:33:31 +0000 | [diff] [blame] | 25 | // Allocate an empty bitmap with this size and depth. |
| 26 | void AllocatePixels(SkColorType, int w, int h, SkBitmap* bitmap); |
| 27 | // Allocate an empty bitmap the same size and depth as reference. |
| 28 | void AllocatePixels(const SkBitmap& reference, SkBitmap* bitmap); |
commit-bot@chromium.org | 192cbf6 | 2013-10-21 18:40:25 +0000 | [diff] [blame] | 29 | |
| 30 | // Draw picture to bitmap. |
mtklein | 7373456 | 2014-06-24 12:28:34 -0700 | [diff] [blame] | 31 | void DrawPicture(const SkPicture& picture, SkBitmap* bitmap); |
commit-bot@chromium.org | 192cbf6 | 2013-10-21 18:40:25 +0000 | [diff] [blame] | 32 | |
commit-bot@chromium.org | 69031a4 | 2014-05-16 13:03:46 +0000 | [diff] [blame] | 33 | // What is the maximum component difference in these bitmaps? |
| 34 | unsigned MaxComponentDifference(const SkBitmap& a, const SkBitmap& b); |
| 35 | |
commit-bot@chromium.org | 192cbf6 | 2013-10-21 18:40:25 +0000 | [diff] [blame] | 36 | // Are these identical bitmaps? |
| 37 | bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b); |
mtklein@google.com | d36522d | 2013-10-16 13:02:15 +0000 | [diff] [blame] | 38 | |
| 39 | } // namespace DM |
| 40 | |
| 41 | #endif // DMUtil_DEFINED |