Add a flag to flush the canvases during SkMultiPictureDraw::draw().
This is necessary for multisampling, so that each multisampled render
target resolves before Chrome's compositor attempts to draw the
texture.
BUG=skia:
Review URL: https://codereview.chromium.org/878653004
diff --git a/include/core/SkMultiPictureDraw.h b/include/core/SkMultiPictureDraw.h
index ce78896..809e2df 100644
--- a/include/core/SkMultiPictureDraw.h
+++ b/include/core/SkMultiPictureDraw.h
@@ -45,9 +45,10 @@
/**
* Perform all the previously added draws. This will reset the state
- * of this object.
+ * of this object. If flush is true, all canvases are flushed after
+ * draw.
*/
- void draw();
+ void draw(bool flush = false);
/**
* Abandon all buffered draws and reset to the initial state.
diff --git a/src/core/SkMultiPictureDraw.cpp b/src/core/SkMultiPictureDraw.cpp
index c85c567..7cdab73 100644
--- a/src/core/SkMultiPictureDraw.cpp
+++ b/src/core/SkMultiPictureDraw.cpp
@@ -86,7 +86,7 @@
//#define FORCE_SINGLE_THREAD_DRAWING_FOR_TESTING
-void SkMultiPictureDraw::draw() {
+void SkMultiPictureDraw::draw(bool flush) {
AutoMPDReset mpdreset(this);
#ifdef FORCE_SINGLE_THREAD_DRAWING_FOR_TESTING
@@ -192,6 +192,9 @@
{
canvas->drawPicture(picture, &data.fMatrix, data.fPaint);
}
+ if (flush) {
+ canvas->flush();
+ }
}
#if !defined(SK_IGNORE_GPU_LAYER_HOISTING) && SK_SUPPORT_GPU