blob: 512ad64eb654cd8299bd642b64c126c11f50187e [file] [log] [blame]
mtklein@google.comd36522d2013-10-16 13:02:15 +00001#ifndef DMUtil_DEFINED
2#define DMUtil_DEFINED
3
commit-bot@chromium.org66bb3d12013-10-16 19:13:38 +00004#include "SkBitmap.h"
mtklein@google.comd36522d2013-10-16 13:02:15 +00005#include "SkString.h"
6#include "gm_expectations.h"
7
8// Small free functions used in more than one place in DM.
9
10namespace DM {
11
commit-bot@chromium.org192cbf62013-10-21 18:40:25 +000012// UnderJoin("a", "b") -> "a_b"
13SkString UnderJoin(const char* a, const char* b);
mtklein@google.comd36522d2013-10-16 13:02:15 +000014
commit-bot@chromium.org192cbf62013-10-21 18:40:25 +000015// Png("a") -> "a.png"
16SkString Png(SkString s);
mtklein@google.comd36522d2013-10-16 13:02:15 +000017
commit-bot@chromium.org66bb3d12013-10-16 19:13:38 +000018// Roughly, expectations.match(GmResultDigest(bitmap)), but calculates the digest lazily.
commit-bot@chromium.org192cbf62013-10-21 18:40:25 +000019bool MeetsExpectations(const skiagm::Expectations& expectations, const SkBitmap bitmap);
20
commit-bot@chromium.orgc1362422013-10-30 20:45:28 +000021// Draw gm to picture. Passes recordFlags to SkPicture::beginRecording().
22void RecordPicture(skiagm::GM* gm, SkPicture* picture, uint32_t recordFlags = 0);
commit-bot@chromium.org192cbf62013-10-21 18:40:25 +000023
24// Prepare bitmap to have gm draw into it with this config.
25void SetupBitmap(const SkBitmap::Config config, skiagm::GM* gm, SkBitmap* bitmap);
26
27// Draw picture to bitmap.
28void DrawPicture(SkPicture* picture, SkBitmap* bitmap);
29
30// Are these identical bitmaps?
31bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b);
mtklein@google.comd36522d2013-10-16 13:02:15 +000032
33} // namespace DM
34
35#endif // DMUtil_DEFINED