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

Side by Side Diff: dm/DMReplayTask.cpp

Issue 22839016: Skeleton of DM (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: missed one Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 #include "DMReplayTask.h"
2 #include "DMUtil.h"
3
4 #include "SkPicture.h"
5
6 namespace DM {
7
8 ReplayTask::ReplayTask(const char* suffix,
9 const Task& parent,
10 skiagm::GM* gm,
11 skiagm::GmResultDigest reference,
12 SkBitmap::Config config)
13 : Task(parent)
14 , fName(underJoin(parent.name().c_str(), suffix))
15 , fGM(gm)
16 , fReference(reference)
17 , fConfig(config)
18 {}
19
20 void ReplayTask::draw() {
21 SkPicture picture;
22 SkCanvas* canvas = picture.beginRecording(fGM->width(), fGM->height(), 0 /*f lags*/);
23
24 canvas->concat(fGM->getInitialTransform());
25 fGM->draw(canvas);
26 canvas->flush();
27
28 picture.endRecording();
29
30 SkBitmap bitmap;
31 bitmap.setConfig(fConfig, fGM->width(), fGM->height());
32 bitmap.allocPixels();
33 bitmap.eraseColor(0x00000000);
34
35 SkCanvas replay(bitmap);
36 replay.drawPicture(picture);
37 replay.flush();
38
39 const skiagm::GmResultDigest replayDigest(bitmap);
40 if (!replayDigest.equals(fReference)) {
41 this->fail();
42 }
43 }
44
45 bool ReplayTask::shouldSkip() const {
46 return fGM->getFlags() & skiagm::GM::kGPUOnly_Flag ||
47 fGM->getFlags() & skiagm::GM::kSkipPicture_Flag;
48 }
49
50 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698