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

Side by Side Diff: dm/DMReplayTask.cpp

Issue 26468005: Fix DM build failures. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: declare tool_main 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
« no previous file with comments | « dm/DMGpuTask.cpp ('k') | gyp/everything.gyp » ('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 "DMReplayTask.h" 1 #include "DMReplayTask.h"
2 #include "DMUtil.h" 2 #include "DMUtil.h"
3 3
4 #include "SkPicture.h" 4 #include "SkPicture.h"
5 5
6 namespace DM { 6 namespace DM {
7 7
8 ReplayTask::ReplayTask(const char* suffix, 8 ReplayTask::ReplayTask(const char* suffix,
9 const Task& parent, 9 const Task& parent,
10 skiagm::GM* gm, 10 skiagm::GM* gm,
11 skiagm::GmResultDigest reference, 11 skiagm::GmResultDigest reference,
12 SkBitmap::Config config) 12 SkBitmap::Config config)
13 : Task(parent) 13 : Task(parent)
14 , fName(underJoin(parent.name().c_str(), suffix)) 14 , fName(underJoin(parent.name().c_str(), suffix))
15 , fGM(gm) 15 , fGM(gm)
16 , fReference(reference) 16 , fReference(reference)
17 , fConfig(config) 17 , fConfig(config)
18 {} 18 {}
19 19
20 void ReplayTask::draw() { 20 void ReplayTask::draw() {
21 SkPicture picture; 21 SkPicture picture;
22 SkCanvas* canvas = picture.beginRecording(fGM->width(), fGM->height(), 0 /*f lags*/); 22 SkCanvas* canvas = picture.beginRecording(SkScalarCeilToInt(fGM->width()),
23 SkScalarCeilToInt(fGM->height()),
24 0 /*flags*/);
23 25
24 canvas->concat(fGM->getInitialTransform()); 26 canvas->concat(fGM->getInitialTransform());
25 fGM->draw(canvas); 27 fGM->draw(canvas);
26 canvas->flush(); 28 canvas->flush();
27 29
28 picture.endRecording(); 30 picture.endRecording();
29 31
30 SkBitmap bitmap; 32 SkBitmap bitmap;
31 bitmap.setConfig(fConfig, fGM->width(), fGM->height()); 33 bitmap.setConfig(fConfig, SkScalarCeilToInt(fGM->width()), SkScalarCeilToInt (fGM->height()));
32 bitmap.allocPixels(); 34 bitmap.allocPixels();
33 bitmap.eraseColor(0x00000000); 35 bitmap.eraseColor(0x00000000);
34 36
35 SkCanvas replay(bitmap); 37 SkCanvas replay(bitmap);
36 replay.drawPicture(picture); 38 replay.drawPicture(picture);
37 replay.flush(); 39 replay.flush();
38 40
39 const skiagm::GmResultDigest replayDigest(bitmap); 41 const skiagm::GmResultDigest replayDigest(bitmap);
40 if (!replayDigest.equals(fReference)) { 42 if (!replayDigest.equals(fReference)) {
41 this->fail(); 43 this->fail();
42 } 44 }
43 } 45 }
44 46
45 bool ReplayTask::shouldSkip() const { 47 bool ReplayTask::shouldSkip() const {
46 return fGM->getFlags() & skiagm::GM::kGPUOnly_Flag || 48 return fGM->getFlags() & skiagm::GM::kGPUOnly_Flag ||
47 fGM->getFlags() & skiagm::GM::kSkipPicture_Flag; 49 fGM->getFlags() & skiagm::GM::kSkipPicture_Flag;
48 } 50 }
49 51
50 } // namespace 52 } // namespace
OLDNEW
« no previous file with comments | « dm/DMGpuTask.cpp ('k') | gyp/everything.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698