Revert "hide picture virtuals (no public callers)"
This reverts commit 8005bff7e631a269f0dfaae93ff9963dc0e5ff39.
Reason for revert: hwui, flutter, and headless blink in G3 all still using these.
Original change's description:
> hide picture virtuals (no public callers)
>
> This prepares the way for a clean impl of a "placeholder" picture that never unrolls
>
> Bug: skia:
> Change-Id: I3b5785c5c94432b54e9a7dc280b2a6e716592473
> Reviewed-on: https://skia-review.googlesource.com/100260
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Mike Klein <mtklein@chromium.org>
TBR=mtklein@chromium.org,mtklein@google.com,reed@google.com
Change-Id: I385789dd420588ea9a9390c8a44c6ecb96c7f358
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/100880
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 4f43a93..49da8eb 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -28,7 +28,7 @@
#include "SkNx.h"
#include "SkPaintPriv.h"
#include "SkPatchUtils.h"
-#include "SkPicturePriv.h"
+#include "SkPicture.h"
#include "SkRasterClip.h"
#include "SkRasterHandleAllocator.h"
#include "SkRRect.h"
@@ -2786,6 +2786,15 @@
///////////////////////////////////////////////////////////////////////////////
+/**
+ * This constant is trying to balance the speed of ref'ing a subpicture into a parent picture,
+ * against the playback cost of recursing into the subpicture to get at its actual ops.
+ *
+ * For now we pick a conservatively small value, though measurement (and other heuristics like
+ * the type of ops contained) may justify changing this value.
+ */
+#define kMaxPictureOpsToUnrollInsteadOfRef 1
+
void SkCanvas::drawPicture(const SkPicture* picture, const SkMatrix* matrix, const SkPaint* paint) {
TRACE_EVENT0("skia", TRACE_FUNC);
RETURN_ON_NULL(picture);
@@ -2793,7 +2802,12 @@
if (matrix && matrix->isIdentity()) {
matrix = nullptr;
}
- this->onDrawPicture(picture, matrix, paint);
+ if (picture->approximateOpCount() <= kMaxPictureOpsToUnrollInsteadOfRef) {
+ SkAutoCanvasMatrixPaint acmp(this, matrix, paint, picture->cullRect());
+ picture->playback(this);
+ } else {
+ this->onDrawPicture(picture, matrix, paint);
+ }
}
void SkCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matrix,