| 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 // Need to include something before #if SK_SUPPORT_GPU so that the Android | 8 // Need to include something before #if SK_SUPPORT_GPU so that the Android |
| 9 // framework build, which gets its defines from SkTypes rather than a makefile, | 9 // framework build, which gets its defines from SkTypes rather than a makefile, |
| 10 // has the definition before checking it. | 10 // has the definition before checking it. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 } | 78 } |
| 79 | 79 |
| 80 class AutoMPDReset : SkNoncopyable { | 80 class AutoMPDReset : SkNoncopyable { |
| 81 SkMultiPictureDraw* fMPD; | 81 SkMultiPictureDraw* fMPD; |
| 82 public: | 82 public: |
| 83 AutoMPDReset(SkMultiPictureDraw* mpd) : fMPD(mpd) {} | 83 AutoMPDReset(SkMultiPictureDraw* mpd) : fMPD(mpd) {} |
| 84 ~AutoMPDReset() { fMPD->reset(); } | 84 ~AutoMPDReset() { fMPD->reset(); } |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 //#define FORCE_SINGLE_THREAD_DRAWING_FOR_TESTING | 87 //#define FORCE_SINGLE_THREAD_DRAWING_FOR_TESTING |
| 88 #define SK_IGNORE_GPU_LAYER_HOISTING 1 |
| 88 | 89 |
| 89 void SkMultiPictureDraw::draw(bool flush) { | 90 void SkMultiPictureDraw::draw(bool flush) { |
| 90 AutoMPDReset mpdreset(this); | 91 AutoMPDReset mpdreset(this); |
| 91 | 92 |
| 92 #ifdef FORCE_SINGLE_THREAD_DRAWING_FOR_TESTING | 93 #ifdef FORCE_SINGLE_THREAD_DRAWING_FOR_TESTING |
| 93 for (int i = 0; i < fThreadSafeDrawData.count(); ++i) { | 94 for (int i = 0; i < fThreadSafeDrawData.count(); ++i) { |
| 94 fThreadSafeDrawData[i].draw(); | 95 fThreadSafeDrawData[i].draw(); |
| 95 } | 96 } |
| 96 #else | 97 #else |
| 97 sk_parallel_for(fThreadSafeDrawData.count(), [&](int i) { | 98 sk_parallel_for(fThreadSafeDrawData.count(), [&](int i) { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 } | 199 } |
| 199 } | 200 } |
| 200 | 201 |
| 201 #if !defined(SK_IGNORE_GPU_LAYER_HOISTING) && SK_SUPPORT_GPU | 202 #if !defined(SK_IGNORE_GPU_LAYER_HOISTING) && SK_SUPPORT_GPU |
| 202 GrLayerHoister::UnlockLayers(context, atlasedNeedRendering); | 203 GrLayerHoister::UnlockLayers(context, atlasedNeedRendering); |
| 203 GrLayerHoister::UnlockLayers(context, atlasedRecycled); | 204 GrLayerHoister::UnlockLayers(context, atlasedRecycled); |
| 204 GrLayerHoister::End(context); | 205 GrLayerHoister::End(context); |
| 205 #endif | 206 #endif |
| 206 } | 207 } |
| 207 | 208 |
| OLD | NEW |