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

Side by Side Diff: dm/DMSKPTask.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/DMPDFTask.cpp ('k') | dm/DMUtil.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 "DMRecordTask.h" 1 #include "DMRecordTask.h"
2 #include "DMSKPTask.h" 2 #include "DMSKPTask.h"
3 #include "DMUtil.h" 3 #include "DMUtil.h"
4 #include "DMWriteTask.h" 4 #include "DMWriteTask.h"
5 5
6 namespace DM { 6 namespace DM {
7 7
8 // foo_bar.skp -> foo-bar_skp
9 static SkString filename_to_task_name(SkString filename) {
10 for (size_t i = 0; i < filename.size(); i++) {
11 if ('_' == filename[i]) { filename[i] = '-'; }
12 if ('.' == filename[i]) { filename[i] = '_'; }
13 }
14 return filename;
15 }
16
17 SKPTask::SKPTask(Reporter* r, TaskRunner* tr, SkPicture* pic, SkString filename) 8 SKPTask::SKPTask(Reporter* r, TaskRunner* tr, SkPicture* pic, SkString filename)
18 : CpuTask(r, tr), fPicture(SkRef(pic)), fName(filename_to_task_name(filename )) {} 9 : CpuTask(r, tr), fPicture(SkRef(pic)), fName(FileToTaskName(filename)) {}
19 10
20 void SKPTask::draw() { 11 void SKPTask::draw() {
21 SkBitmap bitmap; 12 SkBitmap bitmap;
22 AllocatePixels(kN32_SkColorType, fPicture->width(), fPicture->height(), &bit map); 13 AllocatePixels(kN32_SkColorType, fPicture->width(), fPicture->height(), &bit map);
23 DrawPicture(fPicture, &bitmap); 14 DrawPicture(fPicture, &bitmap);
24 15
25 this->spawnChild(SkNEW_ARGS(RecordTask, 16 this->spawnChild(SkNEW_ARGS(RecordTask,
26 (*this, fPicture, bitmap, RecordTask::kNoOptimiz e_Mode))); 17 (*this, fPicture, bitmap, RecordTask::kNoOptimiz e_Mode)));
27 this->spawnChild(SkNEW_ARGS(RecordTask, 18 this->spawnChild(SkNEW_ARGS(RecordTask,
28 (*this, fPicture, bitmap, RecordTask::kOptimize_ Mode))); 19 (*this, fPicture, bitmap, RecordTask::kOptimize_ Mode)));
29 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap))); 20 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap)));
30 } 21 }
31 22
32 } // namespace DM 23 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DMPDFTask.cpp ('k') | dm/DMUtil.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698