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

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

Issue 641943005: use SkTaskGroup for multidraw (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: enable tasks in sampeapp (hack) 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
« samplecode/SampleApp.cpp ('K') | « samplecode/SampleApp.cpp ('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 #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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 if (paint) { 51 if (paint) {
52 data->paint = SkNEW_ARGS(SkPaint, (*paint)); 52 data->paint = SkNEW_ARGS(SkPaint, (*paint));
53 } else { 53 } else {
54 data->paint = NULL; 54 data->paint = NULL;
55 } 55 }
56 } 56 }
57 57
58 #undef SK_IGNORE_GPU_LAYER_HOISTING 58 #undef SK_IGNORE_GPU_LAYER_HOISTING
59 #define SK_IGNORE_GPU_LAYER_HOISTING 1 59 #define SK_IGNORE_GPU_LAYER_HOISTING 1
60 60
61 #include "SkTaskGroup.h"
62
robertphillips 2014/10/27 12:34:05 a struct?
63 struct PictureDrawRunnable : public SkRunnable {
64 SkCanvas* fCanvas;
65 const SkPicture* fPicture;
66 const SkMatrix* fMatrix;
67 const SkPaint* fPaint;
68
69 void init(SkCanvas* canvas, const SkPicture* picture, const SkMatrix* matrix ,
70 const SkPaint* paint) {
71 fCanvas = canvas;
72 fPicture = picture;
73 fMatrix = matrix;
74 fPaint = paint;
75 }
76
77 virtual void run() SK_OVERRIDE {
78 fCanvas->drawPicture(fPicture, fMatrix, fPaint);
79 }
80 };
81
61 void SkMultiPictureDraw::draw() { 82 void SkMultiPictureDraw::draw() {
83
84 if (true) {
85 const int count = fDrawData.count();
86 SkAutoSTArray<32, PictureDrawRunnable> pdr(count);
87 SkTaskGroup group;
88 for (int i = 0; i < count; ++i) {
robertphillips 2014/10/27 12:34:05 It seems like this portion should go with the draw
89 const DrawData& data = fDrawData[i];
90 pdr[i].init(data.canvas, data.picture, &data.matrix, data.paint);
91 group.add(&pdr[i]);
92 }
93 return;
94 }
62 95
63 #ifndef SK_IGNORE_GPU_LAYER_HOISTING 96 #ifndef SK_IGNORE_GPU_LAYER_HOISTING
64 GrContext* context = NULL; 97 GrContext* context = NULL;
65 98
66 SkTDArray<GrHoistedLayer> atlased, nonAtlased, recycled; 99 SkTDArray<GrHoistedLayer> atlased, nonAtlased, recycled;
67 100
68 for (int i = 0; i < fDrawData.count(); ++i) { 101 for (int i = 0; i < fDrawData.count(); ++i) {
69 if (fDrawData[i].canvas->getGrContext() && 102 if (fDrawData[i].canvas->getGrContext() &&
70 !fDrawData[i].paint && fDrawData[i].matrix.isIdentity()) { 103 !fDrawData[i].paint && fDrawData[i].matrix.isIdentity()) {
71 SkASSERT(NULL == context || context == fDrawData[i].canvas->getGrCon text()); 104 SkASSERT(NULL == context || context == fDrawData[i].canvas->getGrCon text());
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 145
113 #ifndef SK_IGNORE_GPU_LAYER_HOISTING 146 #ifndef SK_IGNORE_GPU_LAYER_HOISTING
114 if (NULL != context) { 147 if (NULL != context) {
115 GrLayerHoister::UnlockLayers(context, atlased, nonAtlased, recycled); 148 GrLayerHoister::UnlockLayers(context, atlased, nonAtlased, recycled);
116 } 149 }
117 #endif 150 #endif
118 151
119 this->reset(); 152 this->reset();
120 } 153 }
121 154
OLDNEW
« samplecode/SampleApp.cpp ('K') | « samplecode/SampleApp.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698