| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 public: | 79 public: |
| 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 #if 0 |
| 89 SkTaskGroup group; | 90 SkTaskGroup group; |
| 90 group.batch(DrawData::Draw, fThreadSafeDrawData.begin(), fThreadSafeDrawData
.count()); | 91 group.batch(DrawData::Draw, fThreadSafeDrawData.begin(), fThreadSafeDrawData
.count()); |
| 91 // we deliberately don't call wait() here, since the destructor will do that
, this allows us | 92 // we deliberately don't call wait() here, since the destructor will do that
, this allows us |
| 92 // to continue processing gpu-data without having to wait on the cpu tasks. | 93 // to continue processing gpu-data without having to wait on the cpu tasks. |
| 94 #else |
| 95 for (int i = 0; i < fThreadSafeDrawData.count(); i++) { |
| 96 DrawData::Draw(&fThreadSafeDrawData[i]); |
| 97 } |
| 98 #endif |
| 93 | 99 |
| 94 const int count = fGPUDrawData.count(); | 100 const int count = fGPUDrawData.count(); |
| 95 if (0 == count) { | 101 if (0 == count) { |
| 96 return; | 102 return; |
| 97 } | 103 } |
| 98 | 104 |
| 99 #ifndef SK_IGNORE_GPU_LAYER_HOISTING | 105 #ifndef SK_IGNORE_GPU_LAYER_HOISTING |
| 100 GrContext* context = fGPUDrawData[0].fCanvas->getGrContext(); | 106 GrContext* context = fGPUDrawData[0].fCanvas->getGrContext(); |
| 101 SkASSERT(context); | 107 SkASSERT(context); |
| 102 | 108 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 185 |
| 180 #ifndef SK_IGNORE_GPU_LAYER_HOISTING | 186 #ifndef SK_IGNORE_GPU_LAYER_HOISTING |
| 181 GrLayerHoister::UnlockLayers(context, atlasedNeedRendering); | 187 GrLayerHoister::UnlockLayers(context, atlasedNeedRendering); |
| 182 GrLayerHoister::UnlockLayers(context, atlasedRecycled); | 188 GrLayerHoister::UnlockLayers(context, atlasedRecycled); |
| 183 #if !GR_CACHE_HOISTED_LAYERS | 189 #if !GR_CACHE_HOISTED_LAYERS |
| 184 GrLayerHoister::PurgeCache(context); | 190 GrLayerHoister::PurgeCache(context); |
| 185 #endif | 191 #endif |
| 186 #endif | 192 #endif |
| 187 } | 193 } |
| 188 | 194 |
| OLD | NEW |