blob: 1145f28221014b5f8a1b7e25c451750086b0bcea [file] [log] [blame]
mtklein@google.comd36522d2013-10-16 13:02:15 +00001#ifndef DMUtil_DEFINED
2#define DMUtil_DEFINED
3
commit-bot@chromium.org38aeb0f2014-02-26 23:01:57 +00004#include "SkBenchmark.h"
commit-bot@chromium.org66bb3d12013-10-16 19:13:38 +00005#include "SkBitmap.h"
mtklein@google.comd36522d2013-10-16 13:02:15 +00006#include "SkString.h"
7#include "gm_expectations.h"
8
commit-bot@chromium.org5fb2ce32014-04-17 23:35:06 +00009class SkBBHFactory;
robertphillips@google.com84b18c72014-04-13 19:09:42 +000010
mtklein@google.comd36522d2013-10-16 13:02:15 +000011// Small free functions used in more than one place in DM.
12
13namespace DM {
14
commit-bot@chromium.org192cbf62013-10-21 18:40:25 +000015// UnderJoin("a", "b") -> "a_b"
16SkString UnderJoin(const char* a, const char* b);
mtklein@google.comd36522d2013-10-16 13:02:15 +000017
robertphillips@google.com84b18c72014-04-13 19:09:42 +000018// Draw gm to picture. Passes recordFlags to SkPictureRecorder::beginRecording().
skia.committer@gmail.com51997012014-04-14 03:04:57 +000019SkPicture* RecordPicture(skiagm::GM* gm,
20 uint32_t recordFlags = 0,
commit-bot@chromium.org5fb2ce32014-04-17 23:35:06 +000021 SkBBHFactory* factory = NULL);
commit-bot@chromium.org192cbf62013-10-21 18:40:25 +000022
commit-bot@chromium.org38aeb0f2014-02-26 23:01:57 +000023// Prepare bitmap to have gm or bench draw into it with this config.
24// TODO(mtklein): make SkBenchmark::getSize()/GM::getISize() const.
commit-bot@chromium.org15a14052014-02-16 00:59:25 +000025void SetupBitmap(const SkColorType, skiagm::GM* gm, SkBitmap* bitmap);
commit-bot@chromium.org38aeb0f2014-02-26 23:01:57 +000026void SetupBitmap(const SkColorType, SkBenchmark* bench, SkBitmap* bitmap);
commit-bot@chromium.org192cbf62013-10-21 18:40:25 +000027
28// Draw picture to bitmap.
29void DrawPicture(SkPicture* picture, SkBitmap* bitmap);
30
31// Are these identical bitmaps?
32bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b);
mtklein@google.comd36522d2013-10-16 13:02:15 +000033
34} // namespace DM
35
36#endif // DMUtil_DEFINED