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

Side by Side Diff: tests/PathOpsSkpClipTest.cpp

Issue 1184373003: Add sk_parallel_for() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix Created 5 years, 6 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 | « tests/PathOpsExtendedTest.cpp ('k') | tests/PathOpsThreadedCommon.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 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "CrashHandler.h" 8 #include "CrashHandler.h"
9 // #include "OverwriteLine.h" 9 // #include "OverwriteLine.h"
10 #include "Resources.h" 10 #include "Resources.h"
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 } 296 }
297 }; 297 };
298 298
299 TestRunner::~TestRunner() { 299 TestRunner::~TestRunner() {
300 for (int index = 0; index < fRunnables.count(); index++) { 300 for (int index = 0; index < fRunnables.count(); index++) {
301 SkDELETE(fRunnables[index]); 301 SkDELETE(fRunnables[index]);
302 } 302 }
303 } 303 }
304 304
305 void TestRunner::render() { 305 void TestRunner::render() {
306 SkTaskGroup tg; 306 // TODO: this doesn't really need to use SkRunnables any more.
307 for (int index = 0; index < fRunnables.count(); ++ index) { 307 // We can just write the code to run in the for-loop directly.
308 tg.add(fRunnables[index]); 308 sk_parallel_for(fRunnables.count(), [&](int i) {
309 } 309 fRunnables[i]->run();
310 });
310 } 311 }
311 312
312 //////////////////////////////////////////////// 313 ////////////////////////////////////////////////
313 314
314 315
315 static int similarBits(const SkBitmap& gr, const SkBitmap& sk) { 316 static int similarBits(const SkBitmap& gr, const SkBitmap& sk) {
316 const int kRowCount = 3; 317 const int kRowCount = 3;
317 const int kThreshold = 3; 318 const int kThreshold = 3;
318 int width = SkTMin(gr.width(), sk.width()); 319 int width = SkTMin(gr.width(), sk.width());
319 if (width < kRowCount) { 320 if (width < kRowCount) {
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 } 1105 }
1105 SkGraphics::Term(); 1106 SkGraphics::Term();
1106 return 0; 1107 return 0;
1107 } 1108 }
1108 1109
1109 #if !defined(SK_BUILD_FOR_IOS) 1110 #if !defined(SK_BUILD_FOR_IOS)
1110 int main(int argc, char * const argv[]) { 1111 int main(int argc, char * const argv[]) {
1111 return tool_main(argc, (char**) argv); 1112 return tool_main(argc, (char**) argv);
1112 } 1113 }
1113 #endif 1114 #endif
OLDNEW
« no previous file with comments | « tests/PathOpsExtendedTest.cpp ('k') | tests/PathOpsThreadedCommon.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698