OLD | NEW |
1 #include "DMUtil.h" | 1 #include "DMUtil.h" |
2 | 2 |
3 #include "SkColorPriv.h" | 3 #include "SkColorPriv.h" |
4 #include "SkCommandLineFlags.h" | 4 #include "SkCommandLineFlags.h" |
5 #include "SkPicture.h" | 5 #include "SkPicture.h" |
6 #include "SkPictureRecorder.h" | 6 #include "SkPictureRecorder.h" |
7 | 7 |
8 DEFINE_string(matrix, "1 0 0 0 1 0 0 0 1", | 8 DEFINE_string(matrix, "1 0 0 0 1 0 0 0 1", |
9 "Matrix to apply to the canvas before drawing."); | 9 "Matrix to apply to the canvas before drawing."); |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 } | 27 } |
28 | 28 |
29 SkString FileToTaskName(SkString filename) { | 29 SkString FileToTaskName(SkString filename) { |
30 for (size_t i = 0; i < filename.size(); i++) { | 30 for (size_t i = 0; i < filename.size(); i++) { |
31 if ('_' == filename[i]) { filename[i] = '-'; } | 31 if ('_' == filename[i]) { filename[i] = '-'; } |
32 if ('.' == filename[i]) { filename[i] = '_'; } | 32 if ('.' == filename[i]) { filename[i] = '_'; } |
33 } | 33 } |
34 return filename; | 34 return filename; |
35 } | 35 } |
36 | 36 |
37 SkPicture* RecordPicture(skiagm::GM* gm, SkBBHFactory* factory, bool skr) { | 37 SkPicture* RecordPicture(skiagm::GM* gm, SkBBHFactory* factory) { |
38 const SkScalar w = SkIntToScalar(gm->getISize().width()), | 38 const SkScalar w = SkIntToScalar(gm->getISize().width()), |
39 h = SkIntToScalar(gm->getISize().height()); | 39 h = SkIntToScalar(gm->getISize().height()); |
40 SkPictureRecorder recorder; | 40 SkPictureRecorder recorder; |
41 | 41 |
42 SkCanvas* canvas = skr ? recorder.EXPERIMENTAL_beginRecording(w, h, factory) | 42 SkCanvas* canvas = recorder.beginRecording(w, h, factory); |
43 : recorder. DEPRECATED_beginRecording(w, h, factory)
; | |
44 CanvasPreflight(canvas); | 43 CanvasPreflight(canvas); |
45 canvas->concat(gm->getInitialTransform()); | 44 canvas->concat(gm->getInitialTransform()); |
46 gm->draw(canvas); | 45 gm->draw(canvas); |
47 canvas->flush(); | 46 canvas->flush(); |
48 return recorder.endRecording(); | 47 return recorder.endRecording(); |
49 } | 48 } |
50 | 49 |
51 void AllocatePixels(SkColorType ct, int width, int height, SkBitmap* bitmap) { | 50 void AllocatePixels(SkColorType ct, int width, int height, SkBitmap* bitmap) { |
52 bitmap->allocPixels(SkImageInfo::Make(width, height, ct, kPremul_SkAlphaType
)); | 51 bitmap->allocPixels(SkImageInfo::Make(width, height, ct, kPremul_SkAlphaType
)); |
53 bitmap->eraseColor(0x00000000); | 52 bitmap->eraseColor(0x00000000); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 109 |
111 bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b) { | 110 bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b) { |
112 if (a.info() != b.info()) { | 111 if (a.info() != b.info()) { |
113 return false; | 112 return false; |
114 } | 113 } |
115 const SkAutoLockPixels lockA(a), lockB(b); | 114 const SkAutoLockPixels lockA(a), lockB(b); |
116 return 0 == memcmp(a.getPixels(), b.getPixels(), a.getSize()); | 115 return 0 == memcmp(a.getPixels(), b.getPixels(), a.getSize()); |
117 } | 116 } |
118 | 117 |
119 } // namespace DM | 118 } // namespace DM |
OLD | NEW |