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

Side by Side Diff: dm/DMRecordTask.cpp

Issue 248033002: Rearrange SkRecord public API to fit better with cc/resources/picture (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add forgetRecord() Created 6 years, 8 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 | « no previous file | include/record/SkRecording.h » ('j') | include/record/SkRecording.h » ('J')
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 "DMUtil.h" 2 #include "DMUtil.h"
3 #include "DMWriteTask.h" 3 #include "DMWriteTask.h"
4 #include "SkCommandLineFlags.h" 4 #include "SkCommandLineFlags.h"
5 #include "SkRecording.h" 5 #include "SkRecording.h"
6 6
7 DEFINE_bool(skr, false, "If true, run SKR tests."); 7 DEFINE_bool(skr, false, "If true, run SKR tests.");
8 8
9 namespace DM { 9 namespace DM {
10 10
11 RecordTask::RecordTask(const Task& parent, skiagm::GM* gm, SkBitmap reference) 11 RecordTask::RecordTask(const Task& parent, skiagm::GM* gm, SkBitmap reference)
12 : CpuTask(parent) 12 : CpuTask(parent)
13 , fName(UnderJoin(parent.name().c_str(), "skr")) 13 , fName(UnderJoin(parent.name().c_str(), "skr"))
14 , fGM(gm) 14 , fGM(gm)
15 , fReference(reference) 15 , fReference(reference)
16 {} 16 {}
17 17
18 void RecordTask::draw() { 18 void RecordTask::draw() {
19 using EXPERIMENTAL::SkRecording;
20 using EXPERIMENTAL::SkPlayback;
21
22 // Record the GM into an SkRecord. 19 // Record the GM into an SkRecord.
23 SkRecording* recording = SkRecording::Create(fReference.width(), fReference. height()); 20 EXPERIMENTAL::SkRecording recording(fReference.width(), fReference.height()) ;
24 fGM->draw(recording->canvas()); 21 fGM->draw(recording.canvas());
25 SkAutoTDelete<const SkPlayback> playback(SkRecording::Delete(recording)); 22 SkAutoTDelete<const EXPERIMENTAL::SkPlayback> playback(recording.releasePlay back());
26 23
27 // Draw the SkRecord back into a bitmap. 24 // Draw the SkRecord back into a bitmap.
28 SkBitmap bitmap; 25 SkBitmap bitmap;
29 SetupBitmap(fReference.colorType(), fGM.get(), &bitmap); 26 SetupBitmap(fReference.colorType(), fGM.get(), &bitmap);
30 SkCanvas target(bitmap); 27 SkCanvas target(bitmap);
31 playback->draw(&target); 28 playback->draw(&target);
32 29
33 if (!BitmapsEqual(bitmap, fReference)) { 30 if (!BitmapsEqual(bitmap, fReference)) {
34 this->fail(); 31 this->fail();
35 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap))); 32 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap)));
36 } 33 }
37 } 34 }
38 35
39 bool RecordTask::shouldSkip() const { 36 bool RecordTask::shouldSkip() const {
40 return !FLAGS_skr; 37 return !FLAGS_skr;
41 } 38 }
42 39
43 } // namespace DM 40 } // namespace DM
OLDNEW
« no previous file with comments | « no previous file | include/record/SkRecording.h » ('j') | include/record/SkRecording.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698