Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(510)

Side by Side Diff: dm/DMUtil.cpp

Issue 316643003: DM: SKP source / PDF backend (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: cast Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « dm/DMUtil.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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) {
16 for (size_t i = 0; i < filename.size(); i++) {
17 if ('_' == filename[i]) { filename[i] = '-'; }
18 if ('.' == filename[i]) { filename[i] = '_'; }
19 }
20 return filename;
21 }
22
15 SkPicture* RecordPicture(skiagm::GM* gm, uint32_t recordFlags, SkBBHFactory* fac tory) { 23 SkPicture* RecordPicture(skiagm::GM* gm, uint32_t recordFlags, SkBBHFactory* fac tory) {
16 const SkISize size = gm->getISize(); 24 const SkISize size = gm->getISize();
17 SkPictureRecorder recorder; 25 SkPictureRecorder recorder;
18 SkCanvas* canvas = recorder.beginRecording(size.width(), size.height(), fact ory, recordFlags); 26 SkCanvas* canvas = recorder.beginRecording(size.width(), size.height(), fact ory, recordFlags);
19 canvas->concat(gm->getInitialTransform()); 27 canvas->concat(gm->getInitialTransform());
20 gm->draw(canvas); 28 gm->draw(canvas);
21 canvas->flush(); 29 canvas->flush();
22 return recorder.endRecording(); 30 return recorder.endRecording();
23 } 31 }
24 32
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 93
86 bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b) { 94 bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b) {
87 if (a.info() != b.info()) { 95 if (a.info() != b.info()) {
88 return false; 96 return false;
89 } 97 }
90 const SkAutoLockPixels lockA(a), lockB(b); 98 const SkAutoLockPixels lockA(a), lockB(b);
91 return 0 == memcmp(a.getPixels(), b.getPixels(), a.getSize()); 99 return 0 == memcmp(a.getPixels(), b.getPixels(), a.getSize());
92 } 100 }
93 101
94 } // namespace DM 102 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DMUtil.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698