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

Side by Side Diff: dm/DMUtil.cpp

Issue 513983002: Try out scalar picture sizes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update to ToT again Created 6 years, 3 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/DMSKPTask.cpp ('k') | experimental/nanomsg/picture_demo.cpp » ('j') | 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) { 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
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
OLDNEW
« no previous file with comments | « dm/DMSKPTask.cpp ('k') | experimental/nanomsg/picture_demo.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698