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

Side by Side Diff: dm/DMQuiltTask.cpp

Issue 540013002: Revert of SkThreadPool ~~> SkTaskGroup (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 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 | « dm/DM.cpp ('k') | dm/DMTask.h » ('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 "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 "SkThreadPool.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 SkString suffix(QuiltTask::Backend backend, QuiltTask::BBH bbh) {
16 static const char* kBackends[] = { "default", "skrecord" }; 16 static const char* kBackends[] = { "default", "skrecord" };
17 static const char* kBBHs[] = { "nobbh", "rtree", "tilegrid" }; 17 static const char* kBBHs[] = { "nobbh", "rtree", "tilegrid" };
18 return SkStringPrintf("%s-%s", kBackends[backend], kBBHs[bbh]); 18 return SkStringPrintf("%s-%s", kBackends[backend], kBBHs[bbh]);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 SkBitmap full; 89 SkBitmap full;
90 AllocatePixels(fReference, &full); 90 AllocatePixels(fReference, &full);
91 91
92 if (fGM->getFlags() & skiagm::GM::kSkipTiled_Flag) { 92 if (fGM->getFlags() & skiagm::GM::kSkipTiled_Flag) {
93 // Some GMs don't draw exactly the same when tiled. Draw them in one go . 93 // Some GMs don't draw exactly the same when tiled. Draw them in one go .
94 SkCanvas canvas(full); 94 SkCanvas canvas(full);
95 recorded->draw(&canvas); 95 recorded->draw(&canvas);
96 canvas.flush(); 96 canvas.flush();
97 } else { 97 } else {
98 // Draw tiles in parallel into the same bitmap, simulating aggressive im pl-side painting. 98 // Draw tiles in parallel into the same bitmap, simulating aggressive im pl-side painting.
99 SkTaskGroup tg; 99 SkThreadPool pool(SkThreadPool::kThreadPerCore);
100 for (int y = 0; y < tiles_needed(full.height(), FLAGS_quiltTile); y++) { 100 for (int y = 0; y < tiles_needed(full.height(), FLAGS_quiltTile); y++) {
101 for (int x = 0; x < tiles_needed(full.width(), FLAGS_quiltTile); x++ ) { 101 for (int x = 0; x < tiles_needed(full.width(), FLAGS_quiltTile); x++ ) {
102 // Deletes itself when done. 102 // Deletes itself when done.
103 tg.add(new Tile(x, y, *recorded, &full)); 103 pool.add(new Tile(x, y, *recorded, &full));
104 } 104 }
105 } 105 }
106 } 106 }
107 107
108 if (!BitmapsEqual(full, fReference)) { 108 if (!BitmapsEqual(full, fReference)) {
109 this->fail(); 109 this->fail();
110 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, full))); 110 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, full)));
111 } 111 }
112 } 112 }
113 113
114 bool QuiltTask::shouldSkip() const { 114 bool QuiltTask::shouldSkip() const {
115 if (fGM->getFlags() & skiagm::GM::kSkipPicture_Flag) { 115 if (fGM->getFlags() & skiagm::GM::kSkipPicture_Flag) {
116 return true; 116 return true;
117 } 117 }
118 return !FLAGS_quilt; 118 return !FLAGS_quilt;
119 } 119 }
120 120
121 } // namespace DM 121 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DM.cpp ('k') | dm/DMTask.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698