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

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

Issue 878653004: Add a flag to flush the canvases during SkMultiPictureDraw::draw(). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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 | « include/core/SkMultiPictureDraw.h ('k') | 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 // 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 88
89 void SkMultiPictureDraw::draw() { 89 void SkMultiPictureDraw::draw(bool flush) {
90 AutoMPDReset mpdreset(this); 90 AutoMPDReset mpdreset(this);
91 91
92 #ifdef FORCE_SINGLE_THREAD_DRAWING_FOR_TESTING 92 #ifdef FORCE_SINGLE_THREAD_DRAWING_FOR_TESTING
93 for (int i = 0; i < fThreadSafeDrawData.count(); ++i) { 93 for (int i = 0; i < fThreadSafeDrawData.count(); ++i) {
94 DrawData* dd = &fThreadSafeDrawData.begin()[i]; 94 DrawData* dd = &fThreadSafeDrawData.begin()[i];
95 dd->fCanvas->drawPicture(dd->fPicture, &dd->fMatrix, dd->fPaint); 95 dd->fCanvas->drawPicture(dd->fPicture, &dd->fMatrix, dd->fPaint);
96 } 96 }
97 #else 97 #else
98 // we place the taskgroup after the MPDReset, to ensure that we don't delete the DrawData 98 // we place the taskgroup after the MPDReset, to ensure that we don't delete the DrawData
99 // objects until after we're finished the tasks (which have pointers to the data). 99 // objects until after we're finished the tasks (which have pointers to the data).
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 GrLayerHoister::UnlockLayers(context, needRendering); 185 GrLayerHoister::UnlockLayers(context, needRendering);
186 GrLayerHoister::UnlockLayers(context, recycled); 186 GrLayerHoister::UnlockLayers(context, recycled);
187 187
188 needRendering.rewind(); 188 needRendering.rewind();
189 recycled.rewind(); 189 recycled.rewind();
190 } else 190 } else
191 #endif 191 #endif
192 { 192 {
193 canvas->drawPicture(picture, &data.fMatrix, data.fPaint); 193 canvas->drawPicture(picture, &data.fMatrix, data.fPaint);
194 } 194 }
195 if (flush) {
196 canvas->flush();
197 }
195 } 198 }
196 199
197 #if !defined(SK_IGNORE_GPU_LAYER_HOISTING) && SK_SUPPORT_GPU 200 #if !defined(SK_IGNORE_GPU_LAYER_HOISTING) && SK_SUPPORT_GPU
198 GrLayerHoister::UnlockLayers(context, atlasedNeedRendering); 201 GrLayerHoister::UnlockLayers(context, atlasedNeedRendering);
199 GrLayerHoister::UnlockLayers(context, atlasedRecycled); 202 GrLayerHoister::UnlockLayers(context, atlasedRecycled);
200 #if !GR_CACHE_HOISTED_LAYERS 203 #if !GR_CACHE_HOISTED_LAYERS
201 GrLayerHoister::PurgeCache(context); 204 GrLayerHoister::PurgeCache(context);
202 #endif 205 #endif
203 #endif 206 #endif
204 } 207 }
205 208
OLDNEW
« no previous file with comments | « include/core/SkMultiPictureDraw.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698