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

Side by Side Diff: src/core/SkMultiPictureDraw.cpp

Issue 688753002: use SkTaskGroup::batch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month 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 | « no previous file | no next file » | 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 2014 Google Inc. 2 * Copyright 2014 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 #if SK_SUPPORT_GPU 8 #if SK_SUPPORT_GPU
9 #include "GrLayerHoister.h" 9 #include "GrLayerHoister.h"
10 #include "GrRecordReplaceDraw.h" 10 #include "GrRecordReplaceDraw.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 AutoMPDReset(SkMultiPictureDraw* mpd) : fMPD(mpd) {} 80 AutoMPDReset(SkMultiPictureDraw* mpd) : fMPD(mpd) {}
81 ~AutoMPDReset() { fMPD->reset(); } 81 ~AutoMPDReset() { fMPD->reset(); }
82 }; 82 };
83 83
84 void SkMultiPictureDraw::draw() { 84 void SkMultiPictureDraw::draw() {
85 AutoMPDReset mpdreset(this); 85 AutoMPDReset mpdreset(this);
86 // we place the taskgroup after the MPDReset, to ensure that we don't delete the DrawData 86 // we place the taskgroup after the MPDReset, to ensure that we don't delete the DrawData
87 // objects until after we're finished the tasks (which have pointers to the data). 87 // objects until after we're finished the tasks (which have pointers to the data).
88 88
89 SkTaskGroup group; 89 SkTaskGroup group;
90 for (int i = 0; i < fThreadSafeDrawData.count(); ++i) { 90 group.batch(DrawData::Draw, fThreadSafeDrawData.begin(), fThreadSafeDrawData .count());
91 group.add(DrawData::Draw, &fThreadSafeDrawData[i]);
92 }
93 // we deliberately don't call wait() here, since the destructor will do that , this allows us 91 // we deliberately don't call wait() here, since the destructor will do that , this allows us
94 // to continue processing gpu-data without having to wait on the cpu tasks. 92 // to continue processing gpu-data without having to wait on the cpu tasks.
95 93
96 const int count = fGPUDrawData.count(); 94 const int count = fGPUDrawData.count();
97 if (0 == count) { 95 if (0 == count) {
98 return; 96 return;
99 } 97 }
100 98
101 #ifndef SK_IGNORE_GPU_LAYER_HOISTING 99 #ifndef SK_IGNORE_GPU_LAYER_HOISTING
102 GrContext* context = fGPUDrawData[0].fCanvas->getGrContext(); 100 GrContext* context = fGPUDrawData[0].fCanvas->getGrContext();
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 179
182 #ifndef SK_IGNORE_GPU_LAYER_HOISTING 180 #ifndef SK_IGNORE_GPU_LAYER_HOISTING
183 GrLayerHoister::UnlockLayers(context, atlasedNeedRendering); 181 GrLayerHoister::UnlockLayers(context, atlasedNeedRendering);
184 GrLayerHoister::UnlockLayers(context, atlasedRecycled); 182 GrLayerHoister::UnlockLayers(context, atlasedRecycled);
185 #if !GR_CACHE_HOISTED_LAYERS 183 #if !GR_CACHE_HOISTED_LAYERS
186 GrLayerHoister::PurgeCache(context); 184 GrLayerHoister::PurgeCache(context);
187 #endif 185 #endif
188 #endif 186 #endif
189 } 187 }
190 188
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698