OLD | NEW |
1 #include "DMUtil.h" | 1 #include "DMUtil.h" |
2 | 2 |
3 #include "SkPicture.h" | 3 #include "SkPicture.h" |
4 | 4 |
5 namespace DM { | 5 namespace DM { |
6 | 6 |
7 SkString UnderJoin(const char* a, const char* b) { | 7 SkString UnderJoin(const char* a, const char* b) { |
8 SkString s; | 8 SkString s; |
9 s.appendf("%s_%s", a, b); | 9 s.appendf("%s_%s", a, b); |
10 return s; | 10 return s; |
11 } | 11 } |
12 | 12 |
13 SkPicture* RecordPicture(skiagm::GM* gm, uint32_t recordFlags, SkPictureFactory*
factory) { | 13 SkPicture* RecordPicture(skiagm::GM* gm, uint32_t recordFlags, SkBBHFactory* fac
tory) { |
14 const SkISize size = gm->getISize(); | 14 const SkISize size = gm->getISize(); |
15 SkPictureRecorder recorder(factory); | 15 SkPictureRecorder recorder; |
16 SkCanvas* canvas = recorder.beginRecording(size.width(), size.height(), reco
rdFlags); | 16 SkCanvas* canvas = recorder.beginRecording(size.width(), size.height(), fact
ory, recordFlags); |
17 canvas->concat(gm->getInitialTransform()); | 17 canvas->concat(gm->getInitialTransform()); |
18 gm->draw(canvas); | 18 gm->draw(canvas); |
19 canvas->flush(); | 19 canvas->flush(); |
20 return recorder.endRecording(); | 20 return recorder.endRecording(); |
21 } | 21 } |
22 | 22 |
23 static void setup_bitmap(SkColorType ct, int width, int height, SkBitmap* bitmap
) { | 23 static void setup_bitmap(SkColorType ct, int width, int height, SkBitmap* bitmap
) { |
24 bitmap->allocPixels(SkImageInfo::Make(width, height, ct, kPremul_SkAlphaType
)); | 24 bitmap->allocPixels(SkImageInfo::Make(width, height, ct, kPremul_SkAlphaType
)); |
25 bitmap->eraseColor(0x00000000); | 25 bitmap->eraseColor(0x00000000); |
26 } | 26 } |
(...skipping 13 matching lines...) Expand all Loading... |
40 canvas.drawPicture(*picture); | 40 canvas.drawPicture(*picture); |
41 canvas.flush(); | 41 canvas.flush(); |
42 } | 42 } |
43 | 43 |
44 bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b) { | 44 bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b) { |
45 const SkAutoLockPixels lockA(a), lockB(b); | 45 const SkAutoLockPixels lockA(a), lockB(b); |
46 return a.getSize() == b.getSize() && 0 == memcmp(a.getPixels(), b.getPixels(
), b.getSize()); | 46 return a.getSize() == b.getSize() && 0 == memcmp(a.getPixels(), b.getPixels(
), b.getSize()); |
47 } | 47 } |
48 | 48 |
49 } // namespace DM | 49 } // namespace DM |
OLD | NEW |