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