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

Side by Side Diff: dm/DMWriteTask.h

Issue 312873002: DM: add pdf (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: put cutils back 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
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 "DMExpectations.h"
5 #include "DMTask.h" 5 #include "DMTask.h"
6 #include "SkBitmap.h" 6 #include "SkBitmap.h"
7 #include "SkString.h" 7 #include "SkString.h"
8 #include "SkTArray.h" 8 #include "SkTArray.h"
9 9
10 10
11 // Writes a bitmap to a file. 11 // Writes a bitmap to a file.
12 12
13 namespace DM { 13 namespace DM {
14 14
15 class WriteTask : public CpuTask { 15 class WriteTask : public CpuTask {
16 16
17 public: 17 public:
18 WriteTask(const Task& parent, // WriteTask must be a child Task. Pass it s parent here. 18 WriteTask(const Task& parent, // WriteTask must be a child task.
19 SkBitmap bitmap); // Bitmap to write. 19 SkBitmap bitmap); // Bitmap to encode to PNG and write to disk.
20
21 WriteTask(const Task& parent, // WriteTask must be a child task.
22 SkData *data, // Pre-encoded data to write to disk.
23 const char* ext); // File extension.
20 24
21 virtual void draw() SK_OVERRIDE; 25 virtual void draw() SK_OVERRIDE;
22 virtual bool shouldSkip() const SK_OVERRIDE; 26 virtual bool shouldSkip() const SK_OVERRIDE;
23 virtual SkString name() const SK_OVERRIDE; 27 virtual SkString name() const SK_OVERRIDE;
24 28
25 // Reads image files WriteTask wrote under root and compares them with bitma p. 29 // Reads image files WriteTask wrote under root and compares them with bitma p.
26 class Expectations : public DM::Expectations { 30 class Expectations : public DM::Expectations {
27 public: 31 public:
28 explicit Expectations(const char* root) : fRoot(root) {} 32 explicit Expectations(const char* root) : fRoot(root) {}
29 33
30 bool check(const Task& task, SkBitmap bitmap) const SK_OVERRIDE; 34 bool check(const Task& task, SkBitmap bitmap) const SK_OVERRIDE;
31 private: 35 private:
32 const char* fRoot; 36 const char* fRoot;
33 }; 37 };
34 38
35 private: 39 private:
36 SkTArray<SkString> fSuffixes; 40 SkTArray<SkString> fSuffixes;
37 SkString fGmName; 41 const SkString fGmName;
38 const SkBitmap fBitmap; 42 const SkBitmap fBitmap;
43 SkAutoTUnref<SkData> fData;
44 const char* fExtension;
39 45
40 void makeDirOrFail(SkString dir); 46 void makeDirOrFail(SkString dir);
41 }; 47 };
42 48
43 } // namespace DM 49 } // namespace DM
44 50
45 #endif // DMWriteTask_DEFINED 51 #endif // DMWriteTask_DEFINED
OLDNEW
« dm/DMPDFTask.cpp ('K') | « dm/DMPDFTask.cpp ('k') | dm/DMWriteTask.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698