2013-10-16 13:02:15 +00:00
|
|
|
#ifndef DMUtil_DEFINED
|
|
|
|
#define DMUtil_DEFINED
|
|
|
|
|
2014-02-26 23:01:57 +00:00
|
|
|
#include "SkBenchmark.h"
|
2013-10-16 19:13:38 +00:00
|
|
|
#include "SkBitmap.h"
|
2013-10-16 13:02:15 +00:00
|
|
|
#include "SkString.h"
|
|
|
|
#include "gm_expectations.h"
|
|
|
|
|
2014-04-13 19:09:42 +00:00
|
|
|
class SkPictureFactory;
|
|
|
|
|
2013-10-16 13:02:15 +00:00
|
|
|
// Small free functions used in more than one place in DM.
|
|
|
|
|
|
|
|
namespace DM {
|
|
|
|
|
2013-10-21 18:40:25 +00:00
|
|
|
// UnderJoin("a", "b") -> "a_b"
|
|
|
|
SkString UnderJoin(const char* a, const char* b);
|
2013-10-16 13:02:15 +00:00
|
|
|
|
2014-04-13 19:09:42 +00:00
|
|
|
// Draw gm to picture. Passes recordFlags to SkPictureRecorder::beginRecording().
|
2014-04-14 03:04:57 +00:00
|
|
|
SkPicture* RecordPicture(skiagm::GM* gm,
|
|
|
|
uint32_t recordFlags = 0,
|
2014-04-13 19:09:42 +00:00
|
|
|
SkPictureFactory* factory = NULL);
|
2013-10-21 18:40:25 +00:00
|
|
|
|
2014-02-26 23:01:57 +00:00
|
|
|
// Prepare bitmap to have gm or bench draw into it with this config.
|
|
|
|
// TODO(mtklein): make SkBenchmark::getSize()/GM::getISize() const.
|
2014-02-16 00:59:25 +00:00
|
|
|
void SetupBitmap(const SkColorType, skiagm::GM* gm, SkBitmap* bitmap);
|
2014-02-26 23:01:57 +00:00
|
|
|
void SetupBitmap(const SkColorType, SkBenchmark* bench, SkBitmap* bitmap);
|
2013-10-21 18:40:25 +00:00
|
|
|
|
|
|
|
// Draw picture to bitmap.
|
|
|
|
void DrawPicture(SkPicture* picture, SkBitmap* bitmap);
|
|
|
|
|
|
|
|
// Are these identical bitmaps?
|
|
|
|
bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b);
|
2013-10-16 13:02:15 +00:00
|
|
|
|
|
|
|
} // namespace DM
|
|
|
|
|
|
|
|
#endif // DMUtil_DEFINED
|