aboutsummaryrefslogtreecommitdiffhomepage
path: root/dm/DMUtil.h
blob: 7c112b354302840f322481f659be668286bf5965 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef DMUtil_DEFINED
#define DMUtil_DEFINED

#include "SkBenchmark.h"
#include "SkBitmap.h"
#include "SkString.h"
#include "gm_expectations.h"

class SkPictureFactory;

// Small free functions used in more than one place in DM.

namespace DM {

// UnderJoin("a", "b") -> "a_b"
SkString UnderJoin(const char* a, const char* b);

// Draw gm to picture.  Passes recordFlags to SkPictureRecorder::beginRecording().
SkPicture* RecordPicture(skiagm::GM* gm,
                         uint32_t recordFlags = 0,
                         SkPictureFactory* factory = NULL);

// Prepare bitmap to have gm or bench draw into it with this config.
// TODO(mtklein): make SkBenchmark::getSize()/GM::getISize() const.
void SetupBitmap(const SkColorType, skiagm::GM* gm, SkBitmap* bitmap);
void SetupBitmap(const SkColorType, SkBenchmark* bench, SkBitmap* bitmap);

// Draw picture to bitmap.
void DrawPicture(SkPicture* picture, SkBitmap* bitmap);

// Are these identical bitmaps?
bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b);

}  // namespace DM

#endif  // DMUtil_DEFINED