OLD | NEW |
1 #include "DMUtil.h" | 1 #include "DMUtil.h" |
2 | 2 |
3 #include "SkColorPriv.h" | 3 #include "SkColorPriv.h" |
4 #include "SkPicture.h" | 4 #include "SkPicture.h" |
5 #include "SkPictureRecorder.h" | 5 #include "SkPictureRecorder.h" |
6 | 6 |
7 namespace DM { | 7 namespace DM { |
8 | 8 |
9 SkString UnderJoin(const char* a, const char* b) { | 9 SkString UnderJoin(const char* a, const char* b) { |
10 SkString s; | 10 SkString s; |
(...skipping 17 matching lines...) Expand all Loading... |
28 } | 28 } |
29 | 29 |
30 void AllocatePixels(const SkBitmap& reference, SkBitmap* bitmap) { | 30 void AllocatePixels(const SkBitmap& reference, SkBitmap* bitmap) { |
31 AllocatePixels(reference.colorType(), reference.width(), reference.height(),
bitmap); | 31 AllocatePixels(reference.colorType(), reference.width(), reference.height(),
bitmap); |
32 } | 32 } |
33 | 33 |
34 void DrawPicture(SkPicture* picture, SkBitmap* bitmap) { | 34 void DrawPicture(SkPicture* picture, SkBitmap* bitmap) { |
35 SkASSERT(picture != NULL); | 35 SkASSERT(picture != NULL); |
36 SkASSERT(bitmap != NULL); | 36 SkASSERT(bitmap != NULL); |
37 SkCanvas canvas(*bitmap); | 37 SkCanvas canvas(*bitmap); |
38 canvas.drawPicture(*picture); | 38 canvas.drawPicture(picture); |
39 canvas.flush(); | 39 canvas.flush(); |
40 } | 40 } |
41 | 41 |
42 static void unpack_565(uint16_t pixel, unsigned* r, unsigned* g, unsigned* b) { | 42 static void unpack_565(uint16_t pixel, unsigned* r, unsigned* g, unsigned* b) { |
43 *r = SkGetPackedR16(pixel); | 43 *r = SkGetPackedR16(pixel); |
44 *g = SkGetPackedG16(pixel); | 44 *g = SkGetPackedG16(pixel); |
45 *b = SkGetPackedB16(pixel); | 45 *b = SkGetPackedB16(pixel); |
46 } | 46 } |
47 | 47 |
48 // Returns |a-b|. | 48 // Returns |a-b|. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } | 81 } |
82 | 82 |
83 return max; | 83 return max; |
84 } | 84 } |
85 | 85 |
86 bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b) { | 86 bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b) { |
87 return a.info() == b.info() && 0 == MaxComponentDifference(a, b); | 87 return a.info() == b.info() && 0 == MaxComponentDifference(a, b); |
88 } | 88 } |
89 | 89 |
90 } // namespace DM | 90 } // namespace DM |
OLD | NEW |