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; |
11 s.appendf("%s_%s", a, b); | 11 s.appendf("%s_%s", a, b); |
12 return s; | 12 return s; |
13 } | 13 } |
14 | 14 |
15 SkString FileToTaskName(SkString filename) { | 15 SkString FileToTaskName(SkString filename) { |
16 for (size_t i = 0; i < filename.size(); i++) { | 16 for (size_t i = 0; i < filename.size(); i++) { |
17 if ('_' == filename[i]) { filename[i] = '-'; } | 17 if ('_' == filename[i]) { filename[i] = '-'; } |
18 if ('.' == filename[i]) { filename[i] = '_'; } | 18 if ('.' == filename[i]) { filename[i] = '_'; } |
19 } | 19 } |
20 return filename; | 20 return filename; |
21 } | 21 } |
22 | 22 |
23 SkPicture* RecordPicture(skiagm::GM* gm, SkBBHFactory* factory, bool skr) { | 23 SkPicture* RecordPicture(skiagm::GM* gm, SkBBHFactory* factory, bool skr) { |
24 const int w = gm->getISize().width(), | 24 const SkScalar w = SkIntToScalar(gm->getISize().width()), |
25 h = gm->getISize().height(); | 25 h = SkIntToScalar(gm->getISize().height()); |
26 SkPictureRecorder recorder; | 26 SkPictureRecorder recorder; |
27 | 27 |
28 SkCanvas* canvas = skr ? recorder.EXPERIMENTAL_beginRecording(w, h, factory) | 28 SkCanvas* canvas = skr ? recorder.EXPERIMENTAL_beginRecording(w, h, factory) |
29 : recorder. DEPRECATED_beginRecording(w, h, factory)
; | 29 : recorder. DEPRECATED_beginRecording(w, h, factory)
; |
30 canvas->concat(gm->getInitialTransform()); | 30 canvas->concat(gm->getInitialTransform()); |
31 gm->draw(canvas); | 31 gm->draw(canvas); |
32 canvas->flush(); | 32 canvas->flush(); |
33 return recorder.endRecording(); | 33 return recorder.endRecording(); |
34 } | 34 } |
35 | 35 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b) { | 96 bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b) { |
97 if (a.info() != b.info()) { | 97 if (a.info() != b.info()) { |
98 return false; | 98 return false; |
99 } | 99 } |
100 const SkAutoLockPixels lockA(a), lockB(b); | 100 const SkAutoLockPixels lockA(a), lockB(b); |
101 return 0 == memcmp(a.getPixels(), b.getPixels(), a.getSize()); | 101 return 0 == memcmp(a.getPixels(), b.getPixels(), a.getSize()); |
102 } | 102 } |
103 | 103 |
104 } // namespace DM | 104 } // namespace DM |
OLD | NEW |