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

Side by Side Diff: dm/DMReplayTask.cpp

Issue 239703006: Retract SkPicture::kOptimizeForClippedPlayback_RecordingFlag from public API (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | gm/gmmain.cpp » ('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 "DMWriteTask.h" 2 #include "DMWriteTask.h"
3 #include "DMUtil.h" 3 #include "DMUtil.h"
4 4
5 #include "SkCommandLineFlags.h" 5 #include "SkCommandLineFlags.h"
6 #include "SkPicture.h" 6 #include "SkPicture.h"
7 #include "SkRTreePicture.h"
7 8
8 DEFINE_bool(replay, true, "If true, run picture replay tests."); 9 DEFINE_bool(replay, true, "If true, run picture replay tests.");
9 DEFINE_bool(rtree, true, "If true, run picture replay tests with an rtree."); 10 DEFINE_bool(rtree, true, "If true, run picture replay tests with an rtree.");
10 11
11 namespace DM { 12 namespace DM {
12 13
13 ReplayTask::ReplayTask(const Task& parent, 14 ReplayTask::ReplayTask(const Task& parent,
14 skiagm::GM* gm, 15 skiagm::GM* gm,
15 SkBitmap reference, 16 SkBitmap reference,
16 bool useRTree) 17 bool useRTree)
17 : CpuTask(parent) 18 : CpuTask(parent)
18 , fName(UnderJoin(parent.name().c_str(), useRTree ? "rtree" : "replay")) 19 , fName(UnderJoin(parent.name().c_str(), useRTree ? "rtree" : "replay"))
19 , fGM(gm) 20 , fGM(gm)
20 , fReference(reference) 21 , fReference(reference)
21 , fUseRTree(useRTree) 22 , fUseRTree(useRTree)
22 {} 23 {}
23 24
24 void ReplayTask::draw() { 25 void ReplayTask::draw() {
25 const uint32_t flags = fUseRTree ? SkPicture::kOptimizeForClippedPlayback_Re cordingFlag : 0; 26 SkAutoTUnref<SkPictureFactory> factory;
26 SkAutoTUnref<SkPicture> recorded(RecordPicture(fGM.get(), flags)); 27 if (fUseRTree) {
28 factory.reset(SkNEW(SkRTreePictureFactory));
29 }
30 SkAutoTUnref<SkPicture> recorded(RecordPicture(fGM.get(), 0, factory));
27 31
28 SkBitmap bitmap; 32 SkBitmap bitmap;
29 SetupBitmap(fReference.colorType(), fGM.get(), &bitmap); 33 SetupBitmap(fReference.colorType(), fGM.get(), &bitmap);
30 DrawPicture(recorded, &bitmap); 34 DrawPicture(recorded, &bitmap);
31 if (!BitmapsEqual(bitmap, fReference)) { 35 if (!BitmapsEqual(bitmap, fReference)) {
32 this->fail(); 36 this->fail();
33 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap))); 37 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap)));
34 } 38 }
35 } 39 }
36 40
37 bool ReplayTask::shouldSkip() const { 41 bool ReplayTask::shouldSkip() const {
38 if (fGM->getFlags() & skiagm::GM::kSkipPicture_Flag) { 42 if (fGM->getFlags() & skiagm::GM::kSkipPicture_Flag) {
39 return true; 43 return true;
40 } 44 }
41 45
42 if (FLAGS_rtree && fUseRTree) { 46 if (FLAGS_rtree && fUseRTree) {
43 return (fGM->getFlags() & skiagm::GM::kSkipTiled_Flag) != 0; 47 return (fGM->getFlags() & skiagm::GM::kSkipTiled_Flag) != 0;
44 } 48 }
45 if (FLAGS_replay && !fUseRTree) { 49 if (FLAGS_replay && !fUseRTree) {
46 return false; 50 return false;
47 } 51 }
48 return true; 52 return true;
49 } 53 }
50 54
51 } // namespace DM 55 } // namespace DM
OLDNEW
« no previous file with comments | « no previous file | gm/gmmain.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698