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

Unified 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, 2 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 side-by-side diff with in-line comments
Download patch
« samplecode/SampleApp.cpp ('K') | « samplecode/SampleApp.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkMultiPictureDraw.cpp
diff --git a/src/core/SkMultiPictureDraw.cpp b/src/core/SkMultiPictureDraw.cpp
index 19b26ca60775e1b03d89cfd34952a936254525d2..1b8cb9c0a6875833598ffa52aef42ff11796e962 100644
--- a/src/core/SkMultiPictureDraw.cpp
+++ b/src/core/SkMultiPictureDraw.cpp
@@ -58,7 +58,40 @@ void SkMultiPictureDraw::add(SkCanvas* canvas,
#undef SK_IGNORE_GPU_LAYER_HOISTING
#define SK_IGNORE_GPU_LAYER_HOISTING 1
+#include "SkTaskGroup.h"
+
robertphillips 2014/10/27 12:34:05 a struct?
+struct PictureDrawRunnable : public SkRunnable {
+ SkCanvas* fCanvas;
+ const SkPicture* fPicture;
+ const SkMatrix* fMatrix;
+ const SkPaint* fPaint;
+
+ void init(SkCanvas* canvas, const SkPicture* picture, const SkMatrix* matrix,
+ const SkPaint* paint) {
+ fCanvas = canvas;
+ fPicture = picture;
+ fMatrix = matrix;
+ fPaint = paint;
+ }
+
+ virtual void run() SK_OVERRIDE {
+ fCanvas->drawPicture(fPicture, fMatrix, fPaint);
+ }
+};
+
void SkMultiPictureDraw::draw() {
+
+ if (true) {
+ const int count = fDrawData.count();
+ SkAutoSTArray<32, PictureDrawRunnable> pdr(count);
+ SkTaskGroup group;
+ for (int i = 0; i < count; ++i) {
robertphillips 2014/10/27 12:34:05 It seems like this portion should go with the draw
+ const DrawData& data = fDrawData[i];
+ pdr[i].init(data.canvas, data.picture, &data.matrix, data.paint);
+ group.add(&pdr[i]);
+ }
+ return;
+ }
#ifndef SK_IGNORE_GPU_LAYER_HOISTING
GrContext* context = NULL;
« 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