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

Side by Side Diff: dm/DMUtil.cpp

Issue 108963002: DM: Add support for reading a directory of images with --expectations (-r). (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: comments etc Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « dm/DMUtil.h ('k') | dm/DMWriteTask.h » ('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 "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 SkString Png(SkString s) {
14 s.appendf(".png");
15 return s;
16 }
17
18 void RecordPicture(skiagm::GM* gm, SkPicture* picture, uint32_t recordFlags) { 13 void RecordPicture(skiagm::GM* gm, SkPicture* picture, uint32_t recordFlags) {
19 const SkISize size = gm->getISize(); 14 const SkISize size = gm->getISize();
20 SkCanvas* canvas = picture->beginRecording(size.width(), size.height(), reco rdFlags); 15 SkCanvas* canvas = picture->beginRecording(size.width(), size.height(), reco rdFlags);
21 canvas->concat(gm->getInitialTransform()); 16 canvas->concat(gm->getInitialTransform());
22 gm->draw(canvas); 17 gm->draw(canvas);
23 canvas->flush(); 18 canvas->flush();
24 picture->endRecording(); 19 picture->endRecording();
25 } 20 }
26 21
27 void SetupBitmap(const SkBitmap::Config config, skiagm::GM* gm, SkBitmap* bitmap ) { 22 void SetupBitmap(const SkBitmap::Config config, skiagm::GM* gm, SkBitmap* bitmap ) {
(...skipping 10 matching lines...) Expand all
38 canvas.drawPicture(*picture); 33 canvas.drawPicture(*picture);
39 canvas.flush(); 34 canvas.flush();
40 } 35 }
41 36
42 bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b) { 37 bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b) {
43 const SkAutoLockPixels lockA(a), lockB(b); 38 const SkAutoLockPixels lockA(a), lockB(b);
44 return a.getSize() == b.getSize() && 0 == memcmp(a.getPixels(), b.getPixels( ), b.getSize()); 39 return a.getSize() == b.getSize() && 0 == memcmp(a.getPixels(), b.getPixels( ), b.getSize());
45 } 40 }
46 41
47 } // namespace DM 42 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DMUtil.h ('k') | dm/DMWriteTask.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698