| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |