Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / skia / dm / DMUtil.h
1 #ifndef DMUtil_DEFINED
2 #define DMUtil_DEFINED
3
4 #include "SkBitmap.h"
5 #include "SkString.h"
6 #include "gm_expectations.h"
7
8 class SkBBHFactory;
9
10 // Small free functions used in more than one place in DM.
11
12 namespace DM {
13
14 // UnderJoin("a", "b") -> "a_b"
15 SkString UnderJoin(const char* a, const char* b);
16
17 // "foo_bar.skp" -> "foo-bar_skp"
18 SkString FileToTaskName(SkString);
19
20 // Draw gm to picture.  If skr is true, uses EXPERIMENTAL_beginRecording().
21 SkPicture* RecordPicture(skiagm::GM* gm,
22                          SkBBHFactory* factory = NULL,
23                          bool skr = false);
24
25 // Allocate an empty bitmap with this size and depth.
26 void AllocatePixels(SkColorType, int w, int h, SkBitmap* bitmap);
27 // Allocate an empty bitmap the same size and depth as reference.
28 void AllocatePixels(const SkBitmap& reference, SkBitmap* bitmap);
29
30 // Draw picture to bitmap.
31 void DrawPicture(const SkPicture& picture, SkBitmap* bitmap);
32
33 // What is the maximum component difference in these bitmaps?
34 unsigned MaxComponentDifference(const SkBitmap& a, const SkBitmap& b);
35
36 // Are these identical bitmaps?
37 bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b);
38
39 }  // namespace DM
40
41 #endif  // DMUtil_DEFINED