aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Yuqian Li <liyuqian@google.com>2018-02-23 14:59:32 +0800
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-02-25 16:31:49 +0000
commit3fd84fa4bff159db472db166ca31bdf969f143bb (patch)
tree876768f1a06821147550c9476f27770156e81a0c /src
parent8a3f65421214a21c480d6ee268eb29f2c5769078 (diff)
Set empty drawFn when init-once returns early
Bug: skia: Change-Id: I01def2c2c9651585555740e5ab86f8eac38be6fc Reviewed-on: https://skia-review.googlesource.com/109721 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/SkDraw.cpp6
-rw-r--r--src/core/SkThreadedBMPDevice.h7
2 files changed, 12 insertions, 1 deletions
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index 4b847db295..6f8ee30602 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -972,6 +972,9 @@ void SkDraw::drawDevPath(const SkPath& devPath, const SkPaint& paint, bool drawC
SkStrokeRec::InitStyle style = doFill ? SkStrokeRec::kFill_InitStyle
: SkStrokeRec::kHairline_InitStyle;
if (as_MFB(paint.getMaskFilter())->filterPath(devPath, *fMatrix, *fRC, blitter, style)) {
+ if (iData) {
+ iData->setEmptyDrawFn();
+ }
return; // filterPath() called the blitter, so we're done
}
}
@@ -1053,6 +1056,9 @@ void SkDraw::drawPath(const SkPath& origSrcPath, const SkPaint& origPaint,
// nothing to draw
if (fRC->isEmpty()) {
+ if (iData) {
+ iData->setEmptyDrawFn();
+ }
return;
}
diff --git a/src/core/SkThreadedBMPDevice.h b/src/core/SkThreadedBMPDevice.h
index 3f0984110b..acdbc62414 100644
--- a/src/core/SkThreadedBMPDevice.h
+++ b/src/core/SkThreadedBMPDevice.h
@@ -174,7 +174,7 @@ private:
DrawQueue fQueue;
- friend struct SkInitOnceData; // to access DrawElement
+ friend struct SkInitOnceData; // to access DrawElement and DrawState
friend class SkDraw; // to access DrawState
typedef SkBitmapDevice INHERITED;
@@ -185,6 +185,11 @@ private:
struct SkInitOnceData {
SkArenaAlloc* fAlloc;
SkThreadedBMPDevice::DrawElement* fElement;
+
+ void setEmptyDrawFn() {
+ fElement->setDrawFn([](SkArenaAlloc* threadAlloc, const SkThreadedBMPDevice::DrawState& ds,
+ const SkIRect& tileBounds){});
+ }
};
#endif // SkThreadedBMPDevice_DEFINED