2013-10-16 13:02:15 +00:00
|
|
|
#ifndef DMUtil_DEFINED
|
|
|
|
#define DMUtil_DEFINED
|
|
|
|
|
2013-10-16 19:13:38 +00:00
|
|
|
#include "SkBitmap.h"
|
2014-09-11 19:30:12 +00:00
|
|
|
#include "SkCanvas.h"
|
2013-10-16 13:02:15 +00:00
|
|
|
#include "SkString.h"
|
2014-09-09 14:36:57 +00:00
|
|
|
#include "gm.h"
|
2013-10-16 13:02:15 +00:00
|
|
|
|
2014-04-17 23:35:06 +00:00
|
|
|
class SkBBHFactory;
|
2014-04-13 19:09:42 +00:00
|
|
|
|
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-06-06 16:28:43 +00:00
|
|
|
// "foo_bar.skp" -> "foo-bar_skp"
|
|
|
|
SkString FileToTaskName(SkString);
|
|
|
|
|
2014-09-29 15:44:46 +00:00
|
|
|
// Draw gm to picture.
|
|
|
|
SkPicture* RecordPicture(skiagm::GM* gm, SkBBHFactory* factory = NULL);
|
2013-10-21 18:40:25 +00:00
|
|
|
|
2014-05-15 17:33:31 +00:00
|
|
|
// Allocate an empty bitmap with this size and depth.
|
|
|
|
void AllocatePixels(SkColorType, int w, int h, SkBitmap* bitmap);
|
|
|
|
// Allocate an empty bitmap the same size and depth as reference.
|
|
|
|
void AllocatePixels(const SkBitmap& reference, SkBitmap* bitmap);
|
2013-10-21 18:40:25 +00:00
|
|
|
|
|
|
|
// Draw picture to bitmap.
|
2014-06-24 19:28:34 +00:00
|
|
|
void DrawPicture(const SkPicture& picture, SkBitmap* bitmap);
|
2013-10-21 18:40:25 +00:00
|
|
|
|
2014-05-16 13:03:46 +00:00
|
|
|
// What is the maximum component difference in these bitmaps?
|
|
|
|
unsigned MaxComponentDifference(const SkBitmap& a, const SkBitmap& b);
|
|
|
|
|
2013-10-21 18:40:25 +00:00
|
|
|
// Are these identical bitmaps?
|
|
|
|
bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b);
|
2013-10-16 13:02:15 +00:00
|
|
|
|
2014-09-11 19:30:12 +00:00
|
|
|
// Hook to modify canvas using global flag values (e.g. --matrix).
|
|
|
|
void CanvasPreflight(SkCanvas*);
|
|
|
|
|
2013-10-16 13:02:15 +00:00
|
|
|
} // namespace DM
|
|
|
|
|
|
|
|
#endif // DMUtil_DEFINED
|