OLD | NEW |
1 #include "DMQuiltTask.h" | 1 #include "DMQuiltTask.h" |
2 #include "DMUtil.h" | 2 #include "DMUtil.h" |
3 #include "DMWriteTask.h" | 3 #include "DMWriteTask.h" |
4 | 4 |
5 #include "SkBBHFactory.h" | 5 #include "SkBBHFactory.h" |
6 #include "SkCommandLineFlags.h" | 6 #include "SkCommandLineFlags.h" |
7 #include "SkPicture.h" | 7 #include "SkPicture.h" |
8 #include "SkTaskGroup.h" | 8 #include "SkTaskGroup.h" |
9 | 9 |
10 DEFINE_bool(quilt, true, "If true, draw GM via a picture into a quilt of small t
iles and compare."); | 10 DEFINE_bool(quilt, true, "If true, draw GM via a picture into a quilt of small t
iles and compare."); |
11 DEFINE_int32(quiltTile, 256, "Dimension of (square) quilt tile."); | 11 DEFINE_int32(quiltTile, 256, "Dimension of (square) quilt tile."); |
12 | 12 |
13 namespace DM { | 13 namespace DM { |
14 | 14 |
15 static SkString suffix(QuiltTask::Backend backend, QuiltTask::BBH bbh) { | 15 static const char* kBBHs[] = { "nobbh", "rtree", "tilegrid" }; |
16 static const char* kBackends[] = { "default", "skrecord" }; | 16 QuiltTask::QuiltTask(const Task& parent, skiagm::GM* gm, SkBitmap reference, Qui
ltTask::BBH bbh) |
17 static const char* kBBHs[] = { "nobbh", "rtree", "tilegrid" }; | |
18 return SkStringPrintf("%s-%s", kBackends[backend], kBBHs[bbh]); | |
19 } | |
20 | |
21 QuiltTask::QuiltTask(const Task& parent, skiagm::GM* gm, SkBitmap reference, | |
22 QuiltTask::BBH bbh, QuiltTask::Backend backend) | |
23 : CpuTask(parent) | 17 : CpuTask(parent) |
24 , fBBH(bbh) | 18 , fBBH(bbh) |
25 , fBackend(backend) | 19 , fName(UnderJoin(parent.name().c_str(), kBBHs[bbh])) |
26 , fName(UnderJoin(parent.name().c_str(), suffix(backend, bbh).c_str())) | |
27 , fGM(gm) | 20 , fGM(gm) |
28 , fReference(reference) | 21 , fReference(reference) |
29 {} | 22 {} |
30 | 23 |
31 static int tiles_needed(int fullDimension, int tileDimension) { | 24 static int tiles_needed(int fullDimension, int tileDimension) { |
32 return (fullDimension + tileDimension - 1) / tileDimension; | 25 return (fullDimension + tileDimension - 1) / tileDimension; |
33 } | 26 } |
34 | 27 |
35 class Tile : public SkRunnable { | 28 class Tile : public SkRunnable { |
36 public: | 29 public: |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } | 69 } |
77 } | 70 } |
78 | 71 |
79 // A couple GMs draw wrong when using a bounding box hierarchy. | 72 // A couple GMs draw wrong when using a bounding box hierarchy. |
80 // This almost certainly means we have a bug to fix, but for now | 73 // This almost certainly means we have a bug to fix, but for now |
81 // just draw without a bounding box hierarchy. | 74 // just draw without a bounding box hierarchy. |
82 if (fGM->getFlags() & skiagm::GM::kNoBBH_Flag) { | 75 if (fGM->getFlags() & skiagm::GM::kNoBBH_Flag) { |
83 factory.reset(NULL); | 76 factory.reset(NULL); |
84 } | 77 } |
85 | 78 |
86 SkAutoTUnref<const SkPicture> recorded( | 79 SkAutoTUnref<const SkPicture> recorded(RecordPicture(fGM.get(), factory.get(
))); |
87 RecordPicture(fGM.get(), factory.get(), kSkRecord_Backend == fBacken
d)); | |
88 | 80 |
89 SkBitmap full; | 81 SkBitmap full; |
90 AllocatePixels(fReference, &full); | 82 AllocatePixels(fReference, &full); |
91 | 83 |
92 if (fGM->getFlags() & skiagm::GM::kSkipTiled_Flag) { | 84 if (fGM->getFlags() & skiagm::GM::kSkipTiled_Flag) { |
93 // Some GMs don't draw exactly the same when tiled. Draw them in one go
. | 85 // Some GMs don't draw exactly the same when tiled. Draw them in one go
. |
94 SkCanvas canvas(full); | 86 SkCanvas canvas(full); |
95 recorded->playback(&canvas); | 87 recorded->playback(&canvas); |
96 canvas.flush(); | 88 canvas.flush(); |
97 } else { | 89 } else { |
(...skipping 14 matching lines...) Expand all Loading... |
112 } | 104 } |
113 | 105 |
114 bool QuiltTask::shouldSkip() const { | 106 bool QuiltTask::shouldSkip() const { |
115 if (fGM->getFlags() & skiagm::GM::kSkipPicture_Flag) { | 107 if (fGM->getFlags() & skiagm::GM::kSkipPicture_Flag) { |
116 return true; | 108 return true; |
117 } | 109 } |
118 return !FLAGS_quilt; | 110 return !FLAGS_quilt; |
119 } | 111 } |
120 | 112 |
121 } // namespace DM | 113 } // namespace DM |
OLD | NEW |