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

Side by Side Diff: dm/DMWriteTask.h

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.cpp ('k') | dm/DMWriteTask.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 #ifndef DMWriteTask_DEFINED 1 #ifndef DMWriteTask_DEFINED
2 #define DMWriteTask_DEFINED 2 #define DMWriteTask_DEFINED
3 3
4 #include "DMExpectations.h"
4 #include "DMTask.h" 5 #include "DMTask.h"
5 #include "SkBitmap.h" 6 #include "SkBitmap.h"
6 #include "SkString.h" 7 #include "SkString.h"
7 #include "SkTArray.h" 8 #include "SkTArray.h"
8 9
10
9 // Writes a bitmap to a file. 11 // Writes a bitmap to a file.
10 12
11 namespace DM { 13 namespace DM {
12 14
13 class WriteTask : public Task { 15 class WriteTask : public Task {
14 16
15 public: 17 public:
16 WriteTask(const Task& parent, // WriteTask must be a child Task. Pass its parent here. 18 WriteTask(const Task& parent, // WriteTask must be a child Task. Pass its parent here.
17 SkBitmap bitmap); // Bitmap to write. 19 SkBitmap bitmap); // Bitmap to write.
18 20
19 virtual void draw() SK_OVERRIDE; 21 virtual void draw() SK_OVERRIDE;
20 virtual bool usesGpu() const SK_OVERRIDE { return false; } 22 virtual bool usesGpu() const SK_OVERRIDE { return false; }
21 virtual bool shouldSkip() const SK_OVERRIDE; 23 virtual bool shouldSkip() const SK_OVERRIDE;
22 virtual SkString name() const SK_OVERRIDE; 24 virtual SkString name() const SK_OVERRIDE;
23 25
26 // Reads image files WriteTask wrote under root and compares them with bitma p.
27 class Expectations : public DM::Expectations {
28 public:
29 explicit Expectations(const char* root) : fRoot(root) {}
30
31 bool check(const Task& task, SkBitmap bitmap) const SK_OVERRIDE;
32 private:
33 const char* fRoot;
34 };
35
24 private: 36 private:
25 SkTArray<SkString> fSuffixes; 37 SkTArray<SkString> fSuffixes;
26 SkString fGmName; 38 SkString fGmName;
27 const SkBitmap fBitmap; 39 const SkBitmap fBitmap;
28 40
29 void makeDirOrFail(SkString dir); 41 void makeDirOrFail(SkString dir);
30 }; 42 };
31 43
32 } // namespace DM 44 } // namespace DM
33 45
34 #endif // DMWriteTask_DEFINED 46 #endif // DMWriteTask_DEFINED
OLDNEW
« no previous file with comments | « dm/DMUtil.cpp ('k') | dm/DMWriteTask.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698